Pythin createprocessasuser -- OpenProcessToken, 'Access is denied.'

Ivan Voras iv at
Mon Jun 14 12:31:34 CEST 2004

Pete Fong wrote:

> I am a beginner with Python. I want to write a program as "runas" in
> Windows XP.

> handel=win32security.LogonUser('administrator','domain','pwd',win32con.LOGON32_LOGON_INTERACTIVE,win32con.LOGON32_PROVIDER_DEFAULT)

IIRC, you can't use these win32 calls if you don't hav e appropriate rights. 
Only administrators and backup users can do impersonation (see msdn or such 
for details).

(I think Explorer gets around it by delegating the impersonation to some 
system service).

More information about the Python-list mailing list