From 1a85d99b0e6608553144eb620e0eaee148442390 Mon Sep 17 00:00:00 2001 From: Clement Rouault Date: Thu, 24 Mar 2016 16:03:13 +0100 Subject: [PATCH] windows.com with a cleaner interface + use in wmi.pu --- ctypes_generation/func_parser.py | 2 +- ctypes_generation/generate.py | 4 + ctypes_generation/windef.txt | 25 +- ctypes_generation/winfunc.txt | 25 ++ ctypes_generation/winstruct.txt | 42 +- windows/com.py | 18 +- windows/generated_def/__init__.py | 2 + windows/generated_def/windef.py | 20 +- windows/generated_def/winfuncs.py | 578 +++++++++++++++++++--------- windows/generated_def/winstructs.py | 262 ++++++++++++- windows/winobject/wmi.py | 105 ++--- windows/winproxy.py | 19 +- 12 files changed, 823 insertions(+), 279 deletions(-) diff --git a/ctypes_generation/func_parser.py b/ctypes_generation/func_parser.py index 8949073..4ec7b94 100644 --- a/ctypes_generation/func_parser.py +++ b/ctypes_generation/func_parser.py @@ -18,7 +18,7 @@ class WinFunc(object): return self.generate_comment_ctypes() + "\n" + self.generate_prototype_ctypes() + "\n" + self.generate_paramflags_ctypes() + "\n" def generate_comment_ctypes(self): - model = "# {0}({1}):" + model = "#def {0}({1}):\n# return {0}.ctypes_function({1})" ctypes_param = [name for type, name in self.params] ctypes_param_str = ", ".join(ctypes_param) return model.format(self.name, ctypes_param_str) diff --git a/ctypes_generation/generate.py b/ctypes_generation/generate.py index 7f6e622..07595f0 100644 --- a/ctypes_generation/generate.py +++ b/ctypes_generation/generate.py @@ -33,6 +33,8 @@ TYPE_EQUIVALENCE = [ ('CSHORT', 'c_short'), ('VARTYPE', 'c_ushort'), ('BSTR', 'c_wchar_p'), + ('OLECHAR', 'c_wchar'), + ('POLECHAR', 'c_wchar_p'), ('PUCHAR', 'POINTER(UCHAR)'), ('double', 'c_double'), ('FARPROC', 'PVOID'), @@ -62,6 +64,8 @@ TYPE_EQUIVALENCE = [ ('SECURITY_CONTEXT_TRACKING_MODE', 'BOOLEAN'), ("DISPID", "LONG"), ("MEMBERID", "DISPID"), + ('PSECURITY_DESCRIPTOR', 'PVOID'), + ('LPUNKNOWN', 'POINTER(PVOID)'), # Will be changed at import time ('LPCONTEXT', 'PVOID'), ('HCERTSTORE', 'PVOID'), diff --git a/ctypes_generation/windef.txt b/ctypes_generation/windef.txt index d3068f4..50472e8 100644 --- a/ctypes_generation/windef.txt +++ b/ctypes_generation/windef.txt @@ -867,4 +867,27 @@ #define SM_REMOTESESSION 0x1000 #define SM_SHUTTINGDOWN 0x2000 #define SM_REMOTECONTROL 0x2001 -#define SM_CARETBLINKINGENABLED 0x2002 \ No newline at end of file +#define SM_CARETBLINKINGENABLED 0x2002 + + +#define RPC_C_AUTHN_LEVEL_DEFAULT 0 +#define RPC_C_AUTHN_LEVEL_NONE 1 +#define RPC_C_AUTHN_LEVEL_CONNECT 2 +#define RPC_C_AUTHN_LEVEL_CALL 3 +#define RPC_C_AUTHN_LEVEL_PKT 4 +#define RPC_C_AUTHN_LEVEL_PKT_INTEGRITY 5 +#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY 6 + +#define RPC_C_IMP_LEVEL_DEFAULT 0 +#define RPC_C_IMP_LEVEL_ANONYMOUS 1 +#define RPC_C_IMP_LEVEL_IDENTIFY 2 +#define RPC_C_IMP_LEVEL_IMPERSONATE 3 +#define RPC_C_IMP_LEVEL_DELEGATE 4 + +#define RPC_C_QOS_IDENTITY_STATIC 0 +#define RPC_C_QOS_IDENTITY_DYNAMIC 1 + +#define RPC_C_QOS_CAPABILITIES_DEFAULT 0x0 +#define RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH 0x1 +#define RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC 0x2 +#define RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY 0x4 \ No newline at end of file diff --git a/ctypes_generation/winfunc.txt b/ctypes_generation/winfunc.txt index ef147a5..a6c98f5 100644 --- a/ctypes_generation/winfunc.txt +++ b/ctypes_generation/winfunc.txt @@ -1155,4 +1155,29 @@ BOOL WINAPI LookupAccountSidW( _Out_opt_ LPWSTR lpReferencedDomainName, _Inout_ LPDWORD cchReferencedDomainName, _Out_ PSID_NAME_USE peUse +); + +HRESULT WINAPI CoInitializeEx( + _In_opt_ LPVOID pvReserved, + _In_ DWORD dwCoInit +); + +HRESULT WINAPI CoInitializeSecurity( + _In_opt_ PSECURITY_DESCRIPTOR pSecDesc, + _In_ LONG cAuthSvc, + _In_opt_ SOLE_AUTHENTICATION_SERVICE *asAuthSvc, + _In_opt_ PVOID pReserved1, + _In_ DWORD dwAuthnLevel, + _In_ DWORD dwImpLevel, + _In_opt_ PVOID pAuthList, + _In_ DWORD dwCapabilities, + _In_opt_ PVOID pReserved3 +); + +HRESULT WINAPI CoCreateInstance( + _In_ REFCLSID rclsid, + _In_ LPUNKNOWN pUnkOuter, + _In_ DWORD dwClsContext, + _In_ REFIID riid, + _Out_ LPVOID *ppv ); \ No newline at end of file diff --git a/ctypes_generation/winstruct.txt b/ctypes_generation/winstruct.txt index 864d902..a79ce5f 100644 --- a/ctypes_generation/winstruct.txt +++ b/ctypes_generation/winstruct.txt @@ -585,6 +585,33 @@ typedef enum tag_WBEMSTATUS { WBEMMOF_E_INVALID_DELETECLASS_SYNTAX = 0x80044031 } WBEMSTATUS; +typedef enum tagCLSCTX { + CLSCTX_INPROC_SERVER = 0x1, + CLSCTX_INPROC_HANDLER = 0x2, + CLSCTX_LOCAL_SERVER = 0x4, + CLSCTX_INPROC_SERVER16 = 0x8, + CLSCTX_REMOTE_SERVER = 0x10, + CLSCTX_INPROC_HANDLER16 = 0x20, + CLSCTX_RESERVED1 = 0x40, + CLSCTX_RESERVED2 = 0x80, + CLSCTX_RESERVED3 = 0x100, + CLSCTX_RESERVED4 = 0x200, + CLSCTX_NO_CODE_DOWNLOAD = 0x400, + CLSCTX_RESERVED5 = 0x800, + CLSCTX_NO_CUSTOM_MARSHAL = 0x1000, + CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000, + CLSCTX_NO_FAILURE_LOG = 0x4000, + CLSCTX_DISABLE_AAA = 0x8000, + CLSCTX_ENABLE_AAA = 0x10000, + CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000, + CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000, + CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000, + CLSCTX_ENABLE_CLOAKING = 0x100000, + CLSCTX_APPCONTAINER = 0x400000, + CLSCTX_ACTIVATE_AAA_AS_IU = 0x800000, + CLSCTX_PS_DLL = 0x80000000 +} CLSCTX; + typedef struct _LDR_DATA_TABLE_ENTRY { PVOID Reserved1[2]; LIST_ENTRY InMemoryOrderLinks; @@ -1495,12 +1522,19 @@ typedef enum _PROCESSINFOCLASS { ProcessWow64Information = 26 } PROCESSINFOCLASS; +typedef enum tagCOINIT { + COINIT_APARTMENTTHREADED = 0x2, + COINIT_MULTITHREADED = 0x0, + COINIT_DISABLE_OLE1DDE = 0x4, + COINIT_SPEED_OVER_MEMORY = 0x8 +} COINIT; + typedef struct _GUID { ULONG Data1; USHORT Data2; USHORT Data3; BYTE Data4[ 8 ]; -} GUID, IID, *REFIID; +} GUID, IID, *REFIID, *REFCLSID; @@ -2140,3 +2174,9 @@ typedef struct _PUBLIC_OBJECT_BASIC_INFORMATION { DWORD DataOffset; } EVENTLOGRECORD, *PEVENTLOGRECORD; +typedef struct tagSOLE_AUTHENTICATION_SERVICE { + DWORD dwAuthnSvc; + DWORD dwAuthzSvc; + OLECHAR *pPrincipalName; + HRESULT hr; +} SOLE_AUTHENTICATION_SERVICE, *PSOLE_AUTHENTICATION_SERVICE; \ No newline at end of file diff --git a/windows/com.py b/windows/com.py index b2bf88c..d6bc65b 100644 --- a/windows/com.py +++ b/windows/com.py @@ -1,8 +1,10 @@ import struct import ctypes import functools -from ctypes.wintypes import HRESULT +from ctypes.wintypes import HRESULT, byref, pointer +from windows import winproxy +from windows.generated_def import RPC_C_IMP_LEVEL_IMPERSONATE, CLSCTX_INPROC_SERVER from windows.generated_def import interfaces from windows.generated_def.interfaces import generate_IID, IID @@ -15,6 +17,20 @@ def create_c_callable(func, types, keepalive=[]): keepalive.append(c_callable) return c_callback_addr +def init(): + t = winproxy.CoInitializeEx() + if t: + return t + return winproxy.CoInitializeSecurity(0, -1, None, 0, 0, RPC_C_IMP_LEVEL_IMPERSONATE, 0,0,0) + +def create_instance(clsiid, targetinterface, custom_iid=None): + if custom_iid is None: + custom_iid = targetinterface.IID + return winproxy.CoCreateInstance(byref(clsiid), None, CLSCTX_INPROC_SERVER, byref(custom_iid), byref(targetinterface)) + + + + class ComVtable(object): # Name, types diff --git a/windows/generated_def/__init__.py b/windows/generated_def/__init__.py index b49ee7b..f0f02d2 100644 --- a/windows/generated_def/__init__.py +++ b/windows/generated_def/__init__.py @@ -36,11 +36,13 @@ else: from . import winfuncs from . import windef +from . import interfaces # Fuck it from winstructs import * from winfuncs import * from windef import * +from interfaces import * diff --git a/windows/generated_def/windef.py b/windows/generated_def/windef.py index 0a48eb9..32b34c1 100644 --- a/windows/generated_def/windef.py +++ b/windows/generated_def/windef.py @@ -2576,4 +2576,22 @@ SM_MAXIMUMTOUCHES = Flag("SM_MAXIMUMTOUCHES", 95) SM_REMOTESESSION = Flag("SM_REMOTESESSION", 0x1000) SM_SHUTTINGDOWN = Flag("SM_SHUTTINGDOWN", 0x2000) SM_REMOTECONTROL = Flag("SM_REMOTECONTROL", 0x2001) -SM_CARETBLINKINGENABLED = Flag("SM_CARETBLINKINGENABLED", 0x2002) \ No newline at end of file +SM_CARETBLINKINGENABLED = Flag("SM_CARETBLINKINGENABLED", 0x2002) +RPC_C_AUTHN_LEVEL_DEFAULT = Flag("RPC_C_AUTHN_LEVEL_DEFAULT", 0) +RPC_C_AUTHN_LEVEL_NONE = Flag("RPC_C_AUTHN_LEVEL_NONE", 1) +RPC_C_AUTHN_LEVEL_CONNECT = Flag("RPC_C_AUTHN_LEVEL_CONNECT", 2) +RPC_C_AUTHN_LEVEL_CALL = Flag("RPC_C_AUTHN_LEVEL_CALL", 3) +RPC_C_AUTHN_LEVEL_PKT = Flag("RPC_C_AUTHN_LEVEL_PKT", 4) +RPC_C_AUTHN_LEVEL_PKT_INTEGRITY = Flag("RPC_C_AUTHN_LEVEL_PKT_INTEGRITY", 5) +RPC_C_AUTHN_LEVEL_PKT_PRIVACY = Flag("RPC_C_AUTHN_LEVEL_PKT_PRIVACY", 6) +RPC_C_IMP_LEVEL_DEFAULT = Flag("RPC_C_IMP_LEVEL_DEFAULT", 0) +RPC_C_IMP_LEVEL_ANONYMOUS = Flag("RPC_C_IMP_LEVEL_ANONYMOUS", 1) +RPC_C_IMP_LEVEL_IDENTIFY = Flag("RPC_C_IMP_LEVEL_IDENTIFY", 2) +RPC_C_IMP_LEVEL_IMPERSONATE = Flag("RPC_C_IMP_LEVEL_IMPERSONATE", 3) +RPC_C_IMP_LEVEL_DELEGATE = Flag("RPC_C_IMP_LEVEL_DELEGATE", 4) +RPC_C_QOS_IDENTITY_STATIC = Flag("RPC_C_QOS_IDENTITY_STATIC", 0) +RPC_C_QOS_IDENTITY_DYNAMIC = Flag("RPC_C_QOS_IDENTITY_DYNAMIC", 1) +RPC_C_QOS_CAPABILITIES_DEFAULT = Flag("RPC_C_QOS_CAPABILITIES_DEFAULT", 0x0) +RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH = Flag("RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH", 0x1) +RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC = Flag("RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC", 0x2) +RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY = Flag("RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY", 0x4) \ No newline at end of file diff --git a/windows/generated_def/winfuncs.py b/windows/generated_def/winfuncs.py index a407332..586af0f 100644 --- a/windows/generated_def/winfuncs.py +++ b/windows/generated_def/winfuncs.py @@ -3,753 +3,955 @@ from ctypes import * from ctypes.wintypes import * from .winstructs import * -functions = ['ExitProcess', 'TerminateProcess', 'GetLastError', 'GetCurrentProcess', 'CreateFileA', 'CreateFileW', 'LdrLoadDll', 'NtQuerySystemInformation', 'NtQueryInformationProcess', 'NtQueryVirtualMemory', 'NtCreateThreadEx', 'NtQueryInformationThread', 'GetExitCodeThread', 'GetExitCodeProcess', 'VirtualAlloc', 'VirtualAllocEx', 'VirtualFree', 'VirtualFreeEx', 'VirtualProtect', 'VirtualQuery', 'VirtualQueryEx', 'GetModuleFileNameA', 'GetModuleFileNameW', 'CreateThread', 'CreateRemoteThread', 'VirtualProtect', 'CreateProcessA', 'CreateProcessW', 'GetThreadContext', 'NtGetContextThread', 'SetThreadContext', 'NtSetContextThread', 'OpenThread', 'OpenProcess', 'CloseHandle', 'ReadProcessMemory', 'NtWow64ReadVirtualMemory64', 'WriteProcessMemory', 'CreateToolhelp32Snapshot', 'Thread32First', 'Thread32Next', 'Process32First', 'Process32Next', 'Process32FirstW', 'Process32NextW', 'GetProcAddress', 'LoadLibraryA', 'LoadLibraryW', 'OpenProcessToken', 'LookupPrivilegeValueA', 'LookupPrivilegeValueW', 'AdjustTokenPrivileges', 'FindResourceA', 'FindResourceW', 'SizeofResource', 'LoadResource', 'LockResource', 'GetVersionExA', 'GetVersionExW', 'GetVersion', 'GetCurrentThread', 'GetCurrentThreadId', 'GetCurrentProcessorNumber', 'AllocConsole', 'FreeConsole', 'GetStdHandle', 'SetStdHandle', 'SetThreadAffinityMask', 'WriteFile', 'GetExtendedTcpTable', 'GetExtendedUdpTable', 'SetTcpEntry', 'AddVectoredContinueHandler', 'AddVectoredExceptionHandler', 'TerminateThread', 'ExitThread', 'RemoveVectoredExceptionHandler', 'ResumeThread', 'SuspendThread', 'WaitForSingleObject', 'GetThreadId', 'LoadLibraryExA', 'LoadLibraryExW', 'SymInitialize', 'SymFromName', 'SymLoadModuleEx', 'SymSetOptions', 'SymGetTypeInfo', 'DeviceIoControl', 'GetTokenInformation', 'RegOpenKeyExA', 'RegOpenKeyExW', 'RegGetValueA', 'RegGetValueW', 'RegCloseKey', 'Wow64DisableWow64FsRedirection', 'Wow64RevertWow64FsRedirection', 'Wow64EnableWow64FsRedirection', 'Wow64GetThreadContext', 'SetConsoleCtrlHandler', 'WinVerifyTrust', 'GlobalAlloc', 'GlobalFree', 'GlobalUnlock', 'GlobalLock', 'OpenClipboard', 'EmptyClipboard', 'CloseClipboard', 'SetClipboardData', 'GetClipboardData', 'EnumClipboardFormats', 'GetClipboardFormatNameA', 'GetClipboardFormatNameW', 'WinVerifyTrust', 'OpenProcessToken', 'OpenThreadToken', 'GetTokenInformation', 'SetTokenInformation', 'GetSidIdentifierAuthority', 'GetSidSubAuthority', 'GetSidSubAuthorityCount', 'DebugBreak', 'WaitForDebugEvent', 'ContinueDebugEvent', 'DebugActiveProcess', 'DebugActiveProcessStop', 'DebugSetProcessKillOnExit', 'DebugBreakProcess', 'GetProcessId', 'Wow64SetThreadContext', 'GetMappedFileNameW', 'GetMappedFileNameA', 'RtlInitString', 'RtlInitUnicodeString', 'RtlAnsiStringToUnicodeString', 'OpenEventA', 'OpenEventW', 'NtOpenEvent', 'NtAlpcConnectPort', 'NtAlpcSendWaitReceivePort', 'lstrcmpA', 'lstrcmpW', 'CreateFileMappingA', 'CreateFileMappingW', 'MapViewOfFile', 'OpenSCManagerA', 'OpenSCManagerW', 'EnumServicesStatusExA', 'EnumServicesStatusExW', 'EnumWindows', 'GetWindowTextA', 'GetWindowTextW', 'GetWindowModuleFileNameA', 'GetWindowModuleFileNameW', 'CryptCATAdminCalcHashFromFileHandle', 'CryptCATAdminEnumCatalogFromHash', 'CryptCATAdminAcquireContext', 'CryptCATCatalogInfoFromContext', 'CryptCATAdminReleaseCatalogContext', 'CryptCATAdminReleaseContext', 'GetLogicalDriveStringsA', 'GetLogicalDriveStringsW', 'GetVolumeInformationA', 'GetVolumeInformationW', 'GetVolumeNameForVolumeMountPointA', 'GetVolumeNameForVolumeMountPointW', 'GetDriveTypeA', 'GetDriveTypeW', 'QueryDosDeviceA', 'QueryDosDeviceW', 'NtQueryObject', 'DuplicateHandle', 'GetModuleBaseNameA', 'GetModuleBaseNameW', 'GetProcessImageFileNameA', 'GetProcessImageFileNameW', 'GetFileVersionInfoA', 'GetFileVersionInfoW', 'GetFileVersionInfoSizeA', 'GetFileVersionInfoSizeW', 'VerQueryValueA', 'VerQueryValueW', 'GetSystemMetrics', 'GetComputerNameA', 'GetComputerNameW', 'LookupAccountSidA', 'LookupAccountSidW'] +functions = ['ExitProcess', 'TerminateProcess', 'GetLastError', 'GetCurrentProcess', 'CreateFileA', 'CreateFileW', 'LdrLoadDll', 'NtQuerySystemInformation', 'NtQueryInformationProcess', 'NtQueryVirtualMemory', 'NtCreateThreadEx', 'NtQueryInformationThread', 'GetExitCodeThread', 'GetExitCodeProcess', 'VirtualAlloc', 'VirtualAllocEx', 'VirtualFree', 'VirtualFreeEx', 'VirtualProtect', 'VirtualQuery', 'VirtualQueryEx', 'GetModuleFileNameA', 'GetModuleFileNameW', 'CreateThread', 'CreateRemoteThread', 'VirtualProtect', 'CreateProcessA', 'CreateProcessW', 'GetThreadContext', 'NtGetContextThread', 'SetThreadContext', 'NtSetContextThread', 'OpenThread', 'OpenProcess', 'CloseHandle', 'ReadProcessMemory', 'NtWow64ReadVirtualMemory64', 'WriteProcessMemory', 'CreateToolhelp32Snapshot', 'Thread32First', 'Thread32Next', 'Process32First', 'Process32Next', 'Process32FirstW', 'Process32NextW', 'GetProcAddress', 'LoadLibraryA', 'LoadLibraryW', 'OpenProcessToken', 'LookupPrivilegeValueA', 'LookupPrivilegeValueW', 'AdjustTokenPrivileges', 'FindResourceA', 'FindResourceW', 'SizeofResource', 'LoadResource', 'LockResource', 'GetVersionExA', 'GetVersionExW', 'GetVersion', 'GetCurrentThread', 'GetCurrentThreadId', 'GetCurrentProcessorNumber', 'AllocConsole', 'FreeConsole', 'GetStdHandle', 'SetStdHandle', 'SetThreadAffinityMask', 'WriteFile', 'GetExtendedTcpTable', 'GetExtendedUdpTable', 'SetTcpEntry', 'AddVectoredContinueHandler', 'AddVectoredExceptionHandler', 'TerminateThread', 'ExitThread', 'RemoveVectoredExceptionHandler', 'ResumeThread', 'SuspendThread', 'WaitForSingleObject', 'GetThreadId', 'LoadLibraryExA', 'LoadLibraryExW', 'SymInitialize', 'SymFromName', 'SymLoadModuleEx', 'SymSetOptions', 'SymGetTypeInfo', 'DeviceIoControl', 'GetTokenInformation', 'RegOpenKeyExA', 'RegOpenKeyExW', 'RegGetValueA', 'RegGetValueW', 'RegCloseKey', 'Wow64DisableWow64FsRedirection', 'Wow64RevertWow64FsRedirection', 'Wow64EnableWow64FsRedirection', 'Wow64GetThreadContext', 'SetConsoleCtrlHandler', 'WinVerifyTrust', 'GlobalAlloc', 'GlobalFree', 'GlobalUnlock', 'GlobalLock', 'OpenClipboard', 'EmptyClipboard', 'CloseClipboard', 'SetClipboardData', 'GetClipboardData', 'EnumClipboardFormats', 'GetClipboardFormatNameA', 'GetClipboardFormatNameW', 'WinVerifyTrust', 'OpenProcessToken', 'OpenThreadToken', 'GetTokenInformation', 'SetTokenInformation', 'GetSidIdentifierAuthority', 'GetSidSubAuthority', 'GetSidSubAuthorityCount', 'DebugBreak', 'WaitForDebugEvent', 'ContinueDebugEvent', 'DebugActiveProcess', 'DebugActiveProcessStop', 'DebugSetProcessKillOnExit', 'DebugBreakProcess', 'GetProcessId', 'Wow64SetThreadContext', 'GetMappedFileNameW', 'GetMappedFileNameA', 'RtlInitString', 'RtlInitUnicodeString', 'RtlAnsiStringToUnicodeString', 'OpenEventA', 'OpenEventW', 'NtOpenEvent', 'NtAlpcConnectPort', 'NtAlpcSendWaitReceivePort', 'lstrcmpA', 'lstrcmpW', 'CreateFileMappingA', 'CreateFileMappingW', 'MapViewOfFile', 'OpenSCManagerA', 'OpenSCManagerW', 'EnumServicesStatusExA', 'EnumServicesStatusExW', 'EnumWindows', 'GetWindowTextA', 'GetWindowTextW', 'GetWindowModuleFileNameA', 'GetWindowModuleFileNameW', 'CryptCATAdminCalcHashFromFileHandle', 'CryptCATAdminEnumCatalogFromHash', 'CryptCATAdminAcquireContext', 'CryptCATCatalogInfoFromContext', 'CryptCATAdminReleaseCatalogContext', 'CryptCATAdminReleaseContext', 'GetLogicalDriveStringsA', 'GetLogicalDriveStringsW', 'GetVolumeInformationA', 'GetVolumeInformationW', 'GetVolumeNameForVolumeMountPointA', 'GetVolumeNameForVolumeMountPointW', 'GetDriveTypeA', 'GetDriveTypeW', 'QueryDosDeviceA', 'QueryDosDeviceW', 'NtQueryObject', 'DuplicateHandle', 'GetModuleBaseNameA', 'GetModuleBaseNameW', 'GetProcessImageFileNameA', 'GetProcessImageFileNameW', 'GetFileVersionInfoA', 'GetFileVersionInfoW', 'GetFileVersionInfoSizeA', 'GetFileVersionInfoSizeW', 'VerQueryValueA', 'VerQueryValueW', 'GetSystemMetrics', 'GetComputerNameA', 'GetComputerNameW', 'LookupAccountSidA', 'LookupAccountSidW', 'CoInitializeEx', 'CoInitializeSecurity', 'CoCreateInstance'] -# ExitProcess(uExitCode): +#def ExitProcess(uExitCode): +# return ExitProcess.ctypes_function(uExitCode) ExitProcessPrototype = WINFUNCTYPE(VOID, UINT) ExitProcessParams = ((1, 'uExitCode'),) -# TerminateProcess(hProcess, uExitCode): +#def TerminateProcess(hProcess, uExitCode): +# return TerminateProcess.ctypes_function(hProcess, uExitCode) TerminateProcessPrototype = WINFUNCTYPE(BOOL, HANDLE, UINT) TerminateProcessParams = ((1, 'hProcess'), (1, 'uExitCode')) -# GetLastError(): +#def GetLastError(): +# return GetLastError.ctypes_function() GetLastErrorPrototype = WINFUNCTYPE(DWORD) GetLastErrorParams = () -# GetCurrentProcess(): +#def GetCurrentProcess(): +# return GetCurrentProcess.ctypes_function() GetCurrentProcessPrototype = WINFUNCTYPE(HANDLE) GetCurrentProcessParams = () -# CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile): +#def CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile): +# return CreateFileA.ctypes_function(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile) CreateFileAPrototype = WINFUNCTYPE(HANDLE, LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE) CreateFileAParams = ((1, 'lpFileName'), (1, 'dwDesiredAccess'), (1, 'dwShareMode'), (1, 'lpSecurityAttributes'), (1, 'dwCreationDisposition'), (1, 'dwFlagsAndAttributes'), (1, 'hTemplateFile')) -# CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile): +#def CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile): +# return CreateFileW.ctypes_function(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile) CreateFileWPrototype = WINFUNCTYPE(HANDLE, LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE) CreateFileWParams = ((1, 'lpFileName'), (1, 'dwDesiredAccess'), (1, 'dwShareMode'), (1, 'lpSecurityAttributes'), (1, 'dwCreationDisposition'), (1, 'dwFlagsAndAttributes'), (1, 'hTemplateFile')) -# LdrLoadDll(PathToFile, Flags, ModuleFileName, ModuleHandle): +#def LdrLoadDll(PathToFile, Flags, ModuleFileName, ModuleHandle): +# return LdrLoadDll.ctypes_function(PathToFile, Flags, ModuleFileName, ModuleHandle) LdrLoadDllPrototype = WINFUNCTYPE(NTSTATUS, LPCWSTR, ULONG, PUNICODE_STRING, PHANDLE) LdrLoadDllParams = ((1, 'PathToFile'), (1, 'Flags'), (1, 'ModuleFileName'), (1, 'ModuleHandle')) -# NtQuerySystemInformation(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength): +#def NtQuerySystemInformation(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength): +# return NtQuerySystemInformation.ctypes_function(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength) NtQuerySystemInformationPrototype = WINFUNCTYPE(NTSTATUS, SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG) NtQuerySystemInformationParams = ((1, 'SystemInformationClass'), (1, 'SystemInformation'), (1, 'SystemInformationLength'), (1, 'ReturnLength')) -# NtQueryInformationProcess(ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength): +#def NtQueryInformationProcess(ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength): +# return NtQueryInformationProcess.ctypes_function(ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength) NtQueryInformationProcessPrototype = WINFUNCTYPE(NTSTATUS, HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG) NtQueryInformationProcessParams = ((1, 'ProcessHandle'), (1, 'ProcessInformationClass'), (1, 'ProcessInformation'), (1, 'ProcessInformationLength'), (1, 'ReturnLength')) -# NtQueryVirtualMemory(ProcessHandle, BaseAddress, MemoryInformationClass, MemoryInformation, MemoryInformationLength, ReturnLength): +#def NtQueryVirtualMemory(ProcessHandle, BaseAddress, MemoryInformationClass, MemoryInformation, MemoryInformationLength, ReturnLength): +# return NtQueryVirtualMemory.ctypes_function(ProcessHandle, BaseAddress, MemoryInformationClass, MemoryInformation, MemoryInformationLength, ReturnLength) NtQueryVirtualMemoryPrototype = WINFUNCTYPE(NTSTATUS, HANDLE, PVOID, MEMORY_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T) NtQueryVirtualMemoryParams = ((1, 'ProcessHandle'), (1, 'BaseAddress'), (1, 'MemoryInformationClass'), (1, 'MemoryInformation'), (1, 'MemoryInformationLength'), (1, 'ReturnLength')) -# NtCreateThreadEx(ThreadHandle, DesiredAccess, ObjectAttributes, ProcessHandle, lpStartAddress, lpParameter, CreateSuspended, dwStackSize, Unknown1, Unknown2, Unknown3): +#def NtCreateThreadEx(ThreadHandle, DesiredAccess, ObjectAttributes, ProcessHandle, lpStartAddress, lpParameter, CreateSuspended, dwStackSize, Unknown1, Unknown2, Unknown3): +# return NtCreateThreadEx.ctypes_function(ThreadHandle, DesiredAccess, ObjectAttributes, ProcessHandle, lpStartAddress, lpParameter, CreateSuspended, dwStackSize, Unknown1, Unknown2, Unknown3) NtCreateThreadExPrototype = WINFUNCTYPE(NTSTATUS, PHANDLE, ACCESS_MASK, LPVOID, HANDLE, LPTHREAD_START_ROUTINE, LPVOID, BOOL, DWORD, DWORD, DWORD, LPVOID) NtCreateThreadExParams = ((1, 'ThreadHandle'), (1, 'DesiredAccess'), (1, 'ObjectAttributes'), (1, 'ProcessHandle'), (1, 'lpStartAddress'), (1, 'lpParameter'), (1, 'CreateSuspended'), (1, 'dwStackSize'), (1, 'Unknown1'), (1, 'Unknown2'), (1, 'Unknown3')) -# NtQueryInformationThread(ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength, ReturnLength): +#def NtQueryInformationThread(ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength, ReturnLength): +# return NtQueryInformationThread.ctypes_function(ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength, ReturnLength) NtQueryInformationThreadPrototype = WINFUNCTYPE(NTSTATUS, HANDLE, THREAD_INFORMATION_CLASS, PVOID, ULONG, PULONG) NtQueryInformationThreadParams = ((1, 'ThreadHandle'), (1, 'ThreadInformationClass'), (1, 'ThreadInformation'), (1, 'ThreadInformationLength'), (1, 'ReturnLength')) -# GetExitCodeThread(hThread, lpExitCode): +#def GetExitCodeThread(hThread, lpExitCode): +# return GetExitCodeThread.ctypes_function(hThread, lpExitCode) GetExitCodeThreadPrototype = WINFUNCTYPE(BOOL, HANDLE, LPDWORD) GetExitCodeThreadParams = ((1, 'hThread'), (1, 'lpExitCode')) -# GetExitCodeProcess(hProcess, lpExitCode): +#def GetExitCodeProcess(hProcess, lpExitCode): +# return GetExitCodeProcess.ctypes_function(hProcess, lpExitCode) GetExitCodeProcessPrototype = WINFUNCTYPE(BOOL, HANDLE, LPDWORD) GetExitCodeProcessParams = ((1, 'hProcess'), (1, 'lpExitCode')) -# VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect): +#def VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect): +# return VirtualAlloc.ctypes_function(lpAddress, dwSize, flAllocationType, flProtect) VirtualAllocPrototype = WINFUNCTYPE(LPVOID, LPVOID, SIZE_T, DWORD, DWORD) VirtualAllocParams = ((1, 'lpAddress'), (1, 'dwSize'), (1, 'flAllocationType'), (1, 'flProtect')) -# VirtualAllocEx(hProcess, lpAddress, dwSize, flAllocationType, flProtect): +#def VirtualAllocEx(hProcess, lpAddress, dwSize, flAllocationType, flProtect): +# return VirtualAllocEx.ctypes_function(hProcess, lpAddress, dwSize, flAllocationType, flProtect) VirtualAllocExPrototype = WINFUNCTYPE(LPVOID, HANDLE, LPVOID, SIZE_T, DWORD, DWORD) VirtualAllocExParams = ((1, 'hProcess'), (1, 'lpAddress'), (1, 'dwSize'), (1, 'flAllocationType'), (1, 'flProtect')) -# VirtualFree(lpAddress, dwSize, dwFreeType): +#def VirtualFree(lpAddress, dwSize, dwFreeType): +# return VirtualFree.ctypes_function(lpAddress, dwSize, dwFreeType) VirtualFreePrototype = WINFUNCTYPE(BOOL, LPVOID, SIZE_T, DWORD) VirtualFreeParams = ((1, 'lpAddress'), (1, 'dwSize'), (1, 'dwFreeType')) -# VirtualFreeEx(hProcess, lpAddress, dwSize, dwFreeType): +#def VirtualFreeEx(hProcess, lpAddress, dwSize, dwFreeType): +# return VirtualFreeEx.ctypes_function(hProcess, lpAddress, dwSize, dwFreeType) VirtualFreeExPrototype = WINFUNCTYPE(BOOL, HANDLE, LPVOID, SIZE_T, DWORD) VirtualFreeExParams = ((1, 'hProcess'), (1, 'lpAddress'), (1, 'dwSize'), (1, 'dwFreeType')) -# VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect): +#def VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect): +# return VirtualProtect.ctypes_function(lpAddress, dwSize, flNewProtect, lpflOldProtect) VirtualProtectPrototype = WINFUNCTYPE(BOOL, LPVOID, SIZE_T, DWORD, PDWORD) VirtualProtectParams = ((1, 'lpAddress'), (1, 'dwSize'), (1, 'flNewProtect'), (1, 'lpflOldProtect')) -# VirtualQuery(lpAddress, lpBuffer, dwLength): +#def VirtualQuery(lpAddress, lpBuffer, dwLength): +# return VirtualQuery.ctypes_function(lpAddress, lpBuffer, dwLength) VirtualQueryPrototype = WINFUNCTYPE(DWORD, LPCVOID, PMEMORY_BASIC_INFORMATION, DWORD) VirtualQueryParams = ((1, 'lpAddress'), (1, 'lpBuffer'), (1, 'dwLength')) -# VirtualQueryEx(hProcess, lpAddress, lpBuffer, dwLength): +#def VirtualQueryEx(hProcess, lpAddress, lpBuffer, dwLength): +# return VirtualQueryEx.ctypes_function(hProcess, lpAddress, lpBuffer, dwLength) VirtualQueryExPrototype = WINFUNCTYPE(SIZE_T, HANDLE, LPCVOID, PMEMORY_BASIC_INFORMATION, SIZE_T) VirtualQueryExParams = ((1, 'hProcess'), (1, 'lpAddress'), (1, 'lpBuffer'), (1, 'dwLength')) -# GetModuleFileNameA(hModule, lpFilename, nSize): +#def GetModuleFileNameA(hModule, lpFilename, nSize): +# return GetModuleFileNameA.ctypes_function(hModule, lpFilename, nSize) GetModuleFileNameAPrototype = WINFUNCTYPE(DWORD, HMODULE, LPSTR, DWORD) GetModuleFileNameAParams = ((1, 'hModule'), (1, 'lpFilename'), (1, 'nSize')) -# GetModuleFileNameW(hModule, lpFilename, nSize): +#def GetModuleFileNameW(hModule, lpFilename, nSize): +# return GetModuleFileNameW.ctypes_function(hModule, lpFilename, nSize) GetModuleFileNameWPrototype = WINFUNCTYPE(DWORD, HMODULE, LPWSTR, DWORD) GetModuleFileNameWParams = ((1, 'hModule'), (1, 'lpFilename'), (1, 'nSize')) -# CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId): +#def CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId): +# return CreateThread.ctypes_function(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId) CreateThreadPrototype = WINFUNCTYPE(HANDLE, LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD) CreateThreadParams = ((1, 'lpThreadAttributes'), (1, 'dwStackSize'), (1, 'lpStartAddress'), (1, 'lpParameter'), (1, 'dwCreationFlags'), (1, 'lpThreadId')) -# CreateRemoteThread(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId): +#def CreateRemoteThread(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId): +# return CreateRemoteThread.ctypes_function(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId) CreateRemoteThreadPrototype = WINFUNCTYPE(HANDLE, HANDLE, LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD) CreateRemoteThreadParams = ((1, 'hProcess'), (1, 'lpThreadAttributes'), (1, 'dwStackSize'), (1, 'lpStartAddress'), (1, 'lpParameter'), (1, 'dwCreationFlags'), (1, 'lpThreadId')) -# VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect): +#def VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect): +# return VirtualProtect.ctypes_function(lpAddress, dwSize, flNewProtect, lpflOldProtect) VirtualProtectPrototype = WINFUNCTYPE(BOOL, LPVOID, SIZE_T, DWORD, PDWORD) VirtualProtectParams = ((1, 'lpAddress'), (1, 'dwSize'), (1, 'flNewProtect'), (1, 'lpflOldProtect')) -# CreateProcessA(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation): +#def CreateProcessA(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation): +# return CreateProcessA.ctypes_function(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation) CreateProcessAPrototype = WINFUNCTYPE(BOOL, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION) CreateProcessAParams = ((1, 'lpApplicationName'), (1, 'lpCommandLine'), (1, 'lpProcessAttributes'), (1, 'lpThreadAttributes'), (1, 'bInheritHandles'), (1, 'dwCreationFlags'), (1, 'lpEnvironment'), (1, 'lpCurrentDirectory'), (1, 'lpStartupInfo'), (1, 'lpProcessInformation')) -# CreateProcessW(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation): +#def CreateProcessW(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation): +# return CreateProcessW.ctypes_function(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation) CreateProcessWPrototype = WINFUNCTYPE(BOOL, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION) CreateProcessWParams = ((1, 'lpApplicationName'), (1, 'lpCommandLine'), (1, 'lpProcessAttributes'), (1, 'lpThreadAttributes'), (1, 'bInheritHandles'), (1, 'dwCreationFlags'), (1, 'lpEnvironment'), (1, 'lpCurrentDirectory'), (1, 'lpStartupInfo'), (1, 'lpProcessInformation')) -# GetThreadContext(hThread, lpContext): +#def GetThreadContext(hThread, lpContext): +# return GetThreadContext.ctypes_function(hThread, lpContext) GetThreadContextPrototype = WINFUNCTYPE(BOOL, HANDLE, LPCONTEXT) GetThreadContextParams = ((1, 'hThread'), (1, 'lpContext')) -# NtGetContextThread(hThread, lpContext): +#def NtGetContextThread(hThread, lpContext): +# return NtGetContextThread.ctypes_function(hThread, lpContext) NtGetContextThreadPrototype = WINFUNCTYPE(BOOL, HANDLE, LPCONTEXT) NtGetContextThreadParams = ((1, 'hThread'), (1, 'lpContext')) -# SetThreadContext(hThread, lpContext): +#def SetThreadContext(hThread, lpContext): +# return SetThreadContext.ctypes_function(hThread, lpContext) SetThreadContextPrototype = WINFUNCTYPE(BOOL, HANDLE, LPCONTEXT) SetThreadContextParams = ((1, 'hThread'), (1, 'lpContext')) -# NtSetContextThread(hThread, lpContext): +#def NtSetContextThread(hThread, lpContext): +# return NtSetContextThread.ctypes_function(hThread, lpContext) NtSetContextThreadPrototype = WINFUNCTYPE(BOOL, HANDLE, LPCONTEXT) NtSetContextThreadParams = ((1, 'hThread'), (1, 'lpContext')) -# OpenThread(dwDesiredAccess, bInheritHandle, dwThreadId): +#def OpenThread(dwDesiredAccess, bInheritHandle, dwThreadId): +# return OpenThread.ctypes_function(dwDesiredAccess, bInheritHandle, dwThreadId) OpenThreadPrototype = WINFUNCTYPE(HANDLE, DWORD, BOOL, DWORD) OpenThreadParams = ((1, 'dwDesiredAccess'), (1, 'bInheritHandle'), (1, 'dwThreadId')) -# OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId): +#def OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId): +# return OpenProcess.ctypes_function(dwDesiredAccess, bInheritHandle, dwProcessId) OpenProcessPrototype = WINFUNCTYPE(HANDLE, DWORD, BOOL, DWORD) OpenProcessParams = ((1, 'dwDesiredAccess'), (1, 'bInheritHandle'), (1, 'dwProcessId')) -# CloseHandle(hObject): +#def CloseHandle(hObject): +# return CloseHandle.ctypes_function(hObject) CloseHandlePrototype = WINFUNCTYPE(BOOL, HANDLE) CloseHandleParams = ((1, 'hObject'),) -# ReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead): +#def ReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead): +# return ReadProcessMemory.ctypes_function(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead) ReadProcessMemoryPrototype = WINFUNCTYPE(BOOL, HANDLE, LPCVOID, LPVOID, SIZE_T, POINTER(SIZE_T)) ReadProcessMemoryParams = ((1, 'hProcess'), (1, 'lpBaseAddress'), (1, 'lpBuffer'), (1, 'nSize'), (1, 'lpNumberOfBytesRead')) -# NtWow64ReadVirtualMemory64(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead): +#def NtWow64ReadVirtualMemory64(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead): +# return NtWow64ReadVirtualMemory64.ctypes_function(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead) NtWow64ReadVirtualMemory64Prototype = WINFUNCTYPE(BOOL, HANDLE, ULONG64, LPVOID, ULONG64, POINTER(PULONG64)) NtWow64ReadVirtualMemory64Params = ((1, 'hProcess'), (1, 'lpBaseAddress'), (1, 'lpBuffer'), (1, 'nSize'), (1, 'lpNumberOfBytesRead')) -# WriteProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten): +#def WriteProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten): +# return WriteProcessMemory.ctypes_function(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten) WriteProcessMemoryPrototype = WINFUNCTYPE(BOOL, HANDLE, LPVOID, LPCVOID, SIZE_T, POINTER(SIZE_T)) WriteProcessMemoryParams = ((1, 'hProcess'), (1, 'lpBaseAddress'), (1, 'lpBuffer'), (1, 'nSize'), (1, 'lpNumberOfBytesWritten')) -# CreateToolhelp32Snapshot(dwFlags, th32ProcessID): +#def CreateToolhelp32Snapshot(dwFlags, th32ProcessID): +# return CreateToolhelp32Snapshot.ctypes_function(dwFlags, th32ProcessID) CreateToolhelp32SnapshotPrototype = WINFUNCTYPE(HANDLE, DWORD, DWORD) CreateToolhelp32SnapshotParams = ((1, 'dwFlags'), (1, 'th32ProcessID')) -# Thread32First(hSnapshot, lpte): +#def Thread32First(hSnapshot, lpte): +# return Thread32First.ctypes_function(hSnapshot, lpte) Thread32FirstPrototype = WINFUNCTYPE(BOOL, HANDLE, LPTHREADENTRY32) Thread32FirstParams = ((1, 'hSnapshot'), (1, 'lpte')) -# Thread32Next(hSnapshot, lpte): +#def Thread32Next(hSnapshot, lpte): +# return Thread32Next.ctypes_function(hSnapshot, lpte) Thread32NextPrototype = WINFUNCTYPE(BOOL, HANDLE, LPTHREADENTRY32) Thread32NextParams = ((1, 'hSnapshot'), (1, 'lpte')) -# Process32First(hSnapshot, lppe): +#def Process32First(hSnapshot, lppe): +# return Process32First.ctypes_function(hSnapshot, lppe) Process32FirstPrototype = WINFUNCTYPE(BOOL, HANDLE, LPPROCESSENTRY32) Process32FirstParams = ((1, 'hSnapshot'), (1, 'lppe')) -# Process32Next(hSnapshot, lppe): +#def Process32Next(hSnapshot, lppe): +# return Process32Next.ctypes_function(hSnapshot, lppe) Process32NextPrototype = WINFUNCTYPE(BOOL, HANDLE, LPPROCESSENTRY32) Process32NextParams = ((1, 'hSnapshot'), (1, 'lppe')) -# Process32FirstW(hSnapshot, lppe): +#def Process32FirstW(hSnapshot, lppe): +# return Process32FirstW.ctypes_function(hSnapshot, lppe) Process32FirstWPrototype = WINFUNCTYPE(BOOL, HANDLE, LPPROCESSENTRY32W) Process32FirstWParams = ((1, 'hSnapshot'), (1, 'lppe')) -# Process32NextW(hSnapshot, lppe): +#def Process32NextW(hSnapshot, lppe): +# return Process32NextW.ctypes_function(hSnapshot, lppe) Process32NextWPrototype = WINFUNCTYPE(BOOL, HANDLE, LPPROCESSENTRY32W) Process32NextWParams = ((1, 'hSnapshot'), (1, 'lppe')) -# GetProcAddress(hModule, lpProcName): +#def GetProcAddress(hModule, lpProcName): +# return GetProcAddress.ctypes_function(hModule, lpProcName) GetProcAddressPrototype = WINFUNCTYPE(FARPROC, HMODULE, LPCSTR) GetProcAddressParams = ((1, 'hModule'), (1, 'lpProcName')) -# LoadLibraryA(lpFileName): +#def LoadLibraryA(lpFileName): +# return LoadLibraryA.ctypes_function(lpFileName) LoadLibraryAPrototype = WINFUNCTYPE(HMODULE, LPCSTR) LoadLibraryAParams = ((1, 'lpFileName'),) -# LoadLibraryW(lpFileName): +#def LoadLibraryW(lpFileName): +# return LoadLibraryW.ctypes_function(lpFileName) LoadLibraryWPrototype = WINFUNCTYPE(HMODULE, LPCWSTR) LoadLibraryWParams = ((1, 'lpFileName'),) -# OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle): +#def OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle): +# return OpenProcessToken.ctypes_function(ProcessHandle, DesiredAccess, TokenHandle) OpenProcessTokenPrototype = WINFUNCTYPE(BOOL, HANDLE, DWORD, PHANDLE) OpenProcessTokenParams = ((1, 'ProcessHandle'), (1, 'DesiredAccess'), (1, 'TokenHandle')) -# LookupPrivilegeValueA(lpSystemName, lpName, lpLuid): +#def LookupPrivilegeValueA(lpSystemName, lpName, lpLuid): +# return LookupPrivilegeValueA.ctypes_function(lpSystemName, lpName, lpLuid) LookupPrivilegeValueAPrototype = WINFUNCTYPE(BOOL, LPCSTR, LPCSTR, PLUID) LookupPrivilegeValueAParams = ((1, 'lpSystemName'), (1, 'lpName'), (1, 'lpLuid')) -# LookupPrivilegeValueW(lpSystemName, lpName, lpLuid): +#def LookupPrivilegeValueW(lpSystemName, lpName, lpLuid): +# return LookupPrivilegeValueW.ctypes_function(lpSystemName, lpName, lpLuid) LookupPrivilegeValueWPrototype = WINFUNCTYPE(BOOL, LPCWSTR, LPCWSTR, PLUID) LookupPrivilegeValueWParams = ((1, 'lpSystemName'), (1, 'lpName'), (1, 'lpLuid')) -# AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength): +#def AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength): +# return AdjustTokenPrivileges.ctypes_function(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength) AdjustTokenPrivilegesPrototype = WINFUNCTYPE(BOOL, HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD) AdjustTokenPrivilegesParams = ((1, 'TokenHandle'), (1, 'DisableAllPrivileges'), (1, 'NewState'), (1, 'BufferLength'), (1, 'PreviousState'), (1, 'ReturnLength')) -# FindResourceA(hModule, lpName, lpType): +#def FindResourceA(hModule, lpName, lpType): +# return FindResourceA.ctypes_function(hModule, lpName, lpType) FindResourceAPrototype = WINFUNCTYPE(HRSRC, HMODULE, LPCSTR, LPCSTR) FindResourceAParams = ((1, 'hModule'), (1, 'lpName'), (1, 'lpType')) -# FindResourceW(hModule, lpName, lpType): +#def FindResourceW(hModule, lpName, lpType): +# return FindResourceW.ctypes_function(hModule, lpName, lpType) FindResourceWPrototype = WINFUNCTYPE(HRSRC, HMODULE, LPCWSTR, LPCWSTR) FindResourceWParams = ((1, 'hModule'), (1, 'lpName'), (1, 'lpType')) -# SizeofResource(hModule, hResInfo): +#def SizeofResource(hModule, hResInfo): +# return SizeofResource.ctypes_function(hModule, hResInfo) SizeofResourcePrototype = WINFUNCTYPE(DWORD, HMODULE, HRSRC) SizeofResourceParams = ((1, 'hModule'), (1, 'hResInfo')) -# LoadResource(hModule, hResInfo): +#def LoadResource(hModule, hResInfo): +# return LoadResource.ctypes_function(hModule, hResInfo) LoadResourcePrototype = WINFUNCTYPE(HGLOBAL, HMODULE, HRSRC) LoadResourceParams = ((1, 'hModule'), (1, 'hResInfo')) -# LockResource(hResData): +#def LockResource(hResData): +# return LockResource.ctypes_function(hResData) LockResourcePrototype = WINFUNCTYPE(LPVOID, HGLOBAL) LockResourceParams = ((1, 'hResData'),) -# GetVersionExA(lpVersionInformation): +#def GetVersionExA(lpVersionInformation): +# return GetVersionExA.ctypes_function(lpVersionInformation) GetVersionExAPrototype = WINFUNCTYPE(BOOL, LPOSVERSIONINFOA) GetVersionExAParams = ((1, 'lpVersionInformation'),) -# GetVersionExW(lpVersionInformation): +#def GetVersionExW(lpVersionInformation): +# return GetVersionExW.ctypes_function(lpVersionInformation) GetVersionExWPrototype = WINFUNCTYPE(BOOL, LPOSVERSIONINFOW) GetVersionExWParams = ((1, 'lpVersionInformation'),) -# GetVersion(): +#def GetVersion(): +# return GetVersion.ctypes_function() GetVersionPrototype = WINFUNCTYPE(DWORD) GetVersionParams = () -# GetCurrentThread(): +#def GetCurrentThread(): +# return GetCurrentThread.ctypes_function() GetCurrentThreadPrototype = WINFUNCTYPE(HANDLE) GetCurrentThreadParams = () -# GetCurrentThreadId(): +#def GetCurrentThreadId(): +# return GetCurrentThreadId.ctypes_function() GetCurrentThreadIdPrototype = WINFUNCTYPE(DWORD) GetCurrentThreadIdParams = () -# GetCurrentProcessorNumber(): +#def GetCurrentProcessorNumber(): +# return GetCurrentProcessorNumber.ctypes_function() GetCurrentProcessorNumberPrototype = WINFUNCTYPE(DWORD) GetCurrentProcessorNumberParams = () -# AllocConsole(): +#def AllocConsole(): +# return AllocConsole.ctypes_function() AllocConsolePrototype = WINFUNCTYPE(BOOL) AllocConsoleParams = () -# FreeConsole(): +#def FreeConsole(): +# return FreeConsole.ctypes_function() FreeConsolePrototype = WINFUNCTYPE(BOOL) FreeConsoleParams = () -# GetStdHandle(nStdHandle): +#def GetStdHandle(nStdHandle): +# return GetStdHandle.ctypes_function(nStdHandle) GetStdHandlePrototype = WINFUNCTYPE(HANDLE, DWORD) GetStdHandleParams = ((1, 'nStdHandle'),) -# SetStdHandle(nStdHandle, hHandle): +#def SetStdHandle(nStdHandle, hHandle): +# return SetStdHandle.ctypes_function(nStdHandle, hHandle) SetStdHandlePrototype = WINFUNCTYPE(BOOL, DWORD, HANDLE) SetStdHandleParams = ((1, 'nStdHandle'), (1, 'hHandle')) -# SetThreadAffinityMask(hThread, dwThreadAffinityMask): +#def SetThreadAffinityMask(hThread, dwThreadAffinityMask): +# return SetThreadAffinityMask.ctypes_function(hThread, dwThreadAffinityMask) SetThreadAffinityMaskPrototype = WINFUNCTYPE(DWORD, HANDLE, DWORD) SetThreadAffinityMaskParams = ((1, 'hThread'), (1, 'dwThreadAffinityMask')) -# WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped): +#def WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped): +# return WriteFile.ctypes_function(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped) WriteFilePrototype = WINFUNCTYPE(BOOL, HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED) WriteFileParams = ((1, 'hFile'), (1, 'lpBuffer'), (1, 'nNumberOfBytesToWrite'), (1, 'lpNumberOfBytesWritten'), (1, 'lpOverlapped')) -# GetExtendedTcpTable(pTcpTable, pdwSize, bOrder, ulAf, TableClass, Reserved): +#def GetExtendedTcpTable(pTcpTable, pdwSize, bOrder, ulAf, TableClass, Reserved): +# return GetExtendedTcpTable.ctypes_function(pTcpTable, pdwSize, bOrder, ulAf, TableClass, Reserved) GetExtendedTcpTablePrototype = WINFUNCTYPE(DWORD, PVOID, PDWORD, BOOL, ULONG, TCP_TABLE_CLASS, ULONG) GetExtendedTcpTableParams = ((1, 'pTcpTable'), (1, 'pdwSize'), (1, 'bOrder'), (1, 'ulAf'), (1, 'TableClass'), (1, 'Reserved')) -# GetExtendedUdpTable(pUdpTable, pdwSize, bOrder, ulAf, TableClass, Reserved): +#def GetExtendedUdpTable(pUdpTable, pdwSize, bOrder, ulAf, TableClass, Reserved): +# return GetExtendedUdpTable.ctypes_function(pUdpTable, pdwSize, bOrder, ulAf, TableClass, Reserved) GetExtendedUdpTablePrototype = WINFUNCTYPE(DWORD, PVOID, PDWORD, BOOL, ULONG, UDP_TABLE_CLASS, ULONG) GetExtendedUdpTableParams = ((1, 'pUdpTable'), (1, 'pdwSize'), (1, 'bOrder'), (1, 'ulAf'), (1, 'TableClass'), (1, 'Reserved')) -# SetTcpEntry(pTcpRow): +#def SetTcpEntry(pTcpRow): +# return SetTcpEntry.ctypes_function(pTcpRow) SetTcpEntryPrototype = WINFUNCTYPE(DWORD, PMIB_TCPROW) SetTcpEntryParams = ((1, 'pTcpRow'),) -# AddVectoredContinueHandler(FirstHandler, VectoredHandler): +#def AddVectoredContinueHandler(FirstHandler, VectoredHandler): +# return AddVectoredContinueHandler.ctypes_function(FirstHandler, VectoredHandler) AddVectoredContinueHandlerPrototype = WINFUNCTYPE(PVOID, ULONG, PVECTORED_EXCEPTION_HANDLER) AddVectoredContinueHandlerParams = ((1, 'FirstHandler'), (1, 'VectoredHandler')) -# AddVectoredExceptionHandler(FirstHandler, VectoredHandler): +#def AddVectoredExceptionHandler(FirstHandler, VectoredHandler): +# return AddVectoredExceptionHandler.ctypes_function(FirstHandler, VectoredHandler) AddVectoredExceptionHandlerPrototype = WINFUNCTYPE(PVOID, ULONG, PVECTORED_EXCEPTION_HANDLER) AddVectoredExceptionHandlerParams = ((1, 'FirstHandler'), (1, 'VectoredHandler')) -# TerminateThread(hThread, dwExitCode): +#def TerminateThread(hThread, dwExitCode): +# return TerminateThread.ctypes_function(hThread, dwExitCode) TerminateThreadPrototype = WINFUNCTYPE(BOOL, HANDLE, DWORD) TerminateThreadParams = ((1, 'hThread'), (1, 'dwExitCode')) -# ExitThread(dwExitCode): +#def ExitThread(dwExitCode): +# return ExitThread.ctypes_function(dwExitCode) ExitThreadPrototype = WINFUNCTYPE(VOID, DWORD) ExitThreadParams = ((1, 'dwExitCode'),) -# RemoveVectoredExceptionHandler(Handler): +#def RemoveVectoredExceptionHandler(Handler): +# return RemoveVectoredExceptionHandler.ctypes_function(Handler) RemoveVectoredExceptionHandlerPrototype = WINFUNCTYPE(ULONG, PVOID) RemoveVectoredExceptionHandlerParams = ((1, 'Handler'),) -# ResumeThread(hThread): +#def ResumeThread(hThread): +# return ResumeThread.ctypes_function(hThread) ResumeThreadPrototype = WINFUNCTYPE(DWORD, HANDLE) ResumeThreadParams = ((1, 'hThread'),) -# SuspendThread(hThread): +#def SuspendThread(hThread): +# return SuspendThread.ctypes_function(hThread) SuspendThreadPrototype = WINFUNCTYPE(DWORD, HANDLE) SuspendThreadParams = ((1, 'hThread'),) -# WaitForSingleObject(hHandle, dwMilliseconds): +#def WaitForSingleObject(hHandle, dwMilliseconds): +# return WaitForSingleObject.ctypes_function(hHandle, dwMilliseconds) WaitForSingleObjectPrototype = WINFUNCTYPE(DWORD, HANDLE, DWORD) WaitForSingleObjectParams = ((1, 'hHandle'), (1, 'dwMilliseconds')) -# GetThreadId(Thread): +#def GetThreadId(Thread): +# return GetThreadId.ctypes_function(Thread) GetThreadIdPrototype = WINFUNCTYPE(DWORD, HANDLE) GetThreadIdParams = ((1, 'Thread'),) -# LoadLibraryExA(lpFileName, hFile, dwFlags): +#def LoadLibraryExA(lpFileName, hFile, dwFlags): +# return LoadLibraryExA.ctypes_function(lpFileName, hFile, dwFlags) LoadLibraryExAPrototype = WINFUNCTYPE(HMODULE, LPCSTR, HANDLE, DWORD) LoadLibraryExAParams = ((1, 'lpFileName'), (1, 'hFile'), (1, 'dwFlags')) -# LoadLibraryExW(lpFileName, hFile, dwFlags): +#def LoadLibraryExW(lpFileName, hFile, dwFlags): +# return LoadLibraryExW.ctypes_function(lpFileName, hFile, dwFlags) LoadLibraryExWPrototype = WINFUNCTYPE(HMODULE, LPCWSTR, HANDLE, DWORD) LoadLibraryExWParams = ((1, 'lpFileName'), (1, 'hFile'), (1, 'dwFlags')) -# SymInitialize(hProcess, UserSearchPath, fInvadeProcess): +#def SymInitialize(hProcess, UserSearchPath, fInvadeProcess): +# return SymInitialize.ctypes_function(hProcess, UserSearchPath, fInvadeProcess) SymInitializePrototype = WINFUNCTYPE(BOOL, HANDLE, LPCSTR, BOOL) SymInitializeParams = ((1, 'hProcess'), (1, 'UserSearchPath'), (1, 'fInvadeProcess')) -# SymFromName(hProcess, Name, Symbol): +#def SymFromName(hProcess, Name, Symbol): +# return SymFromName.ctypes_function(hProcess, Name, Symbol) SymFromNamePrototype = WINFUNCTYPE(BOOL, HANDLE, LPCSTR, PSYMBOL_INFO) SymFromNameParams = ((1, 'hProcess'), (1, 'Name'), (1, 'Symbol')) -# SymLoadModuleEx(hProcess, hFile, ImageName, ModuleName, BaseOfDll, DllSize, Data, Flags): +#def SymLoadModuleEx(hProcess, hFile, ImageName, ModuleName, BaseOfDll, DllSize, Data, Flags): +# return SymLoadModuleEx.ctypes_function(hProcess, hFile, ImageName, ModuleName, BaseOfDll, DllSize, Data, Flags) SymLoadModuleExPrototype = WINFUNCTYPE(DWORD64, HANDLE, HANDLE, LPCSTR, LPCSTR, DWORD64, DWORD, PMODLOAD_DATA, DWORD) SymLoadModuleExParams = ((1, 'hProcess'), (1, 'hFile'), (1, 'ImageName'), (1, 'ModuleName'), (1, 'BaseOfDll'), (1, 'DllSize'), (1, 'Data'), (1, 'Flags')) -# SymSetOptions(SymOptions): +#def SymSetOptions(SymOptions): +# return SymSetOptions.ctypes_function(SymOptions) SymSetOptionsPrototype = WINFUNCTYPE(DWORD, DWORD) SymSetOptionsParams = ((1, 'SymOptions'),) -# SymGetTypeInfo(hProcess, ModBase, TypeId, GetType, pInfo): +#def SymGetTypeInfo(hProcess, ModBase, TypeId, GetType, pInfo): +# return SymGetTypeInfo.ctypes_function(hProcess, ModBase, TypeId, GetType, pInfo) SymGetTypeInfoPrototype = WINFUNCTYPE(BOOL, HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID) SymGetTypeInfoParams = ((1, 'hProcess'), (1, 'ModBase'), (1, 'TypeId'), (1, 'GetType'), (1, 'pInfo')) -# DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped): +#def DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped): +# return DeviceIoControl.ctypes_function(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped) DeviceIoControlPrototype = WINFUNCTYPE(BOOL, HANDLE, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPOVERLAPPED) DeviceIoControlParams = ((1, 'hDevice'), (1, 'dwIoControlCode'), (1, 'lpInBuffer'), (1, 'nInBufferSize'), (1, 'lpOutBuffer'), (1, 'nOutBufferSize'), (1, 'lpBytesReturned'), (1, 'lpOverlapped')) -# GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength): +#def GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength): +# return GetTokenInformation.ctypes_function(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength) GetTokenInformationPrototype = WINFUNCTYPE(BOOL, HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD) GetTokenInformationParams = ((1, 'TokenHandle'), (1, 'TokenInformationClass'), (1, 'TokenInformation'), (1, 'TokenInformationLength'), (1, 'ReturnLength')) -# RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult): +#def RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult): +# return RegOpenKeyExA.ctypes_function(hKey, lpSubKey, ulOptions, samDesired, phkResult) RegOpenKeyExAPrototype = WINFUNCTYPE(LONG, HKEY, LPCSTR, DWORD, REGSAM, PHKEY) RegOpenKeyExAParams = ((1, 'hKey'), (1, 'lpSubKey'), (1, 'ulOptions'), (1, 'samDesired'), (1, 'phkResult')) -# RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult): +#def RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult): +# return RegOpenKeyExW.ctypes_function(hKey, lpSubKey, ulOptions, samDesired, phkResult) RegOpenKeyExWPrototype = WINFUNCTYPE(LONG, HKEY, LPWSTR, DWORD, REGSAM, PHKEY) RegOpenKeyExWParams = ((1, 'hKey'), (1, 'lpSubKey'), (1, 'ulOptions'), (1, 'samDesired'), (1, 'phkResult')) -# RegGetValueA(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData): +#def RegGetValueA(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData): +# return RegGetValueA.ctypes_function(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData) RegGetValueAPrototype = WINFUNCTYPE(LONG, HKEY, LPCSTR, LPCSTR, DWORD, LPDWORD, PVOID, LPDWORD) RegGetValueAParams = ((1, 'hkey'), (1, 'lpSubKey'), (1, 'lpValue'), (1, 'dwFlags'), (1, 'pdwType'), (1, 'pvData'), (1, 'pcbData')) -# RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData): +#def RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData): +# return RegGetValueW.ctypes_function(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData) RegGetValueWPrototype = WINFUNCTYPE(LONG, HKEY, LPWSTR, LPWSTR, DWORD, LPDWORD, PVOID, LPDWORD) RegGetValueWParams = ((1, 'hkey'), (1, 'lpSubKey'), (1, 'lpValue'), (1, 'dwFlags'), (1, 'pdwType'), (1, 'pvData'), (1, 'pcbData')) -# RegCloseKey(hKey): +#def RegCloseKey(hKey): +# return RegCloseKey.ctypes_function(hKey) RegCloseKeyPrototype = WINFUNCTYPE(LONG, HKEY) RegCloseKeyParams = ((1, 'hKey'),) -# Wow64DisableWow64FsRedirection(OldValue): +#def Wow64DisableWow64FsRedirection(OldValue): +# return Wow64DisableWow64FsRedirection.ctypes_function(OldValue) Wow64DisableWow64FsRedirectionPrototype = WINFUNCTYPE(BOOL, POINTER(PVOID)) Wow64DisableWow64FsRedirectionParams = ((1, 'OldValue'),) -# Wow64RevertWow64FsRedirection(OldValue): +#def Wow64RevertWow64FsRedirection(OldValue): +# return Wow64RevertWow64FsRedirection.ctypes_function(OldValue) Wow64RevertWow64FsRedirectionPrototype = WINFUNCTYPE(BOOL, PVOID) Wow64RevertWow64FsRedirectionParams = ((1, 'OldValue'),) -# Wow64EnableWow64FsRedirection(Wow64FsEnableRedirection): +#def Wow64EnableWow64FsRedirection(Wow64FsEnableRedirection): +# return Wow64EnableWow64FsRedirection.ctypes_function(Wow64FsEnableRedirection) Wow64EnableWow64FsRedirectionPrototype = WINFUNCTYPE(BOOLEAN, BOOLEAN) Wow64EnableWow64FsRedirectionParams = ((1, 'Wow64FsEnableRedirection'),) -# Wow64GetThreadContext(hThread, lpContext): +#def Wow64GetThreadContext(hThread, lpContext): +# return Wow64GetThreadContext.ctypes_function(hThread, lpContext) Wow64GetThreadContextPrototype = WINFUNCTYPE(BOOL, HANDLE, PWOW64_CONTEXT) Wow64GetThreadContextParams = ((1, 'hThread'), (1, 'lpContext')) -# SetConsoleCtrlHandler(HandlerRoutine, Add): +#def SetConsoleCtrlHandler(HandlerRoutine, Add): +# return SetConsoleCtrlHandler.ctypes_function(HandlerRoutine, Add) SetConsoleCtrlHandlerPrototype = WINFUNCTYPE(BOOL, PHANDLER_ROUTINE, BOOL) SetConsoleCtrlHandlerParams = ((1, 'HandlerRoutine'), (1, 'Add')) -# WinVerifyTrust(hwnd, pgActionID, pWVTData): +#def WinVerifyTrust(hwnd, pgActionID, pWVTData): +# return WinVerifyTrust.ctypes_function(hwnd, pgActionID, pWVTData) WinVerifyTrustPrototype = WINFUNCTYPE(LONG, HWND, POINTER(GUID), LPVOID) WinVerifyTrustParams = ((1, 'hwnd'), (1, 'pgActionID'), (1, 'pWVTData')) -# GlobalAlloc(uFlags, dwBytes): +#def GlobalAlloc(uFlags, dwBytes): +# return GlobalAlloc.ctypes_function(uFlags, dwBytes) GlobalAllocPrototype = WINFUNCTYPE(HGLOBAL, UINT, SIZE_T) GlobalAllocParams = ((1, 'uFlags'), (1, 'dwBytes')) -# GlobalFree(hMem): +#def GlobalFree(hMem): +# return GlobalFree.ctypes_function(hMem) GlobalFreePrototype = WINFUNCTYPE(HGLOBAL, HGLOBAL) GlobalFreeParams = ((1, 'hMem'),) -# GlobalUnlock(hMem): +#def GlobalUnlock(hMem): +# return GlobalUnlock.ctypes_function(hMem) GlobalUnlockPrototype = WINFUNCTYPE(BOOL, HGLOBAL) GlobalUnlockParams = ((1, 'hMem'),) -# GlobalLock(hMem): +#def GlobalLock(hMem): +# return GlobalLock.ctypes_function(hMem) GlobalLockPrototype = WINFUNCTYPE(LPVOID, HGLOBAL) GlobalLockParams = ((1, 'hMem'),) -# OpenClipboard(hWndNewOwner): +#def OpenClipboard(hWndNewOwner): +# return OpenClipboard.ctypes_function(hWndNewOwner) OpenClipboardPrototype = WINFUNCTYPE(BOOL, HWND) OpenClipboardParams = ((1, 'hWndNewOwner'),) -# EmptyClipboard(): +#def EmptyClipboard(): +# return EmptyClipboard.ctypes_function() EmptyClipboardPrototype = WINFUNCTYPE(BOOL) EmptyClipboardParams = () -# CloseClipboard(): +#def CloseClipboard(): +# return CloseClipboard.ctypes_function() CloseClipboardPrototype = WINFUNCTYPE(BOOL) CloseClipboardParams = () -# SetClipboardData(uFormat, hMem): +#def SetClipboardData(uFormat, hMem): +# return SetClipboardData.ctypes_function(uFormat, hMem) SetClipboardDataPrototype = WINFUNCTYPE(HANDLE, UINT, HANDLE) SetClipboardDataParams = ((1, 'uFormat'), (1, 'hMem')) -# GetClipboardData(uFormat): +#def GetClipboardData(uFormat): +# return GetClipboardData.ctypes_function(uFormat) GetClipboardDataPrototype = WINFUNCTYPE(HANDLE, UINT) GetClipboardDataParams = ((1, 'uFormat'),) -# EnumClipboardFormats(format): +#def EnumClipboardFormats(format): +# return EnumClipboardFormats.ctypes_function(format) EnumClipboardFormatsPrototype = WINFUNCTYPE(UINT, UINT) EnumClipboardFormatsParams = ((1, 'format'),) -# GetClipboardFormatNameA(format, lpszFormatName, cchMaxCount): +#def GetClipboardFormatNameA(format, lpszFormatName, cchMaxCount): +# return GetClipboardFormatNameA.ctypes_function(format, lpszFormatName, cchMaxCount) GetClipboardFormatNameAPrototype = WINFUNCTYPE(INT, UINT, LPCSTR, INT) GetClipboardFormatNameAParams = ((1, 'format'), (1, 'lpszFormatName'), (1, 'cchMaxCount')) -# GetClipboardFormatNameW(format, lpszFormatName, cchMaxCount): +#def GetClipboardFormatNameW(format, lpszFormatName, cchMaxCount): +# return GetClipboardFormatNameW.ctypes_function(format, lpszFormatName, cchMaxCount) GetClipboardFormatNameWPrototype = WINFUNCTYPE(INT, UINT, LPCWSTR, INT) GetClipboardFormatNameWParams = ((1, 'format'), (1, 'lpszFormatName'), (1, 'cchMaxCount')) -# WinVerifyTrust(hWnd, pgActionID, pWVTData): +#def WinVerifyTrust(hWnd, pgActionID, pWVTData): +# return WinVerifyTrust.ctypes_function(hWnd, pgActionID, pWVTData) WinVerifyTrustPrototype = WINFUNCTYPE(LONG, HWND, POINTER(GUID), LPVOID) WinVerifyTrustParams = ((1, 'hWnd'), (1, 'pgActionID'), (1, 'pWVTData')) -# OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle): +#def OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle): +# return OpenProcessToken.ctypes_function(ProcessHandle, DesiredAccess, TokenHandle) OpenProcessTokenPrototype = WINFUNCTYPE(BOOL, HANDLE, DWORD, PHANDLE) OpenProcessTokenParams = ((1, 'ProcessHandle'), (1, 'DesiredAccess'), (1, 'TokenHandle')) -# OpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle): +#def OpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle): +# return OpenThreadToken.ctypes_function(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle) OpenThreadTokenPrototype = WINFUNCTYPE(BOOL, HANDLE, DWORD, BOOL, PHANDLE) OpenThreadTokenParams = ((1, 'ThreadHandle'), (1, 'DesiredAccess'), (1, 'OpenAsSelf'), (1, 'TokenHandle')) -# GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength): +#def GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength): +# return GetTokenInformation.ctypes_function(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength) GetTokenInformationPrototype = WINFUNCTYPE(BOOL, HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD) GetTokenInformationParams = ((1, 'TokenHandle'), (1, 'TokenInformationClass'), (1, 'TokenInformation'), (1, 'TokenInformationLength'), (1, 'ReturnLength')) -# SetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength): +#def SetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength): +# return SetTokenInformation.ctypes_function(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength) SetTokenInformationPrototype = WINFUNCTYPE(BOOL, HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD) SetTokenInformationParams = ((1, 'TokenHandle'), (1, 'TokenInformationClass'), (1, 'TokenInformation'), (1, 'TokenInformationLength')) -# GetSidIdentifierAuthority(pSid): +#def GetSidIdentifierAuthority(pSid): +# return GetSidIdentifierAuthority.ctypes_function(pSid) GetSidIdentifierAuthorityPrototype = WINFUNCTYPE(PSID_IDENTIFIER_AUTHORITY, PSID) GetSidIdentifierAuthorityParams = ((1, 'pSid'),) -# GetSidSubAuthority(pSid, nSubAuthority): +#def GetSidSubAuthority(pSid, nSubAuthority): +# return GetSidSubAuthority.ctypes_function(pSid, nSubAuthority) GetSidSubAuthorityPrototype = WINFUNCTYPE(PDWORD, PSID, DWORD) GetSidSubAuthorityParams = ((1, 'pSid'), (1, 'nSubAuthority')) -# GetSidSubAuthorityCount(pSid): +#def GetSidSubAuthorityCount(pSid): +# return GetSidSubAuthorityCount.ctypes_function(pSid) GetSidSubAuthorityCountPrototype = WINFUNCTYPE(PUCHAR, PSID) GetSidSubAuthorityCountParams = ((1, 'pSid'),) -# DebugBreak(): +#def DebugBreak(): +# return DebugBreak.ctypes_function() DebugBreakPrototype = WINFUNCTYPE(VOID) DebugBreakParams = () -# WaitForDebugEvent(lpDebugEvent, dwMilliseconds): +#def WaitForDebugEvent(lpDebugEvent, dwMilliseconds): +# return WaitForDebugEvent.ctypes_function(lpDebugEvent, dwMilliseconds) WaitForDebugEventPrototype = WINFUNCTYPE(BOOL, LPDEBUG_EVENT, DWORD) WaitForDebugEventParams = ((1, 'lpDebugEvent'), (1, 'dwMilliseconds')) -# ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus): +#def ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus): +# return ContinueDebugEvent.ctypes_function(dwProcessId, dwThreadId, dwContinueStatus) ContinueDebugEventPrototype = WINFUNCTYPE(BOOL, DWORD, DWORD, DWORD) ContinueDebugEventParams = ((1, 'dwProcessId'), (1, 'dwThreadId'), (1, 'dwContinueStatus')) -# DebugActiveProcess(dwProcessId): +#def DebugActiveProcess(dwProcessId): +# return DebugActiveProcess.ctypes_function(dwProcessId) DebugActiveProcessPrototype = WINFUNCTYPE(BOOL, DWORD) DebugActiveProcessParams = ((1, 'dwProcessId'),) -# DebugActiveProcessStop(dwProcessId): +#def DebugActiveProcessStop(dwProcessId): +# return DebugActiveProcessStop.ctypes_function(dwProcessId) DebugActiveProcessStopPrototype = WINFUNCTYPE(BOOL, DWORD) DebugActiveProcessStopParams = ((1, 'dwProcessId'),) -# DebugSetProcessKillOnExit(KillOnExit): +#def DebugSetProcessKillOnExit(KillOnExit): +# return DebugSetProcessKillOnExit.ctypes_function(KillOnExit) DebugSetProcessKillOnExitPrototype = WINFUNCTYPE(BOOL, BOOL) DebugSetProcessKillOnExitParams = ((1, 'KillOnExit'),) -# DebugBreakProcess(Process): +#def DebugBreakProcess(Process): +# return DebugBreakProcess.ctypes_function(Process) DebugBreakProcessPrototype = WINFUNCTYPE(BOOL, HANDLE) DebugBreakProcessParams = ((1, 'Process'),) -# GetProcessId(Process): +#def GetProcessId(Process): +# return GetProcessId.ctypes_function(Process) GetProcessIdPrototype = WINFUNCTYPE(DWORD, HANDLE) GetProcessIdParams = ((1, 'Process'),) -# Wow64SetThreadContext(hThread, lpContext): +#def Wow64SetThreadContext(hThread, lpContext): +# return Wow64SetThreadContext.ctypes_function(hThread, lpContext) Wow64SetThreadContextPrototype = WINFUNCTYPE(BOOL, HANDLE, POINTER(WOW64_CONTEXT)) Wow64SetThreadContextParams = ((1, 'hThread'), (1, 'lpContext')) -# GetMappedFileNameW(hProcess, lpv, lpFilename, nSize): +#def GetMappedFileNameW(hProcess, lpv, lpFilename, nSize): +# return GetMappedFileNameW.ctypes_function(hProcess, lpv, lpFilename, nSize) GetMappedFileNameWPrototype = WINFUNCTYPE(DWORD, HANDLE, LPVOID, PVOID, DWORD) GetMappedFileNameWParams = ((1, 'hProcess'), (1, 'lpv'), (1, 'lpFilename'), (1, 'nSize')) -# GetMappedFileNameA(hProcess, lpv, lpFilename, nSize): +#def GetMappedFileNameA(hProcess, lpv, lpFilename, nSize): +# return GetMappedFileNameA.ctypes_function(hProcess, lpv, lpFilename, nSize) GetMappedFileNameAPrototype = WINFUNCTYPE(DWORD, HANDLE, LPVOID, PVOID, DWORD) GetMappedFileNameAParams = ((1, 'hProcess'), (1, 'lpv'), (1, 'lpFilename'), (1, 'nSize')) -# RtlInitString(DestinationString, SourceString): +#def RtlInitString(DestinationString, SourceString): +# return RtlInitString.ctypes_function(DestinationString, SourceString) RtlInitStringPrototype = WINFUNCTYPE(VOID, PSTRING, LPCSTR) RtlInitStringParams = ((1, 'DestinationString'), (1, 'SourceString')) -# RtlInitUnicodeString(DestinationString, SourceString): +#def RtlInitUnicodeString(DestinationString, SourceString): +# return RtlInitUnicodeString.ctypes_function(DestinationString, SourceString) RtlInitUnicodeStringPrototype = WINFUNCTYPE(VOID, PUNICODE_STRING, LPCWSTR) RtlInitUnicodeStringParams = ((1, 'DestinationString'), (1, 'SourceString')) -# RtlAnsiStringToUnicodeString(DestinationString, SourceString, AllocateDestinationString): +#def RtlAnsiStringToUnicodeString(DestinationString, SourceString, AllocateDestinationString): +# return RtlAnsiStringToUnicodeString.ctypes_function(DestinationString, SourceString, AllocateDestinationString) RtlAnsiStringToUnicodeStringPrototype = WINFUNCTYPE(NTSTATUS, PUNICODE_STRING, PCANSI_STRING, BOOLEAN) RtlAnsiStringToUnicodeStringParams = ((1, 'DestinationString'), (1, 'SourceString'), (1, 'AllocateDestinationString')) -# OpenEventA(dwDesiredAccess, bInheritHandle, lpName): +#def OpenEventA(dwDesiredAccess, bInheritHandle, lpName): +# return OpenEventA.ctypes_function(dwDesiredAccess, bInheritHandle, lpName) OpenEventAPrototype = WINFUNCTYPE(HANDLE, DWORD, BOOL, LPCSTR) OpenEventAParams = ((1, 'dwDesiredAccess'), (1, 'bInheritHandle'), (1, 'lpName')) -# OpenEventW(dwDesiredAccess, bInheritHandle, lpName): +#def OpenEventW(dwDesiredAccess, bInheritHandle, lpName): +# return OpenEventW.ctypes_function(dwDesiredAccess, bInheritHandle, lpName) OpenEventWPrototype = WINFUNCTYPE(HANDLE, DWORD, BOOL, LPCWSTR) OpenEventWParams = ((1, 'dwDesiredAccess'), (1, 'bInheritHandle'), (1, 'lpName')) -# NtOpenEvent(EventHandle, DesiredAccess, ObjectAttributes): +#def NtOpenEvent(EventHandle, DesiredAccess, ObjectAttributes): +# return NtOpenEvent.ctypes_function(EventHandle, DesiredAccess, ObjectAttributes) NtOpenEventPrototype = WINFUNCTYPE(NTSTATUS, PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES) NtOpenEventParams = ((1, 'EventHandle'), (1, 'DesiredAccess'), (1, 'ObjectAttributes')) -# NtAlpcConnectPort(PortHandle, PortName, ObjectAttributes, PortAttributes, Flags, RequiredServerSid, ConnectionMessage, BufferLength, OutMessageAttributes, InMessageAttributes, Timeout): +#def NtAlpcConnectPort(PortHandle, PortName, ObjectAttributes, PortAttributes, Flags, RequiredServerSid, ConnectionMessage, BufferLength, OutMessageAttributes, InMessageAttributes, Timeout): +# return NtAlpcConnectPort.ctypes_function(PortHandle, PortName, ObjectAttributes, PortAttributes, Flags, RequiredServerSid, ConnectionMessage, BufferLength, OutMessageAttributes, InMessageAttributes, Timeout) NtAlpcConnectPortPrototype = WINFUNCTYPE(NTSTATUS, PHANDLE, PUNICODE_STRING, POBJECT_ATTRIBUTES, PALPC_PORT_ATTRIBUTES, ULONG, PSID, PPORT_MESSAGE, PULONG, PALPC_MESSAGE_ATTRIBUTES, PALPC_MESSAGE_ATTRIBUTES, PLARGE_INTEGER) NtAlpcConnectPortParams = ((1, 'PortHandle'), (1, 'PortName'), (1, 'ObjectAttributes'), (1, 'PortAttributes'), (1, 'Flags'), (1, 'RequiredServerSid'), (1, 'ConnectionMessage'), (1, 'BufferLength'), (1, 'OutMessageAttributes'), (1, 'InMessageAttributes'), (1, 'Timeout')) -# NtAlpcSendWaitReceivePort(PortHandle, Flags, SendMessage, SendMessageAttributes, ReceiveMessage, BufferLength, ReceiveMessageAttributes, Timeout): +#def NtAlpcSendWaitReceivePort(PortHandle, Flags, SendMessage, SendMessageAttributes, ReceiveMessage, BufferLength, ReceiveMessageAttributes, Timeout): +# return NtAlpcSendWaitReceivePort.ctypes_function(PortHandle, Flags, SendMessage, SendMessageAttributes, ReceiveMessage, BufferLength, ReceiveMessageAttributes, Timeout) NtAlpcSendWaitReceivePortPrototype = WINFUNCTYPE(NTSTATUS, HANDLE, ULONG, PPORT_MESSAGE, PALPC_MESSAGE_ATTRIBUTES, PPORT_MESSAGE, PSIZE_T, PALPC_MESSAGE_ATTRIBUTES, PLARGE_INTEGER) NtAlpcSendWaitReceivePortParams = ((1, 'PortHandle'), (1, 'Flags'), (1, 'SendMessage'), (1, 'SendMessageAttributes'), (1, 'ReceiveMessage'), (1, 'BufferLength'), (1, 'ReceiveMessageAttributes'), (1, 'Timeout')) -# lstrcmpA(lpString1, lpString2): +#def lstrcmpA(lpString1, lpString2): +# return lstrcmpA.ctypes_function(lpString1, lpString2) lstrcmpAPrototype = WINFUNCTYPE(INT, LPCSTR, LPCSTR) lstrcmpAParams = ((1, 'lpString1'), (1, 'lpString2')) -# lstrcmpW(lpString1, lpString2): +#def lstrcmpW(lpString1, lpString2): +# return lstrcmpW.ctypes_function(lpString1, lpString2) lstrcmpWPrototype = WINFUNCTYPE(INT, LPCWSTR, LPCWSTR) lstrcmpWParams = ((1, 'lpString1'), (1, 'lpString2')) -# CreateFileMappingA(hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName): +#def CreateFileMappingA(hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName): +# return CreateFileMappingA.ctypes_function(hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName) CreateFileMappingAPrototype = WINFUNCTYPE(HANDLE, HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCSTR) CreateFileMappingAParams = ((1, 'hFile'), (1, 'lpFileMappingAttributes'), (1, 'flProtect'), (1, 'dwMaximumSizeHigh'), (1, 'dwMaximumSizeLow'), (1, 'lpName')) -# CreateFileMappingW(hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName): +#def CreateFileMappingW(hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName): +# return CreateFileMappingW.ctypes_function(hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName) CreateFileMappingWPrototype = WINFUNCTYPE(HANDLE, HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCWSTR) CreateFileMappingWParams = ((1, 'hFile'), (1, 'lpFileMappingAttributes'), (1, 'flProtect'), (1, 'dwMaximumSizeHigh'), (1, 'dwMaximumSizeLow'), (1, 'lpName')) -# MapViewOfFile(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap): +#def MapViewOfFile(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap): +# return MapViewOfFile.ctypes_function(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap) MapViewOfFilePrototype = WINFUNCTYPE(LPVOID, HANDLE, DWORD, DWORD, DWORD, SIZE_T) MapViewOfFileParams = ((1, 'hFileMappingObject'), (1, 'dwDesiredAccess'), (1, 'dwFileOffsetHigh'), (1, 'dwFileOffsetLow'), (1, 'dwNumberOfBytesToMap')) -# OpenSCManagerA(lpMachineName, lpDatabaseName, dwDesiredAccess): +#def OpenSCManagerA(lpMachineName, lpDatabaseName, dwDesiredAccess): +# return OpenSCManagerA.ctypes_function(lpMachineName, lpDatabaseName, dwDesiredAccess) OpenSCManagerAPrototype = WINFUNCTYPE(SC_HANDLE, LPCSTR, LPCSTR, DWORD) OpenSCManagerAParams = ((1, 'lpMachineName'), (1, 'lpDatabaseName'), (1, 'dwDesiredAccess')) -# OpenSCManagerW(lpMachineName, lpDatabaseName, dwDesiredAccess): +#def OpenSCManagerW(lpMachineName, lpDatabaseName, dwDesiredAccess): +# return OpenSCManagerW.ctypes_function(lpMachineName, lpDatabaseName, dwDesiredAccess) OpenSCManagerWPrototype = WINFUNCTYPE(SC_HANDLE, LPCWSTR, LPCWSTR, DWORD) OpenSCManagerWParams = ((1, 'lpMachineName'), (1, 'lpDatabaseName'), (1, 'dwDesiredAccess')) -# EnumServicesStatusExA(hSCManager, InfoLevel, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, pszGroupName): +#def EnumServicesStatusExA(hSCManager, InfoLevel, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, pszGroupName): +# return EnumServicesStatusExA.ctypes_function(hSCManager, InfoLevel, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, pszGroupName) EnumServicesStatusExAPrototype = WINFUNCTYPE(BOOL, SC_HANDLE, SC_ENUM_TYPE, DWORD, DWORD, LPBYTE, DWORD, LPDWORD, LPDWORD, LPDWORD, LPCSTR) EnumServicesStatusExAParams = ((1, 'hSCManager'), (1, 'InfoLevel'), (1, 'dwServiceType'), (1, 'dwServiceState'), (1, 'lpServices'), (1, 'cbBufSize'), (1, 'pcbBytesNeeded'), (1, 'lpServicesReturned'), (1, 'lpResumeHandle'), (1, 'pszGroupName')) -# EnumServicesStatusExW(hSCManager, InfoLevel, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, pszGroupName): +#def EnumServicesStatusExW(hSCManager, InfoLevel, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, pszGroupName): +# return EnumServicesStatusExW.ctypes_function(hSCManager, InfoLevel, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, pszGroupName) EnumServicesStatusExWPrototype = WINFUNCTYPE(BOOL, SC_HANDLE, SC_ENUM_TYPE, DWORD, DWORD, LPBYTE, DWORD, LPDWORD, LPDWORD, LPDWORD, LPCWSTR) EnumServicesStatusExWParams = ((1, 'hSCManager'), (1, 'InfoLevel'), (1, 'dwServiceType'), (1, 'dwServiceState'), (1, 'lpServices'), (1, 'cbBufSize'), (1, 'pcbBytesNeeded'), (1, 'lpServicesReturned'), (1, 'lpResumeHandle'), (1, 'pszGroupName')) -# EnumWindows(lpEnumFunc, lParam): +#def EnumWindows(lpEnumFunc, lParam): +# return EnumWindows.ctypes_function(lpEnumFunc, lParam) EnumWindowsPrototype = WINFUNCTYPE(BOOL, WNDENUMPROC, LPARAM) EnumWindowsParams = ((1, 'lpEnumFunc'), (1, 'lParam')) -# GetWindowTextA(hWnd, lpString, nMaxCount): +#def GetWindowTextA(hWnd, lpString, nMaxCount): +# return GetWindowTextA.ctypes_function(hWnd, lpString, nMaxCount) GetWindowTextAPrototype = WINFUNCTYPE(INT, HWND, LPSTR, INT) GetWindowTextAParams = ((1, 'hWnd'), (1, 'lpString'), (1, 'nMaxCount')) -# GetWindowTextW(hWnd, lpString, nMaxCount): +#def GetWindowTextW(hWnd, lpString, nMaxCount): +# return GetWindowTextW.ctypes_function(hWnd, lpString, nMaxCount) GetWindowTextWPrototype = WINFUNCTYPE(INT, HWND, LPWSTR, INT) GetWindowTextWParams = ((1, 'hWnd'), (1, 'lpString'), (1, 'nMaxCount')) -# GetWindowModuleFileNameA(hwnd, pszFileName, cchFileNameMax): +#def GetWindowModuleFileNameA(hwnd, pszFileName, cchFileNameMax): +# return GetWindowModuleFileNameA.ctypes_function(hwnd, pszFileName, cchFileNameMax) GetWindowModuleFileNameAPrototype = WINFUNCTYPE(UINT, HWND, LPSTR, UINT) GetWindowModuleFileNameAParams = ((1, 'hwnd'), (1, 'pszFileName'), (1, 'cchFileNameMax')) -# GetWindowModuleFileNameW(hwnd, pszFileName, cchFileNameMax): +#def GetWindowModuleFileNameW(hwnd, pszFileName, cchFileNameMax): +# return GetWindowModuleFileNameW.ctypes_function(hwnd, pszFileName, cchFileNameMax) GetWindowModuleFileNameWPrototype = WINFUNCTYPE(UINT, HWND, LPWSTR, UINT) GetWindowModuleFileNameWParams = ((1, 'hwnd'), (1, 'pszFileName'), (1, 'cchFileNameMax')) -# CryptCATAdminCalcHashFromFileHandle(hFile, pcbHash, pbHash, dwFlags): +#def CryptCATAdminCalcHashFromFileHandle(hFile, pcbHash, pbHash, dwFlags): +# return CryptCATAdminCalcHashFromFileHandle.ctypes_function(hFile, pcbHash, pbHash, dwFlags) CryptCATAdminCalcHashFromFileHandlePrototype = WINFUNCTYPE(BOOL, HANDLE, POINTER(DWORD), POINTER(BYTE), DWORD) CryptCATAdminCalcHashFromFileHandleParams = ((1, 'hFile'), (1, 'pcbHash'), (1, 'pbHash'), (1, 'dwFlags')) -# CryptCATAdminEnumCatalogFromHash(hCatAdmin, pbHash, cbHash, dwFlags, phPrevCatInfo): +#def CryptCATAdminEnumCatalogFromHash(hCatAdmin, pbHash, cbHash, dwFlags, phPrevCatInfo): +# return CryptCATAdminEnumCatalogFromHash.ctypes_function(hCatAdmin, pbHash, cbHash, dwFlags, phPrevCatInfo) CryptCATAdminEnumCatalogFromHashPrototype = WINFUNCTYPE(HCATINFO, HCATADMIN, POINTER(BYTE), DWORD, DWORD, POINTER(HCATINFO)) CryptCATAdminEnumCatalogFromHashParams = ((1, 'hCatAdmin'), (1, 'pbHash'), (1, 'cbHash'), (1, 'dwFlags'), (1, 'phPrevCatInfo')) -# CryptCATAdminAcquireContext(phCatAdmin, pgSubsystem, dwFlags): +#def CryptCATAdminAcquireContext(phCatAdmin, pgSubsystem, dwFlags): +# return CryptCATAdminAcquireContext.ctypes_function(phCatAdmin, pgSubsystem, dwFlags) CryptCATAdminAcquireContextPrototype = WINFUNCTYPE(BOOL, POINTER(HCATADMIN), POINTER(GUID), DWORD) CryptCATAdminAcquireContextParams = ((1, 'phCatAdmin'), (1, 'pgSubsystem'), (1, 'dwFlags')) -# CryptCATCatalogInfoFromContext(hCatInfo, psCatInfo, dwFlags): +#def CryptCATCatalogInfoFromContext(hCatInfo, psCatInfo, dwFlags): +# return CryptCATCatalogInfoFromContext.ctypes_function(hCatInfo, psCatInfo, dwFlags) CryptCATCatalogInfoFromContextPrototype = WINFUNCTYPE(BOOL, HCATINFO, POINTER(CATALOG_INFO), DWORD) CryptCATCatalogInfoFromContextParams = ((1, 'hCatInfo'), (1, 'psCatInfo'), (1, 'dwFlags')) -# CryptCATAdminReleaseCatalogContext(hCatAdmin, hCatInfo, dwFlags): +#def CryptCATAdminReleaseCatalogContext(hCatAdmin, hCatInfo, dwFlags): +# return CryptCATAdminReleaseCatalogContext.ctypes_function(hCatAdmin, hCatInfo, dwFlags) CryptCATAdminReleaseCatalogContextPrototype = WINFUNCTYPE(BOOL, HCATADMIN, HCATINFO, DWORD) CryptCATAdminReleaseCatalogContextParams = ((1, 'hCatAdmin'), (1, 'hCatInfo'), (1, 'dwFlags')) -# CryptCATAdminReleaseContext(hCatAdmin, dwFlags): +#def CryptCATAdminReleaseContext(hCatAdmin, dwFlags): +# return CryptCATAdminReleaseContext.ctypes_function(hCatAdmin, dwFlags) CryptCATAdminReleaseContextPrototype = WINFUNCTYPE(BOOL, HCATADMIN, DWORD) CryptCATAdminReleaseContextParams = ((1, 'hCatAdmin'), (1, 'dwFlags')) -# GetLogicalDriveStringsA(nBufferLength, lpBuffer): +#def GetLogicalDriveStringsA(nBufferLength, lpBuffer): +# return GetLogicalDriveStringsA.ctypes_function(nBufferLength, lpBuffer) GetLogicalDriveStringsAPrototype = WINFUNCTYPE(DWORD, DWORD, LPCSTR) GetLogicalDriveStringsAParams = ((1, 'nBufferLength'), (1, 'lpBuffer')) -# GetLogicalDriveStringsW(nBufferLength, lpBuffer): +#def GetLogicalDriveStringsW(nBufferLength, lpBuffer): +# return GetLogicalDriveStringsW.ctypes_function(nBufferLength, lpBuffer) GetLogicalDriveStringsWPrototype = WINFUNCTYPE(DWORD, DWORD, LPWSTR) GetLogicalDriveStringsWParams = ((1, 'nBufferLength'), (1, 'lpBuffer')) -# GetVolumeInformationA(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize): +#def GetVolumeInformationA(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize): +# return GetVolumeInformationA.ctypes_function(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize) GetVolumeInformationAPrototype = WINFUNCTYPE(BOOL, LPCSTR, LPSTR, DWORD, LPDWORD, LPDWORD, LPDWORD, LPSTR, DWORD) GetVolumeInformationAParams = ((1, 'lpRootPathName'), (1, 'lpVolumeNameBuffer'), (1, 'nVolumeNameSize'), (1, 'lpVolumeSerialNumber'), (1, 'lpMaximumComponentLength'), (1, 'lpFileSystemFlags'), (1, 'lpFileSystemNameBuffer'), (1, 'nFileSystemNameSize')) -# GetVolumeInformationW(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize): +#def GetVolumeInformationW(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize): +# return GetVolumeInformationW.ctypes_function(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize) GetVolumeInformationWPrototype = WINFUNCTYPE(BOOL, LPWSTR, LPWSTR, DWORD, LPDWORD, LPDWORD, LPDWORD, LPWSTR, DWORD) GetVolumeInformationWParams = ((1, 'lpRootPathName'), (1, 'lpVolumeNameBuffer'), (1, 'nVolumeNameSize'), (1, 'lpVolumeSerialNumber'), (1, 'lpMaximumComponentLength'), (1, 'lpFileSystemFlags'), (1, 'lpFileSystemNameBuffer'), (1, 'nFileSystemNameSize')) -# GetVolumeNameForVolumeMountPointA(lpszVolumeMountPoint, lpszVolumeName, cchBufferLength): +#def GetVolumeNameForVolumeMountPointA(lpszVolumeMountPoint, lpszVolumeName, cchBufferLength): +# return GetVolumeNameForVolumeMountPointA.ctypes_function(lpszVolumeMountPoint, lpszVolumeName, cchBufferLength) GetVolumeNameForVolumeMountPointAPrototype = WINFUNCTYPE(BOOL, LPCSTR, LPCSTR, DWORD) GetVolumeNameForVolumeMountPointAParams = ((1, 'lpszVolumeMountPoint'), (1, 'lpszVolumeName'), (1, 'cchBufferLength')) -# GetVolumeNameForVolumeMountPointW(lpszVolumeMountPoint, lpszVolumeName, cchBufferLength): +#def GetVolumeNameForVolumeMountPointW(lpszVolumeMountPoint, lpszVolumeName, cchBufferLength): +# return GetVolumeNameForVolumeMountPointW.ctypes_function(lpszVolumeMountPoint, lpszVolumeName, cchBufferLength) GetVolumeNameForVolumeMountPointWPrototype = WINFUNCTYPE(BOOL, LPWSTR, LPWSTR, DWORD) GetVolumeNameForVolumeMountPointWParams = ((1, 'lpszVolumeMountPoint'), (1, 'lpszVolumeName'), (1, 'cchBufferLength')) -# GetDriveTypeA(lpRootPathName): +#def GetDriveTypeA(lpRootPathName): +# return GetDriveTypeA.ctypes_function(lpRootPathName) GetDriveTypeAPrototype = WINFUNCTYPE(UINT, LPCSTR) GetDriveTypeAParams = ((1, 'lpRootPathName'),) -# GetDriveTypeW(lpRootPathName): +#def GetDriveTypeW(lpRootPathName): +# return GetDriveTypeW.ctypes_function(lpRootPathName) GetDriveTypeWPrototype = WINFUNCTYPE(UINT, LPWSTR) GetDriveTypeWParams = ((1, 'lpRootPathName'),) -# QueryDosDeviceA(lpDeviceName, lpTargetPath, ucchMax): +#def QueryDosDeviceA(lpDeviceName, lpTargetPath, ucchMax): +# return QueryDosDeviceA.ctypes_function(lpDeviceName, lpTargetPath, ucchMax) QueryDosDeviceAPrototype = WINFUNCTYPE(DWORD, LPCSTR, LPCSTR, DWORD) QueryDosDeviceAParams = ((1, 'lpDeviceName'), (1, 'lpTargetPath'), (1, 'ucchMax')) -# QueryDosDeviceW(lpDeviceName, lpTargetPath, ucchMax): +#def QueryDosDeviceW(lpDeviceName, lpTargetPath, ucchMax): +# return QueryDosDeviceW.ctypes_function(lpDeviceName, lpTargetPath, ucchMax) QueryDosDeviceWPrototype = WINFUNCTYPE(DWORD, LPWSTR, LPWSTR, DWORD) QueryDosDeviceWParams = ((1, 'lpDeviceName'), (1, 'lpTargetPath'), (1, 'ucchMax')) -# NtQueryObject(Handle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength): +#def NtQueryObject(Handle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength): +# return NtQueryObject.ctypes_function(Handle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength) NtQueryObjectPrototype = WINFUNCTYPE(NTSTATUS, HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG) NtQueryObjectParams = ((1, 'Handle'), (1, 'ObjectInformationClass'), (1, 'ObjectInformation'), (1, 'ObjectInformationLength'), (1, 'ReturnLength')) -# DuplicateHandle(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions): +#def DuplicateHandle(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions): +# return DuplicateHandle.ctypes_function(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions) DuplicateHandlePrototype = WINFUNCTYPE(BOOL, HANDLE, HANDLE, HANDLE, LPHANDLE, DWORD, BOOL, DWORD) DuplicateHandleParams = ((1, 'hSourceProcessHandle'), (1, 'hSourceHandle'), (1, 'hTargetProcessHandle'), (1, 'lpTargetHandle'), (1, 'dwDesiredAccess'), (1, 'bInheritHandle'), (1, 'dwOptions')) -# GetModuleBaseNameA(hProcess, hModule, lpBaseName, nSize): +#def GetModuleBaseNameA(hProcess, hModule, lpBaseName, nSize): +# return GetModuleBaseNameA.ctypes_function(hProcess, hModule, lpBaseName, nSize) GetModuleBaseNameAPrototype = WINFUNCTYPE(DWORD, HANDLE, HMODULE, LPCSTR, DWORD) GetModuleBaseNameAParams = ((1, 'hProcess'), (1, 'hModule'), (1, 'lpBaseName'), (1, 'nSize')) -# GetModuleBaseNameW(hProcess, hModule, lpBaseName, nSize): +#def GetModuleBaseNameW(hProcess, hModule, lpBaseName, nSize): +# return GetModuleBaseNameW.ctypes_function(hProcess, hModule, lpBaseName, nSize) GetModuleBaseNameWPrototype = WINFUNCTYPE(DWORD, HANDLE, HMODULE, LPWSTR, DWORD) GetModuleBaseNameWParams = ((1, 'hProcess'), (1, 'hModule'), (1, 'lpBaseName'), (1, 'nSize')) -# GetProcessImageFileNameA(hProcess, lpImageFileName, nSize): +#def GetProcessImageFileNameA(hProcess, lpImageFileName, nSize): +# return GetProcessImageFileNameA.ctypes_function(hProcess, lpImageFileName, nSize) GetProcessImageFileNameAPrototype = WINFUNCTYPE(DWORD, HANDLE, LPCSTR, DWORD) GetProcessImageFileNameAParams = ((1, 'hProcess'), (1, 'lpImageFileName'), (1, 'nSize')) -# GetProcessImageFileNameW(hProcess, lpImageFileName, nSize): +#def GetProcessImageFileNameW(hProcess, lpImageFileName, nSize): +# return GetProcessImageFileNameW.ctypes_function(hProcess, lpImageFileName, nSize) GetProcessImageFileNameWPrototype = WINFUNCTYPE(DWORD, HANDLE, LPWSTR, DWORD) GetProcessImageFileNameWParams = ((1, 'hProcess'), (1, 'lpImageFileName'), (1, 'nSize')) -# GetFileVersionInfoA(lptstrFilename, dwHandle, dwLen, lpData): +#def GetFileVersionInfoA(lptstrFilename, dwHandle, dwLen, lpData): +# return GetFileVersionInfoA.ctypes_function(lptstrFilename, dwHandle, dwLen, lpData) GetFileVersionInfoAPrototype = WINFUNCTYPE(BOOL, LPCSTR, DWORD, DWORD, LPVOID) GetFileVersionInfoAParams = ((1, 'lptstrFilename'), (1, 'dwHandle'), (1, 'dwLen'), (1, 'lpData')) -# GetFileVersionInfoW(lptstrFilename, dwHandle, dwLen, lpData): +#def GetFileVersionInfoW(lptstrFilename, dwHandle, dwLen, lpData): +# return GetFileVersionInfoW.ctypes_function(lptstrFilename, dwHandle, dwLen, lpData) GetFileVersionInfoWPrototype = WINFUNCTYPE(BOOL, LPWSTR, DWORD, DWORD, LPVOID) GetFileVersionInfoWParams = ((1, 'lptstrFilename'), (1, 'dwHandle'), (1, 'dwLen'), (1, 'lpData')) -# GetFileVersionInfoSizeA(lptstrFilename, lpdwHandle): +#def GetFileVersionInfoSizeA(lptstrFilename, lpdwHandle): +# return GetFileVersionInfoSizeA.ctypes_function(lptstrFilename, lpdwHandle) GetFileVersionInfoSizeAPrototype = WINFUNCTYPE(DWORD, LPCSTR, LPDWORD) GetFileVersionInfoSizeAParams = ((1, 'lptstrFilename'), (1, 'lpdwHandle')) -# GetFileVersionInfoSizeW(lptstrFilename, lpdwHandle): +#def GetFileVersionInfoSizeW(lptstrFilename, lpdwHandle): +# return GetFileVersionInfoSizeW.ctypes_function(lptstrFilename, lpdwHandle) GetFileVersionInfoSizeWPrototype = WINFUNCTYPE(DWORD, LPWSTR, LPDWORD) GetFileVersionInfoSizeWParams = ((1, 'lptstrFilename'), (1, 'lpdwHandle')) -# VerQueryValueA(pBlock, lpSubBlock, lplpBuffer, puLen): +#def VerQueryValueA(pBlock, lpSubBlock, lplpBuffer, puLen): +# return VerQueryValueA.ctypes_function(pBlock, lpSubBlock, lplpBuffer, puLen) VerQueryValueAPrototype = WINFUNCTYPE(BOOL, LPCVOID, LPCSTR, POINTER(LPVOID), PUINT) VerQueryValueAParams = ((1, 'pBlock'), (1, 'lpSubBlock'), (1, 'lplpBuffer'), (1, 'puLen')) -# VerQueryValueW(pBlock, lpSubBlock, lplpBuffer, puLen): +#def VerQueryValueW(pBlock, lpSubBlock, lplpBuffer, puLen): +# return VerQueryValueW.ctypes_function(pBlock, lpSubBlock, lplpBuffer, puLen) VerQueryValueWPrototype = WINFUNCTYPE(BOOL, LPCVOID, LPWSTR, POINTER(LPVOID), PUINT) VerQueryValueWParams = ((1, 'pBlock'), (1, 'lpSubBlock'), (1, 'lplpBuffer'), (1, 'puLen')) -# GetSystemMetrics(nIndex): +#def GetSystemMetrics(nIndex): +# return GetSystemMetrics.ctypes_function(nIndex) GetSystemMetricsPrototype = WINFUNCTYPE(INT, INT) GetSystemMetricsParams = ((1, 'nIndex'),) -# GetComputerNameA(lpBuffer, lpnSize): +#def GetComputerNameA(lpBuffer, lpnSize): +# return GetComputerNameA.ctypes_function(lpBuffer, lpnSize) GetComputerNameAPrototype = WINFUNCTYPE(BOOL, LPCSTR, LPDWORD) GetComputerNameAParams = ((1, 'lpBuffer'), (1, 'lpnSize')) -# GetComputerNameW(lpBuffer, lpnSize): +#def GetComputerNameW(lpBuffer, lpnSize): +# return GetComputerNameW.ctypes_function(lpBuffer, lpnSize) GetComputerNameWPrototype = WINFUNCTYPE(BOOL, LPWSTR, LPDWORD) GetComputerNameWParams = ((1, 'lpBuffer'), (1, 'lpnSize')) -# LookupAccountSidA(lpSystemName, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse): +#def LookupAccountSidA(lpSystemName, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse): +# return LookupAccountSidA.ctypes_function(lpSystemName, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse) LookupAccountSidAPrototype = WINFUNCTYPE(BOOL, LPCSTR, PSID, LPCSTR, LPDWORD, LPCSTR, LPDWORD, PSID_NAME_USE) LookupAccountSidAParams = ((1, 'lpSystemName'), (1, 'lpSid'), (1, 'lpName'), (1, 'cchName'), (1, 'lpReferencedDomainName'), (1, 'cchReferencedDomainName'), (1, 'peUse')) -# LookupAccountSidW(lpSystemName, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse): +#def LookupAccountSidW(lpSystemName, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse): +# return LookupAccountSidW.ctypes_function(lpSystemName, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse) LookupAccountSidWPrototype = WINFUNCTYPE(BOOL, LPWSTR, PSID, LPWSTR, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE) LookupAccountSidWParams = ((1, 'lpSystemName'), (1, 'lpSid'), (1, 'lpName'), (1, 'cchName'), (1, 'lpReferencedDomainName'), (1, 'cchReferencedDomainName'), (1, 'peUse')) +#def CoInitializeEx(pvReserved, dwCoInit): +# return CoInitializeEx.ctypes_function(pvReserved, dwCoInit) +CoInitializeExPrototype = WINFUNCTYPE(HRESULT, LPVOID, DWORD) +CoInitializeExParams = ((1, 'pvReserved'), (1, 'dwCoInit')) + +#def CoInitializeSecurity(pSecDesc, cAuthSvc, asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pAuthList, dwCapabilities, pReserved3): +# return CoInitializeSecurity.ctypes_function(pSecDesc, cAuthSvc, asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pAuthList, dwCapabilities, pReserved3) +CoInitializeSecurityPrototype = WINFUNCTYPE(HRESULT, PSECURITY_DESCRIPTOR, LONG, POINTER(SOLE_AUTHENTICATION_SERVICE), PVOID, DWORD, DWORD, PVOID, DWORD, PVOID) +CoInitializeSecurityParams = ((1, 'pSecDesc'), (1, 'cAuthSvc'), (1, 'asAuthSvc'), (1, 'pReserved1'), (1, 'dwAuthnLevel'), (1, 'dwImpLevel'), (1, 'pAuthList'), (1, 'dwCapabilities'), (1, 'pReserved3')) + +#def CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv): +# return CoCreateInstance.ctypes_function(rclsid, pUnkOuter, dwClsContext, riid, ppv) +CoCreateInstancePrototype = WINFUNCTYPE(HRESULT, REFCLSID, LPUNKNOWN, DWORD, REFIID, POINTER(LPVOID)) +CoCreateInstanceParams = ((1, 'rclsid'), (1, 'pUnkOuter'), (1, 'dwClsContext'), (1, 'riid'), (1, 'ppv')) + diff --git a/windows/generated_def/winstructs.py b/windows/generated_def/winstructs.py index 7cf9f16..a7840e7 100644 --- a/windows/generated_def/winstructs.py +++ b/windows/generated_def/winstructs.py @@ -23,6 +23,8 @@ UCHAR = c_char CSHORT = c_short VARTYPE = c_ushort BSTR = c_wchar_p +OLECHAR = c_wchar +POLECHAR = c_wchar_p PUCHAR = POINTER(UCHAR) double = c_double FARPROC = PVOID @@ -51,6 +53,8 @@ REGSAM = ACCESS_MASK SECURITY_CONTEXT_TRACKING_MODE = BOOLEAN DISPID = LONG MEMBERID = DISPID +PSECURITY_DESCRIPTOR = PVOID +LPUNKNOWN = POINTER(PVOID) LPCONTEXT = PVOID HCERTSTORE = PVOID HCRYPTMSG = PVOID @@ -58,9 +62,9 @@ PALPC_PORT_ATTRIBUTES = PVOID VOID = DWORD ITypeInfo = PVOID -structs = ['_LIST_ENTRY', '_PEB_LDR_DATA', '_LSA_UNICODE_STRING', '_RTL_USER_PROCESS_PARAMETERS', '_PEB', '_SECURITY_ATTRIBUTES', '_SYSTEM_VERIFIER_INFORMATION', '_LDR_DATA_TABLE_ENTRY', '_IMAGE_FILE_HEADER', '_IMAGE_DATA_DIRECTORY', '_IMAGE_SECTION_HEADER', '_IMAGE_OPTIONAL_HEADER64', '_IMAGE_OPTIONAL_HEADER', '_IMAGE_NT_HEADERS64', '_IMAGE_NT_HEADERS', '_IMAGE_IMPORT_DESCRIPTOR', '_IMAGE_IMPORT_BY_NAME', '_IMAGE_EXPORT_DIRECTORY', '_MEMORY_BASIC_INFORMATION', '_MEMORY_BASIC_INFORMATION32', '_MEMORY_BASIC_INFORMATION64', '_STARTUPINFOA', '_STARTUPINFOW', '_PROCESS_INFORMATION', '_FLOATING_SAVE_AREA', '_CONTEXT32', '_WOW64_FLOATING_SAVE_AREA', '_WOW64_CONTEXT', '_M128A', '_CONTEXT64', 'tagPROCESSENTRY32W', 'tagPROCESSENTRY32', 'tagTHREADENTRY32', '_LUID', '_LUID_AND_ATTRIBUTES', '_TOKEN_PRIVILEGES', '_TOKEN_ELEVATION', '_SID_AND_ATTRIBUTES', '_TOKEN_MANDATORY_LABEL', '_TOKEN_USER', '_OSVERSIONINFOA', '_OSVERSIONINFOW', '_OSVERSIONINFOEXA', '_OSVERSIONINFOEXW', '_OVERLAPPED', '_MIB_TCPROW_OWNER_PID', '_MIB_TCPTABLE_OWNER_PID', '_MIB_UDPROW_OWNER_PID', '_MIB_UDPTABLE_OWNER_PID', '_MIB_UDP6ROW_OWNER_PID', '_MIB_UDP6TABLE_OWNER_PID', '_MIB_TCP6ROW_OWNER_PID', '_MIB_TCP6TABLE_OWNER_PID', '_MIB_TCPROW', '_EXCEPTION_RECORD', '_EXCEPTION_RECORD32', '_EXCEPTION_RECORD64', '_EXCEPTION_POINTERS64', '_EXCEPTION_POINTERS32', '_DEBUG_PROCESSOR_IDENTIFICATION_ALPHA', '_DEBUG_PROCESSOR_IDENTIFICATION_AMD64', '_DEBUG_PROCESSOR_IDENTIFICATION_IA64', '_DEBUG_PROCESSOR_IDENTIFICATION_X86', '_DEBUG_PROCESSOR_IDENTIFICATION_ARM', '_DEBUG_PROCESSOR_IDENTIFICATION_ALL', '_SYMBOL_INFO', '_MODLOAD_DATA', '_SYSTEM_MODULE32', '_SYSTEM_MODULE64', '_SYSTEM_MODULE_INFORMATION32', '_SYSTEM_MODULE_INFORMATION64', 'tagSAFEARRAYBOUND', 'tagSAFEARRAY', '_DEBUG_BREAKPOINT_PARAMETERS', '_DEBUG_REGISTER_DESCRIPTION', '_DEBUG_STACK_FRAME', '_DEBUG_LAST_EVENT_INFO_BREAKPOINT', '_DEBUG_LAST_EVENT_INFO_EXCEPTION', '_DEBUG_LAST_EVENT_INFO_EXIT_THREAD', '_DEBUG_LAST_EVENT_INFO_EXIT_PROCESS', '_DEBUG_LAST_EVENT_INFO_LOAD_MODULE', '_DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE', '_DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR', '_DEBUG_SPECIFIC_FILTER_PARAMETERS', '_DEBUG_EXCEPTION_FILTER_PARAMETERS', '_GUID', '_TMP_signscale', '_TMP_lowmid', 'TMP_signscale_union', 'TMP_lowmid_union', 'tagDEC', '__tagBRECORD', 'TMP_variant_sub_union', '__tagVARIANT', 'tagDISPPARAMS', 'tagEXCEPINFO', '_CRYPTOAPI_BLOB', 'WINTRUST_FILE_INFO_', '_CRYPT_ATTRIBUTE', '_CTL_ENTRY', '_CRYPT_ATTRIBUTE', '_CRYPT_ATTRIBUTES', '_CRYPT_ALGORITHM_IDENTIFIER', '_CMSG_SIGNER_INFO', '_CERT_EXTENSION', '_CTL_USAGE', '_CTL_INFO', '_CTL_CONTEXT', 'WINTRUST_CATALOG_INFO_', 'WINTRUST_BLOB_INFO_', '_CRYPT_BIT_BLOB', '_CERT_PUBLIC_KEY_INFO', '_CERT_INFO', '_CERT_CONTEXT', 'WINTRUST_SGNR_INFO_', '_FILETIME', 'WINTRUST_CERT_INFO_', '_TMP_WINTRUST_UNION_TYPE', '_WINTRUST_DATA', '_PROCESS_BASIC_INFORMATION', '_JIT_DEBUG_INFO', '_SID_IDENTIFIER_AUTHORITY', '_EXCEPTION_DEBUG_INFO', '_CREATE_THREAD_DEBUG_INFO', '_CREATE_PROCESS_DEBUG_INFO', '_EXIT_THREAD_DEBUG_INFO', '_EXIT_PROCESS_DEBUG_INFO', '_LOAD_DLL_DEBUG_INFO', '_UNLOAD_DLL_DEBUG_INFO', '_OUTPUT_DEBUG_STRING_INFO', '_RIP_INFO', '_TMP_UNION_DEBUG_INFO', '_DEBUG_EVENT', '_STRING', '_OBJECT_ATTRIBUTES', '_SECURITY_QUALITY_OF_SERVICE', '_ALPC_PORT_ATTRIBUTES32', '_ALPC_PORT_ATTRIBUTES64', '_ALPC_MESSAGE_ATTRIBUTES', '_PORT_MESSAGE_TMP_UNION', '_PORT_MESSAGE_TMP_SUBSTRUCT_S1', '_PORT_MESSAGE_TMP_UNION_U1', '_PORT_MESSAGE_TMP_SUBSTRUCT_S2', '_PORT_MESSAGE_TMP_UNION_U2', '_PORT_MESSAGE', '_SERVICE_STATUS', '_SERVICE_STATUS_PROCESS', '_ENUM_SERVICE_STATUS_PROCESSA', '_ENUM_SERVICE_STATUS_PROCESSW', 'CATALOG_INFO_', '_SYSTEM_HANDLE', '_SYSTEM_HANDLE_INFORMATION', '__PUBLIC_OBJECT_TYPE_INFORMATION', '_PUBLIC_OBJECT_BASIC_INFORMATION', '_EVENTLOGRECORD'] +structs = ['_LIST_ENTRY', '_PEB_LDR_DATA', '_LSA_UNICODE_STRING', '_RTL_USER_PROCESS_PARAMETERS', '_PEB', '_SECURITY_ATTRIBUTES', '_SYSTEM_VERIFIER_INFORMATION', '_LDR_DATA_TABLE_ENTRY', '_IMAGE_FILE_HEADER', '_IMAGE_DATA_DIRECTORY', '_IMAGE_SECTION_HEADER', '_IMAGE_OPTIONAL_HEADER64', '_IMAGE_OPTIONAL_HEADER', '_IMAGE_NT_HEADERS64', '_IMAGE_NT_HEADERS', '_IMAGE_IMPORT_DESCRIPTOR', '_IMAGE_IMPORT_BY_NAME', '_IMAGE_EXPORT_DIRECTORY', '_MEMORY_BASIC_INFORMATION', '_MEMORY_BASIC_INFORMATION32', '_MEMORY_BASIC_INFORMATION64', '_STARTUPINFOA', '_STARTUPINFOW', '_PROCESS_INFORMATION', '_FLOATING_SAVE_AREA', '_CONTEXT32', '_WOW64_FLOATING_SAVE_AREA', '_WOW64_CONTEXT', '_M128A', '_CONTEXT64', 'tagPROCESSENTRY32W', 'tagPROCESSENTRY32', 'tagTHREADENTRY32', '_LUID', '_LUID_AND_ATTRIBUTES', '_TOKEN_PRIVILEGES', '_TOKEN_ELEVATION', '_SID_AND_ATTRIBUTES', '_TOKEN_MANDATORY_LABEL', '_TOKEN_USER', '_OSVERSIONINFOA', '_OSVERSIONINFOW', '_OSVERSIONINFOEXA', '_OSVERSIONINFOEXW', '_OVERLAPPED', '_MIB_TCPROW_OWNER_PID', '_MIB_TCPTABLE_OWNER_PID', '_MIB_UDPROW_OWNER_PID', '_MIB_UDPTABLE_OWNER_PID', '_MIB_UDP6ROW_OWNER_PID', '_MIB_UDP6TABLE_OWNER_PID', '_MIB_TCP6ROW_OWNER_PID', '_MIB_TCP6TABLE_OWNER_PID', '_MIB_TCPROW', '_EXCEPTION_RECORD', '_EXCEPTION_RECORD32', '_EXCEPTION_RECORD64', '_EXCEPTION_POINTERS64', '_EXCEPTION_POINTERS32', '_DEBUG_PROCESSOR_IDENTIFICATION_ALPHA', '_DEBUG_PROCESSOR_IDENTIFICATION_AMD64', '_DEBUG_PROCESSOR_IDENTIFICATION_IA64', '_DEBUG_PROCESSOR_IDENTIFICATION_X86', '_DEBUG_PROCESSOR_IDENTIFICATION_ARM', '_DEBUG_PROCESSOR_IDENTIFICATION_ALL', '_SYMBOL_INFO', '_MODLOAD_DATA', '_SYSTEM_MODULE32', '_SYSTEM_MODULE64', '_SYSTEM_MODULE_INFORMATION32', '_SYSTEM_MODULE_INFORMATION64', 'tagSAFEARRAYBOUND', 'tagSAFEARRAY', '_DEBUG_BREAKPOINT_PARAMETERS', '_DEBUG_REGISTER_DESCRIPTION', '_DEBUG_STACK_FRAME', '_DEBUG_LAST_EVENT_INFO_BREAKPOINT', '_DEBUG_LAST_EVENT_INFO_EXCEPTION', '_DEBUG_LAST_EVENT_INFO_EXIT_THREAD', '_DEBUG_LAST_EVENT_INFO_EXIT_PROCESS', '_DEBUG_LAST_EVENT_INFO_LOAD_MODULE', '_DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE', '_DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR', '_DEBUG_SPECIFIC_FILTER_PARAMETERS', '_DEBUG_EXCEPTION_FILTER_PARAMETERS', '_GUID', '_TMP_signscale', '_TMP_lowmid', 'TMP_signscale_union', 'TMP_lowmid_union', 'tagDEC', '__tagBRECORD', 'TMP_variant_sub_union', '__tagVARIANT', 'tagDISPPARAMS', 'tagEXCEPINFO', '_CRYPTOAPI_BLOB', 'WINTRUST_FILE_INFO_', '_CRYPT_ATTRIBUTE', '_CTL_ENTRY', '_CRYPT_ATTRIBUTE', '_CRYPT_ATTRIBUTES', '_CRYPT_ALGORITHM_IDENTIFIER', '_CMSG_SIGNER_INFO', '_CERT_EXTENSION', '_CTL_USAGE', '_CTL_INFO', '_CTL_CONTEXT', 'WINTRUST_CATALOG_INFO_', 'WINTRUST_BLOB_INFO_', '_CRYPT_BIT_BLOB', '_CERT_PUBLIC_KEY_INFO', '_CERT_INFO', '_CERT_CONTEXT', 'WINTRUST_SGNR_INFO_', '_FILETIME', 'WINTRUST_CERT_INFO_', '_TMP_WINTRUST_UNION_TYPE', '_WINTRUST_DATA', '_PROCESS_BASIC_INFORMATION', '_JIT_DEBUG_INFO', '_SID_IDENTIFIER_AUTHORITY', '_EXCEPTION_DEBUG_INFO', '_CREATE_THREAD_DEBUG_INFO', '_CREATE_PROCESS_DEBUG_INFO', '_EXIT_THREAD_DEBUG_INFO', '_EXIT_PROCESS_DEBUG_INFO', '_LOAD_DLL_DEBUG_INFO', '_UNLOAD_DLL_DEBUG_INFO', '_OUTPUT_DEBUG_STRING_INFO', '_RIP_INFO', '_TMP_UNION_DEBUG_INFO', '_DEBUG_EVENT', '_STRING', '_OBJECT_ATTRIBUTES', '_SECURITY_QUALITY_OF_SERVICE', '_ALPC_PORT_ATTRIBUTES32', '_ALPC_PORT_ATTRIBUTES64', '_ALPC_MESSAGE_ATTRIBUTES', '_PORT_MESSAGE_TMP_UNION', '_PORT_MESSAGE_TMP_SUBSTRUCT_S1', '_PORT_MESSAGE_TMP_UNION_U1', '_PORT_MESSAGE_TMP_SUBSTRUCT_S2', '_PORT_MESSAGE_TMP_UNION_U2', '_PORT_MESSAGE', '_SERVICE_STATUS', '_SERVICE_STATUS_PROCESS', '_ENUM_SERVICE_STATUS_PROCESSA', '_ENUM_SERVICE_STATUS_PROCESSW', 'CATALOG_INFO_', '_SYSTEM_HANDLE', '_SYSTEM_HANDLE_INFORMATION', '__PUBLIC_OBJECT_TYPE_INFORMATION', '_PUBLIC_OBJECT_BASIC_INFORMATION', '_EVENTLOGRECORD', 'tagSOLE_AUTHENTICATION_SERVICE'] -enums = ['_SYSTEM_INFORMATION_CLASS', '_MEMORY_INFORMATION_CLASS', '_THREAD_INFORMATION_CLASS', '_TCP_TABLE_CLASS', '_VARENUM', '_UDP_TABLE_CLASS', '_MIB_TCP_STATE', '_TOKEN_INFORMATION_CLASS', '_SECURITY_IMPERSONATION_LEVEL', '_SC_ENUM_TYPE', '_SC_STATUS_TYPE', '_OBJECT_INFORMATION_CLASS', '_SID_NAME_USE', 'NET_FW_PROFILE_TYPE2_', 'NET_FW_ACTION_', 'NET_FW_MODIFY_STATE_', 'NET_FW_RULE_DIRECTION_', '_IMAGEHLP_SYMBOL_TYPE_INFO', '_PROCESSINFOCLASS', 'tagTYPEKIND'] +enums = ['_SYSTEM_INFORMATION_CLASS', '_MEMORY_INFORMATION_CLASS', '_THREAD_INFORMATION_CLASS', '_TCP_TABLE_CLASS', '_VARENUM', '_UDP_TABLE_CLASS', '_MIB_TCP_STATE', '_TOKEN_INFORMATION_CLASS', '_SECURITY_IMPERSONATION_LEVEL', '_SC_ENUM_TYPE', '_SC_STATUS_TYPE', '_OBJECT_INFORMATION_CLASS', '_SID_NAME_USE', 'NET_FW_PROFILE_TYPE2_', 'NET_FW_ACTION_', 'NET_FW_MODIFY_STATE_', 'NET_FW_RULE_DIRECTION_', 'tag_WBEMSTATUS', 'tagCLSCTX', '_IMAGEHLP_SYMBOL_TYPE_INFO', '_PROCESSINFOCLASS', 'tagCOINIT', 'tagTYPEKIND'] # Enum _SYSTEM_INFORMATION_CLASS definitions _SYSTEM_INFORMATION_CLASS = DWORD @@ -403,6 +407,233 @@ NET_FW_RULE_DIR_IN = 0x1 NET_FW_RULE_DIR_OUT = 0x2 NET_FW_RULE_DIR_MAX = 0x3 +# Enum tag_WBEMSTATUS definitions +tag_WBEMSTATUS = DWORD +WBEMSTATUS = tag_WBEMSTATUS + +WBEM_NO_ERROR = 0x0 +WBEM_S_NO_ERROR = 0x0 +WBEM_S_SAME = 0x0 +WBEM_S_FALSE = 0x1 +WBEM_S_ALREADY_EXISTS = 0x40001 +WBEM_S_RESET_TO_DEFAULT = 0x40002 +WBEM_S_DIFFERENT = 0x40003 +WBEM_S_TIMEDOUT = 0x40004 +WBEM_S_NO_MORE_DATA = 0x40005 +WBEM_S_OPERATION_CANCELLED = 0x40006 +WBEM_S_PENDING = 0x40007 +WBEM_S_DUPLICATE_OBJECTS = 0x40008 +WBEM_S_ACCESS_DENIED = 0x40009 +WBEM_S_PARTIAL_RESULTS = 0x40010 +WBEM_S_SOURCE_NOT_AVAILABLE = 0x40017 +WBEM_E_FAILED = 0x80041001L +WBEM_E_NOT_FOUND = 0x80041002L +WBEM_E_ACCESS_DENIED = 0x80041003L +WBEM_E_PROVIDER_FAILURE = 0x80041004L +WBEM_E_TYPE_MISMATCH = 0x80041005L +WBEM_E_OUT_OF_MEMORY = 0x80041006L +WBEM_E_INVALID_CONTEXT = 0x80041007L +WBEM_E_INVALID_PARAMETER = 0x80041008L +WBEM_E_NOT_AVAILABLE = 0x80041009L +WBEM_E_CRITICAL_ERROR = 0x8004100aL +WBEM_E_INVALID_STREAM = 0x8004100bL +WBEM_E_NOT_SUPPORTED = 0x8004100cL +WBEM_E_INVALID_SUPERCLASS = 0x8004100dL +WBEM_E_INVALID_NAMESPACE = 0x8004100eL +WBEM_E_INVALID_OBJECT = 0x8004100fL +WBEM_E_INVALID_CLASS = 0x80041010L +WBEM_E_PROVIDER_NOT_FOUND = 0x80041011L +WBEM_E_INVALID_PROVIDER_REGISTRATION = 0x80041012L +WBEM_E_PROVIDER_LOAD_FAILURE = 0x80041013L +WBEM_E_INITIALIZATION_FAILURE = 0x80041014L +WBEM_E_TRANSPORT_FAILURE = 0x80041015L +WBEM_E_INVALID_OPERATION = 0x80041016L +WBEM_E_INVALID_QUERY = 0x80041017L +WBEM_E_INVALID_QUERY_TYPE = 0x80041018L +WBEM_E_ALREADY_EXISTS = 0x80041019L +WBEM_E_OVERRIDE_NOT_ALLOWED = 0x8004101aL +WBEM_E_PROPAGATED_QUALIFIER = 0x8004101bL +WBEM_E_PROPAGATED_PROPERTY = 0x8004101cL +WBEM_E_UNEXPECTED = 0x8004101dL +WBEM_E_ILLEGAL_OPERATION = 0x8004101eL +WBEM_E_CANNOT_BE_KEY = 0x8004101fL +WBEM_E_INCOMPLETE_CLASS = 0x80041020L +WBEM_E_INVALID_SYNTAX = 0x80041021L +WBEM_E_NONDECORATED_OBJECT = 0x80041022L +WBEM_E_READ_ONLY = 0x80041023L +WBEM_E_PROVIDER_NOT_CAPABLE = 0x80041024L +WBEM_E_CLASS_HAS_CHILDREN = 0x80041025L +WBEM_E_CLASS_HAS_INSTANCES = 0x80041026L +WBEM_E_QUERY_NOT_IMPLEMENTED = 0x80041027L +WBEM_E_ILLEGAL_NULL = 0x80041028L +WBEM_E_INVALID_QUALIFIER_TYPE = 0x80041029L +WBEM_E_INVALID_PROPERTY_TYPE = 0x8004102aL +WBEM_E_VALUE_OUT_OF_RANGE = 0x8004102bL +WBEM_E_CANNOT_BE_SINGLETON = 0x8004102cL +WBEM_E_INVALID_CIM_TYPE = 0x8004102dL +WBEM_E_INVALID_METHOD = 0x8004102eL +WBEM_E_INVALID_METHOD_PARAMETERS = 0x8004102fL +WBEM_E_SYSTEM_PROPERTY = 0x80041030L +WBEM_E_INVALID_PROPERTY = 0x80041031L +WBEM_E_CALL_CANCELLED = 0x80041032L +WBEM_E_SHUTTING_DOWN = 0x80041033L +WBEM_E_PROPAGATED_METHOD = 0x80041034L +WBEM_E_UNSUPPORTED_PARAMETER = 0x80041035L +WBEM_E_MISSING_PARAMETER_ID = 0x80041036L +WBEM_E_INVALID_PARAMETER_ID = 0x80041037L +WBEM_E_NONCONSECUTIVE_PARAMETER_IDS = 0x80041038L +WBEM_E_PARAMETER_ID_ON_RETVAL = 0x80041039L +WBEM_E_INVALID_OBJECT_PATH = 0x8004103aL +WBEM_E_OUT_OF_DISK_SPACE = 0x8004103bL +WBEM_E_BUFFER_TOO_SMALL = 0x8004103cL +WBEM_E_UNSUPPORTED_PUT_EXTENSION = 0x8004103dL +WBEM_E_UNKNOWN_OBJECT_TYPE = 0x8004103eL +WBEM_E_UNKNOWN_PACKET_TYPE = 0x8004103fL +WBEM_E_MARSHAL_VERSION_MISMATCH = 0x80041040L +WBEM_E_MARSHAL_INVALID_SIGNATURE = 0x80041041L +WBEM_E_INVALID_QUALIFIER = 0x80041042L +WBEM_E_INVALID_DUPLICATE_PARAMETER = 0x80041043L +WBEM_E_TOO_MUCH_DATA = 0x80041044L +WBEM_E_SERVER_TOO_BUSY = 0x80041045L +WBEM_E_INVALID_FLAVOR = 0x80041046L +WBEM_E_CIRCULAR_REFERENCE = 0x80041047L +WBEM_E_UNSUPPORTED_CLASS_UPDATE = 0x80041048L +WBEM_E_CANNOT_CHANGE_KEY_INHERITANCE = 0x80041049L +WBEM_E_CANNOT_CHANGE_INDEX_INHERITANCE = 0x80041050L +WBEM_E_TOO_MANY_PROPERTIES = 0x80041051L +WBEM_E_UPDATE_TYPE_MISMATCH = 0x80041052L +WBEM_E_UPDATE_OVERRIDE_NOT_ALLOWED = 0x80041053L +WBEM_E_UPDATE_PROPAGATED_METHOD = 0x80041054L +WBEM_E_METHOD_NOT_IMPLEMENTED = 0x80041055L +WBEM_E_METHOD_DISABLED = 0x80041056L +WBEM_E_REFRESHER_BUSY = 0x80041057L +WBEM_E_UNPARSABLE_QUERY = 0x80041058L +WBEM_E_NOT_EVENT_CLASS = 0x80041059L +WBEM_E_MISSING_GROUP_WITHIN = 0x8004105aL +WBEM_E_MISSING_AGGREGATION_LIST = 0x8004105bL +WBEM_E_PROPERTY_NOT_AN_OBJECT = 0x8004105cL +WBEM_E_AGGREGATING_BY_OBJECT = 0x8004105dL +WBEM_E_UNINTERPRETABLE_PROVIDER_QUERY = 0x8004105fL +WBEM_E_BACKUP_RESTORE_WINMGMT_RUNNING = 0x80041060L +WBEM_E_QUEUE_OVERFLOW = 0x80041061L +WBEM_E_PRIVILEGE_NOT_HELD = 0x80041062L +WBEM_E_INVALID_OPERATOR = 0x80041063L +WBEM_E_LOCAL_CREDENTIALS = 0x80041064L +WBEM_E_CANNOT_BE_ABSTRACT = 0x80041065L +WBEM_E_AMENDED_OBJECT = 0x80041066L +WBEM_E_CLIENT_TOO_SLOW = 0x80041067L +WBEM_E_NULL_SECURITY_DESCRIPTOR = 0x80041068L +WBEM_E_TIMED_OUT = 0x80041069L +WBEM_E_INVALID_ASSOCIATION = 0x8004106aL +WBEM_E_AMBIGUOUS_OPERATION = 0x8004106bL +WBEM_E_QUOTA_VIOLATION = 0x8004106cL +WBEM_E_RESERVED_001 = 0x8004106dL +WBEM_E_RESERVED_002 = 0x8004106eL +WBEM_E_UNSUPPORTED_LOCALE = 0x8004106fL +WBEM_E_HANDLE_OUT_OF_DATE = 0x80041070L +WBEM_E_CONNECTION_FAILED = 0x80041071L +WBEM_E_INVALID_HANDLE_REQUEST = 0x80041072L +WBEM_E_PROPERTY_NAME_TOO_WIDE = 0x80041073L +WBEM_E_CLASS_NAME_TOO_WIDE = 0x80041074L +WBEM_E_METHOD_NAME_TOO_WIDE = 0x80041075L +WBEM_E_QUALIFIER_NAME_TOO_WIDE = 0x80041076L +WBEM_E_RERUN_COMMAND = 0x80041077L +WBEM_E_DATABASE_VER_MISMATCH = 0x80041078L +WBEM_E_VETO_DELETE = 0x80041079L +WBEM_E_VETO_PUT = 0x8004107aL +WBEM_E_INVALID_LOCALE = 0x80041080L +WBEM_E_PROVIDER_SUSPENDED = 0x80041081L +WBEM_E_SYNCHRONIZATION_REQUIRED = 0x80041082L +WBEM_E_NO_SCHEMA = 0x80041083L +WBEM_E_PROVIDER_ALREADY_REGISTERED = 0x80041084L +WBEM_E_PROVIDER_NOT_REGISTERED = 0x80041085L +WBEM_E_FATAL_TRANSPORT_ERROR = 0x80041086L +WBEM_E_ENCRYPTED_CONNECTION_REQUIRED = 0x80041087L +WBEM_E_PROVIDER_TIMED_OUT = 0x80041088L +WBEM_E_NO_KEY = 0x80041089L +WBEM_E_PROVIDER_DISABLED = 0x8004108aL +WBEMESS_E_REGISTRATION_TOO_BROAD = 0x80042001L +WBEMESS_E_REGISTRATION_TOO_PRECISE = 0x80042002L +WBEMESS_E_AUTHZ_NOT_PRIVILEGED = 0x80042003L +WBEMMOF_E_EXPECTED_QUALIFIER_NAME = 0x80044001L +WBEMMOF_E_EXPECTED_SEMI = 0x80044002L +WBEMMOF_E_EXPECTED_OPEN_BRACE = 0x80044003L +WBEMMOF_E_EXPECTED_CLOSE_BRACE = 0x80044004L +WBEMMOF_E_EXPECTED_CLOSE_BRACKET = 0x80044005L +WBEMMOF_E_EXPECTED_CLOSE_PAREN = 0x80044006L +WBEMMOF_E_ILLEGAL_CONSTANT_VALUE = 0x80044007L +WBEMMOF_E_EXPECTED_TYPE_IDENTIFIER = 0x80044008L +WBEMMOF_E_EXPECTED_OPEN_PAREN = 0x80044009L +WBEMMOF_E_UNRECOGNIZED_TOKEN = 0x8004400aL +WBEMMOF_E_UNRECOGNIZED_TYPE = 0x8004400bL +WBEMMOF_E_EXPECTED_PROPERTY_NAME = 0x8004400cL +WBEMMOF_E_TYPEDEF_NOT_SUPPORTED = 0x8004400dL +WBEMMOF_E_UNEXPECTED_ALIAS = 0x8004400eL +WBEMMOF_E_UNEXPECTED_ARRAY_INIT = 0x8004400fL +WBEMMOF_E_INVALID_AMENDMENT_SYNTAX = 0x80044010L +WBEMMOF_E_INVALID_DUPLICATE_AMENDMENT = 0x80044011L +WBEMMOF_E_INVALID_PRAGMA = 0x80044012L +WBEMMOF_E_INVALID_NAMESPACE_SYNTAX = 0x80044013L +WBEMMOF_E_EXPECTED_CLASS_NAME = 0x80044014L +WBEMMOF_E_TYPE_MISMATCH = 0x80044015L +WBEMMOF_E_EXPECTED_ALIAS_NAME = 0x80044016L +WBEMMOF_E_INVALID_CLASS_DECLARATION = 0x80044017L +WBEMMOF_E_INVALID_INSTANCE_DECLARATION = 0x80044018L +WBEMMOF_E_EXPECTED_DOLLAR = 0x80044019L +WBEMMOF_E_CIMTYPE_QUALIFIER = 0x8004401aL +WBEMMOF_E_DUPLICATE_PROPERTY = 0x8004401bL +WBEMMOF_E_INVALID_NAMESPACE_SPECIFICATION = 0x8004401cL +WBEMMOF_E_OUT_OF_RANGE = 0x8004401dL +WBEMMOF_E_INVALID_FILE = 0x8004401eL +WBEMMOF_E_ALIASES_IN_EMBEDDED = 0x8004401fL +WBEMMOF_E_NULL_ARRAY_ELEM = 0x80044020L +WBEMMOF_E_DUPLICATE_QUALIFIER = 0x80044021L +WBEMMOF_E_EXPECTED_FLAVOR_TYPE = 0x80044022L +WBEMMOF_E_INCOMPATIBLE_FLAVOR_TYPES = 0x80044023L +WBEMMOF_E_MULTIPLE_ALIASES = 0x80044024L +WBEMMOF_E_INCOMPATIBLE_FLAVOR_TYPES2 = 0x80044025L +WBEMMOF_E_NO_ARRAYS_RETURNED = 0x80044026L +WBEMMOF_E_MUST_BE_IN_OR_OUT = 0x80044027L +WBEMMOF_E_INVALID_FLAGS_SYNTAX = 0x80044028L +WBEMMOF_E_EXPECTED_BRACE_OR_BAD_TYPE = 0x80044029L +WBEMMOF_E_UNSUPPORTED_CIMV22_QUAL_VALUE = 0x8004402aL +WBEMMOF_E_UNSUPPORTED_CIMV22_DATA_TYPE = 0x8004402bL +WBEMMOF_E_INVALID_DELETEINSTANCE_SYNTAX = 0x8004402cL +WBEMMOF_E_INVALID_QUALIFIER_SYNTAX = 0x8004402dL +WBEMMOF_E_QUALIFIER_USED_OUTSIDE_SCOPE = 0x8004402eL +WBEMMOF_E_ERROR_CREATING_TEMP_FILE = 0x8004402fL +WBEMMOF_E_ERROR_INVALID_INCLUDE_FILE = 0x80044030L +WBEMMOF_E_INVALID_DELETECLASS_SYNTAX = 0x80044031L + +# Enum tagCLSCTX definitions +tagCLSCTX = DWORD +CLSCTX = tagCLSCTX + +CLSCTX_INPROC_SERVER = 0x1 +CLSCTX_INPROC_HANDLER = 0x2 +CLSCTX_LOCAL_SERVER = 0x4 +CLSCTX_INPROC_SERVER16 = 0x8 +CLSCTX_REMOTE_SERVER = 0x10 +CLSCTX_INPROC_HANDLER16 = 0x20 +CLSCTX_RESERVED1 = 0x40 +CLSCTX_RESERVED2 = 0x80 +CLSCTX_RESERVED3 = 0x100 +CLSCTX_RESERVED4 = 0x200 +CLSCTX_NO_CODE_DOWNLOAD = 0x400 +CLSCTX_RESERVED5 = 0x800 +CLSCTX_NO_CUSTOM_MARSHAL = 0x1000 +CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000 +CLSCTX_NO_FAILURE_LOG = 0x4000 +CLSCTX_DISABLE_AAA = 0x8000 +CLSCTX_ENABLE_AAA = 0x10000 +CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000 +CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000 +CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000 +CLSCTX_ENABLE_CLOAKING = 0x100000 +CLSCTX_APPCONTAINER = 0x400000 +CLSCTX_ACTIVATE_AAA_AS_IU = 0x800000 +CLSCTX_PS_DLL = 0x80000000L + # Enum _IMAGEHLP_SYMBOL_TYPE_INFO definitions _IMAGEHLP_SYMBOL_TYPE_INFO = DWORD IMAGEHLP_SYMBOL_TYPE_INFO = _IMAGEHLP_SYMBOL_TYPE_INFO @@ -449,6 +680,15 @@ PROCESSINFOCLASS = _PROCESSINFOCLASS ProcessBasicInformation = 0x0 ProcessWow64Information = 0x1a +# Enum tagCOINIT definitions +tagCOINIT = DWORD +COINIT = tagCOINIT + +COINIT_APARTMENTTHREADED = 0x2 +COINIT_MULTITHREADED = 0x0 +COINIT_DISABLE_OLE1DDE = 0x4 +COINIT_SPEED_OVER_MEMORY = 0x8 + # Enum tagTYPEKIND definitions tagTYPEKIND = DWORD TYPEKIND = tagTYPEKIND @@ -1697,9 +1937,10 @@ class _GUID(Structure): ("Data1", ULONG), ("Data2", USHORT), ("Data3", USHORT), - ("Data4", UCHAR * 8), + ("Data4", BYTE * 8), ] IID = _GUID +REFCLSID = POINTER(_GUID) GUID = _GUID REFIID = POINTER(_GUID) @@ -1786,7 +2027,7 @@ class TMP_variant_sub_union(Union): ("pullVal", POINTER(ULONGLONG)), ("pintVal", POINTER(INT)), ("puintVal", POINTER(UINT)), - ("__VARIANT_NAME_4", _tagBRECORD), + ("_VARIANT_NAME_4", _tagBRECORD), ] # Struct __tagVARIANT definitions @@ -1796,7 +2037,7 @@ class __tagVARIANT(Structure): ("wReserved1", WORD), ("wReserved2", WORD), ("wReserved3", WORD), - ("__VARIANT_NAME_3", TMP_variant_sub_union), + ("_VARIANT_NAME_3", TMP_variant_sub_union), ] LPVARIANTARG = POINTER(__tagVARIANT) VARIANTARG = __tagVARIANT @@ -2542,3 +2783,14 @@ class _EVENTLOGRECORD(Structure): PEVENTLOGRECORD = POINTER(_EVENTLOGRECORD) EVENTLOGRECORD = _EVENTLOGRECORD +# Struct tagSOLE_AUTHENTICATION_SERVICE definitions +class tagSOLE_AUTHENTICATION_SERVICE(Structure): + _fields_ = [ + ("dwAuthnSvc", DWORD), + ("dwAuthzSvc", DWORD), + ("pPrincipalName", POINTER(OLECHAR)), + ("hr", HRESULT), + ] +PSOLE_AUTHENTICATION_SERVICE = POINTER(tagSOLE_AUTHENTICATION_SERVICE) +SOLE_AUTHENTICATION_SERVICE = tagSOLE_AUTHENTICATION_SERVICE + diff --git a/windows/winobject/wmi.py b/windows/winobject/wmi.py index 7e3d33e..7c84408 100644 --- a/windows/winobject/wmi.py +++ b/windows/winobject/wmi.py @@ -4,50 +4,15 @@ import struct import functools from ctypes.wintypes import * + +import windows.com from windows.generated_def.winstructs import * -from windows.simple_com import get_IID_from_raw, COMInterface +from windows.generated_def.interfaces import IWbemLocator, IWbemServices, IEnumWbemClassObject, IWbemClassObject -CLSID_WbemAdministrativeLocator_raw = 0xcb8555cc, 0x9128, 0x11d1, 0xad, 0x9b, 0x00, 0xc0, 0x4f, 0xd8, 0x0fd, 0xff -CLSID_WbemAdministrativeLocator_IID = get_IID_from_raw(CLSID_WbemAdministrativeLocator_raw) - -IID_IWbemLocator_raw = 0x0DC12A687, 0x737F, 0x11CF, 0x88, 0x4d, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24 -IID_IWbemLocator= get_IID_from_raw(IID_IWbemLocator_raw) - -BSTR = ctypes.c_wchar_p - -class IWbemLocator(COMInterface): - _functions_ = { - "ConnectServer": ctypes.WINFUNCTYPE(HRESULT, ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_wchar_p, - ctypes.c_long, ctypes.c_wchar_p, ctypes.c_void_p, POINTER(ctypes.c_void_p))(3, "ConnectServer") - } - - -class IWbemServices(COMInterface): - _functions_ = { - "ExecQuery": ctypes.WINFUNCTYPE(HRESULT, ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_long, ctypes.c_void_p, POINTER(ctypes.c_void_p))(20, "ExecQuery") - } - - -class IEnumWbemClassObject(COMInterface): - _functions_ = { - "Next": ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.c_ulong, POINTER(ctypes.c_void_p), POINTER(ctypes.c_long))(4, "Next") - } - - -class IWbemClassObject(COMInterface): - _functions_ = { - "Get": ctypes.WINFUNCTYPE(HRESULT, ctypes.c_wchar_p, ctypes.c_long, ctypes.c_void_p, ctypes.c_void_p, POINTER(ctypes.c_long))(4, "Get"), - "GetNames": ctypes.WINFUNCTYPE(HRESULT, ctypes.c_wchar_p, ctypes.c_long, ctypes.c_void_p, POINTER(ctypes.c_void_p))(7, "GetNames") - } - - -class _tagBRECORD(ctypes.Structure): - _fields_ = [("pvRecord", PVOID), ("pRecInfo", PVOID)] - - -class SAFEARRAY(windows.generated_def.winstructs.SAFEARRAY): +CLSID_WbemAdministrativeLocator_IID = windows.com.IID.from_string('CB8555CC-9128-11D1-AD9B-00C04FD8FDFF') +class ImprovedSAFEARRAY(windows.generated_def.winstructs.SAFEARRAY): @classmethod def of_type(cls, addr, t): self = cls.from_address(addr) @@ -71,38 +36,19 @@ class SAFEARRAY(windows.generated_def.winstructs.SAFEARRAY): return data -class SimpleVariantData(ctypes.Union): - _fields_ = [("llVal", LONGLONG), - ("lVal", LONG), - ("bVal", BYTE), - ("iVal", SHORT), - ("fltVal", FLOAT), - ("dblVal", DOUBLE), - ("bstrVal", BSTR), - ("pbstrVal", POINTER(BSTR)), - ("byref", PVOID), - ("parray", POINTER(SAFEARRAY)), - ("pbyref", PVOID), - ("ullVal", ULONGLONG), - ("llVal", LONGLONG), - ("__VARIANT_NAME_4", _tagBRECORD)] - - -# TODO: put real struct in winstruct (need a real parser for generation) -class SimpleVariant(ctypes.Structure): - _fields_ = [("vt", WORD), ("wReserved1", WORD), ("wReserved2", WORD), ("wReserved3", WORD), ("_Data", SimpleVariantData)] - +class ImprovedVariant(VARIANT): @property def asbstr(self): if self.vt != VT_BSTR: raise ValueError("asbstr on non-bstr variant") - return self._Data.bstrVal + #import pdb;pdb.set_trace() + return self._VARIANT_NAME_3.bstrVal @property def aslong(self): if not self.vt in [VT_I4, VT_BOOL]: raise ValueError("aslong on non-long variant") - return self._Data.lVal + return self._VARIANT_NAME_3.lVal @property def asbool(self): @@ -120,21 +66,13 @@ class WmiRequester(object): return cls.INSTANCE def __init__(self): - if hasattr(self, "initializiated"): - return - locator = IWbemLocator() service = IWbemServices() - # TODO: puts those in winproxy with a real error check and wrapper - assert ctypes.windll.ole32.CoInitializeEx(0, 0) == 0, "CoInitializeEx" - assert ctypes.windll.ole32.CoInitializeSecurity(0, -1, 0,0, 0, 3, 0,0,0) == 0, "CoInitializeSecurity" - assert ctypes.windll.ole32.CoCreateInstance(CLSID_WbemAdministrativeLocator_IID, 0, 1, IID_IWbemLocator, ctypes.byref(locator)) == 0, "CoCreateInstance" - + windows.com.init() + windows.com.create_instance(CLSID_WbemAdministrativeLocator_IID, locator) locator.ConnectServer("root\\cimv2", None, None , None, 0x80, None, None, ctypes.byref(service)) self.service = service - self.initializiated = True - def select(self, frm, attrs="*"): """Select `attrs` from ``frm`` @@ -142,19 +80,24 @@ class WmiRequester(object): :rtype: list of dict """ enumerator = IEnumWbemClassObject() - self.service.ExecQuery("WQL", "select * from {0}".format(frm), 0x20, 0, ctypes.byref(enumerator)) + try: + self.service.ExecQuery("WQL", "select * from {0}".format(frm), 0x20, 0, ctypes.byref(enumerator)) + except WindowsError as e: + if (e.winerror & 0xffffffff) == WBEM_E_INVALID_CLASS: + raise WindowsError(e.winerror, 'WBEM_E_INVALID_CLASS '.format(frm)) + raise - count = ctypes.c_long(0) + count = ctypes.c_ulong(0) processor = IWbemClassObject() res = [] enumerator.Next(0xffffffff, 1, ctypes.byref(processor), ctypes.byref(count)) while count.value: current_res = {} - variant_res = SimpleVariant() + variant_res = ImprovedVariant() if attrs == "*": attrs = [x for x in self.get_names(processor) if not x.startswith("__")] for name in attrs: - processor.Get(name, 0, ctypes.byref(variant_res), 0, None) + processor.Get(name, 0, ctypes.byref(variant_res), None, None) # TODO: something clean and generic if variant_res.vt & VT_ARRAY: if variant_res.vt & VT_TYPEMASK == VT_BSTR: @@ -176,6 +119,8 @@ class WmiRequester(object): return res def get_names(self, processor): - res = PVOID() - processor.GetNames(None, 0, None, res) - return SAFEARRAY.of_type(res.value, BSTR).to_list() \ No newline at end of file + res = POINTER(SAFEARRAY)() + processor.GetNames(None, 0, None, byref(res)) + safe_array = ctypes.cast(res, POINTER(ImprovedSAFEARRAY))[0] + safe_array.elt_type = BSTR + return safe_array.to_list() \ No newline at end of file diff --git a/windows/winproxy.py b/windows/winproxy.py index f94211b..bb4f9e4 100644 --- a/windows/winproxy.py +++ b/windows/winproxy.py @@ -916,4 +916,21 @@ def VerQueryValueA(pBlock, lpSubBlock, lplpBuffer, puLen): @VersionProxy("VerQueryValueW") def VerQueryValueW(pBlock, lpSubBlock, lplpBuffer, puLen): - return VerQueryValueW.ctypes_function(pBlock, lpSubBlock, lplpBuffer, puLen) \ No newline at end of file + return VerQueryValueW.ctypes_function(pBlock, lpSubBlock, lplpBuffer, puLen) + + +# ## Ole32Proxy (COM STUFF) ## # + +@Ole32Proxy('CoInitializeEx', no_error_check) +def CoInitializeEx(pvReserved=None, dwCoInit=COINIT_MULTITHREADED): + return CoInitializeEx.ctypes_function(pvReserved, dwCoInit) + + +@Ole32Proxy('CoInitializeSecurity') +def CoInitializeSecurity(pSecDesc, cAuthSvc, asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pAuthList, dwCapabilities, pReserved3): + return CoInitializeSecurity.ctypes_function(pSecDesc, cAuthSvc, asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pAuthList, dwCapabilities, pReserved3) + + +@Ole32Proxy('CoCreateInstance') +def CoCreateInstance(rclsid, pUnkOuter=None, dwClsContext=CLSCTX_INPROC_SERVER, riid=NeededParameter, ppv=NeededParameter): + return CoCreateInstance.ctypes_function(rclsid, pUnkOuter, dwClsContext, riid, ppv)