win32security.AdjustTokenPrivileges

Patrick Blanchette pblanchette at pixelsystems.com
Tue Dec 5 22:57:03 CET 2000


In fact, the declaration of OpenProcessToken in the Python extensions 
for Windows is :
int = OpenProcessToken( processHandle, desiredAccess ).
I suppose the integer returns is the token handle.

Regards

Carlo Bertuccini wrote:

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20001205/b674a241/attachment.html>


More information about the Python-list mailing list