win32security.AdjustTokenPrivileges
Patrick Blanchette
pblanchette at pixelsystems.com
Tue Dec 5 13:34:26 EST 2000
I,
I'd like to reboot a windows NT station using a Python script. It is
supposed to be possible using the Python extensions for Windows. I try
the following code but an exception is thrown after the call to
AdjustTokenPrivileges:
-----------------------------------------------
hProcess = GetCurrentProcess()
processToken = OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY)
procPrivValue = LookupPrivilegeValue (None, SE_SHUTDOWN_NAME)
AdjustTokenPrivileges (processToken, 0, (provValue, SE_PRIVILEGE_ENABLED) )
ExitWindowsEx(EWX_REBOOT | EWX_FORCE, 0)
-->
Traceback (innermost last):
File "<interactive input>", line 1, in ?
TypeError: A TOKEN_PRIVILEGES object must be a tuple of (LARGE_INTEGER, int)
-----------------------------------------------
How should I use the AdjustTokenPrivileges function?
thank
More information about the Python-list
mailing list