win32security.AdjustTokenPrivileges

Carlo Bertuccini c.bertu at libero.it
Tue Dec 5 14:33:29 EST 2000


Hi Patrick,

> hProcess = GetCurrentProcess()
> processToken = OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES |
> TOKEN_QUERY)

There is something strange in your code ... this is the declaration of
OpenProcessToken:

BOOL OpenProcessToken(
    HANDLE ProcessHandle, // handle to process
    DWORD DesiredAccess, // desired access to process
    PHANDLE TokenHandle  // pointer to handle of open access token
   );

The "ProcessToken" is not the Token Handle, but a boolean value: the result
of the function.
The AdjustTokenPrivileges needs the real Token Handle in order to set the
new privileges.

Regards,
--
- Carlo -
c.bertu at libero.it









More information about the Python-list mailing list