def get_currents_privs():
 GetTokenInformation = ctypes.windll.advapi32.GetTokenInformation
 GetTokenInformation.argtypes = [wintypes.HANDLE, ctypes.c_uint, ctypes.c_void_p, wintypes.DWORD, ctypes.POINTER(wintypes.DWORD)]
 GetTokenInformation.restype = wintypes.BOOL
 return_length = wintypes.DWORD()
 params = [get_process_token(), TOKEN_INFORMATION_CLASS.TokenPrivileges, None, 0, return_length]
 res = GetTokenInformation(*params)
 buffer = ctypes.create_string_buffer(return_length.value)
 params[2] = buffer
 params[3] = return_length.value
 res = GetTokenInformation(*params)
 assert (res > 0), ('Error in second GetTokenInformation (%d)' % res)
 privileges = ctypes.cast(buffer, ctypes.POINTER(TOKEN_PRIVS)).contents
 return privileges

def get_currents_privs ( ) : GetTokenInformation = ctypes . windll . advapi32 . GetTokenInformation GetTokenInformation . argtypes = [ wintypes . HANDLE , ctypes . c_uint , ctypes . c_void_p , wintypes . DWORD , ctypes . POINTER ( wintypes . DWORD ) ] GetTokenInformation . restype = wintypes . BOOL return_length = wintypes . DWORD ( ) params = [ get_process_token ( ) , TOKEN_INFORMATION_CLASS . TokenPrivileges , None , 0 , return_length ] res = GetTokenInformation ( * params ) buffer = ctypes . create_string_buffer ( return_length . value ) params [ 2 ] = buffer params [ 3 ] = return_length . value res = GetTokenInformation ( * params ) assert ( res > 0 ) , ( 'Error in second GetTokenInformation (%d)' % res ) privileges = ctypes . cast ( buffer , ctypes . POINTER ( TOKEN_PRIVS ) ) . contents return privileges
get all privileges associated with the current process .