mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Fixed bug introduced in token.privileges in ad592980 + associated tests
This commit is contained in:
@@ -82,6 +82,15 @@ def test_adjust_privilege(newtok):
|
||||
assert newtok.privileges[PRIVILEGE_NAME] & gdef.SE_PRIVILEGE_ENABLED
|
||||
|
||||
|
||||
def test_token_privilege_dict(newtok):
|
||||
PRIVILEGE_NAME = b"SeShutdownPrivilege"
|
||||
privdict = newtok.privileges
|
||||
# These API use Token._lookup_name() that are not tested by other means
|
||||
assert privdict.keys()
|
||||
assert privdict.items()
|
||||
assert PRIVILEGE_NAME in privdict.keys() # Implement contains ?
|
||||
|
||||
|
||||
def test_token_groups(curtok):
|
||||
groups = curtok.groups
|
||||
groups_size = groups.GroupCount
|
||||
|
||||
@@ -114,7 +114,7 @@ class TokenPrivileges(gdef.TOKEN_PRIVILEGES):
|
||||
|
||||
def _lookup_name(self, luid):
|
||||
size = gdef.DWORD(0x100)
|
||||
buff = ctypes.c_buffer(size.value)
|
||||
buff = ctypes.create_unicode_buffer(size.value)
|
||||
winproxy.LookupPrivilegeNameW(None, luid, buff, size)
|
||||
return buff[:size.value]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user