NtQuerySystemInformation
Cristian Badescu <[email protected]> Wed, 28 Oct 2015 14:31:57 +0200
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <CA+NeSDLXKKPZZ4pDFn_bA7bacGm5LbMsicr6vMP6FgT_ChLApw@mail.gmail.com> |
Hello,
I am trying to get handles information by using NtQuerySystemInformation
but my code fails for some reason. I am using the following code to call
NtQuerySystemInformation:
from ctypes import *
from ctypes.util import *
class SYSTEM_HANDLE(Structure):
_fields_ = [("ProcessId", c_ulong),
("ObjetTypeNumber", c_byte),
("Flags", c_byte),
("Handle", c_ushort),
("Object", c_void_p ),
("GrantedAccess", c_ulong)
]
class SYSTEM_HANDLE_INFORMATION(Structure):
_fields_ = [("HandleCount", c_ulong),
("Handles", SYSTEM_HANDLE * 1)
]
handleInfoSize = 65536
SystemHandleInformation = 16
c_lib=CDLL(find_library("c"))
malloc=c_lib.malloc
malloc.restype=c_void_p
handleInfo = malloc(handleInfoSize)
pHandleInfo = cast(handleInfo, POINTER(SYSTEM_HANDLE_INFORMATION))
retVal = cdll.ntdll.NtQuerySystemInformation(SystemHandleInformation,
pHandleInfo, handleInfoSize, None)
------------------------------------------------------------------------------
_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users