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
[email protected]
http://mail.python.org/mailman/listinfo/python-win32