craziscoth Posted July 14, 2005 Share Posted July 14, 2005 Hi all,Writing some code that needs to be able to logon as another user to modify some registry keys. I am using the LogonUser() function and it works fine when my code is executed on a WinXP machine, but I also need to support WinNT. When I run the code on WinNT I get an error that I don't have appropriate privileges. I've read some about the SE_TCB_NAME privilege, but how do I get this privilege at runtime? Is there a better way to logon as another user in WinNT?Thanks Link to comment Share on other sites More sharing options...
SenthilKumarM Posted November 9, 2005 Share Posted November 9, 2005 Hi dude,Can you give me the sourcecode and exe which works in windows XP?Thanks and Regards,Senthil Kumar M. Link to comment Share on other sites More sharing options...
craziscoth Posted November 10, 2005 Author Share Posted November 10, 2005 I don't have the code anymore as I switched to using SSPI to logon as another user.Check Microsofts site:http://msdn.microsoft.com/library/default....y/logonuser.aspHere is a snipet of code I used to get a handle to another users HKCU registry key:HANDLE hToken = NULL;LogonUser(tName, tDomain, tPassword, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hToken);PROFILEINFO pi = {sizeof pi, PI_NOUI, tName};LoadUserProfile(hToken, π);//registry code hereUnloadUserProfile(hToken, pi.hProfile);CloseHandle(hToken);hToken = NULL; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now