Mark Hammond MarkH at
Wed Dec 6 00:53:09 CET 2000

Patrick Blanchette wrote:

> 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)

The error message is telling you the problem, but not very well :-)

The function expects a list of tuples.  So, for example, you code should 
work with:

AdjustTokenPrivileges (processToken, 0, [(provValue,SE_PRIVILEGE_ENABLED)] )

I actually provide this exact example in Programming Python on Win32.


More information about the Python-list mailing list