Re: NtQuerySystemInformation
"Diez B. Roggisch" <[email protected]> Wed, 28 Oct 2015 14:03:38 +0100
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <[email protected]> |
Have you tried defining the signature of NtQuerySystemInformation? It could be that arguments are being truncated. Also, is that really a CDLL, not a WINDLL? Cheers, Diez > On 28 Oct 2015, at 13:31, Cristian Badescu <[email protected]> wrote: > > 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 ------------------------------------------------------------------------------ _______________________________________________ ctypes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ctypes-users