Hi, Not an answer to this thread but a related win32 authorization question?
Does windows OS have a standard dialog box I can call from python that queries the username/password, and returns a token? I'd like not to have to worry about other peoples plain text passwords being in variables in my script. and I was hoping the OS would provide a GUI dialog authorization as a convenience function. I googled, looked on msdn, .. there is so many hits and so much noise, I don't know what key words to use to narrow my search down to useful stuff.. Cheers Steve Matt Herbert (matherbe) wrote: > Hey all, > > Is there a way to make impersonation follow threads? Given this simple > example: > > import win32api > import win32security > import win32con > from threading import Thread > > class Test(Thread): > def run(self): > print "Username (in thread): ", win32api.GetUserName() > > print "Username (before impersonate): ", win32api.GetUserName() > token = win32security.LogonUser('testuser', None, 'testuser', \ > win32con.LOGON32_LOGON_INTERACTIVE, > win32con.LOGON32_PROVIDER_DEFAULT) > win32security.ImpersonateLoggedOnUser(token) > print "Username (after impersonate): ", win32api.GetUserName() > > Test().start() > print "Username (after thread): ", win32api.GetUserName() > > The output will be something like: > > Username (before impersonate): Administrator > Username (after impersonate): testuser > Username (after thread): testuser > Username (in thread): Administrator > > Thanks > -Matt > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32