id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
177,372
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegEnumKeyW(hKey, dwIndex): _RegEnumKeyW = windll.advapi32.RegEnumKeyW _RegEnumKeyW.argtypes = [HKEY, DWORD, LPWSTR, DWORD] _RegEnumKeyW.restype = LONG cchName = 512 while True: lpName = ctypes.create_unicode_buffer(cchName) errcode = _RegEnumKeyW(hKey, dwIndex, lpName, cchName * 2) if errcode != ERROR_MORE_DATA: break cchName = cchName + 512 if cchName > 32768: raise ctypes.WinError(errcode) if errcode == ERROR_NO_MORE_ITEMS: return None if errcode != ERROR_SUCCESS: raise ctypes.WinError(errcode) return lpName.value
null
177,373
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteValueA(hKeySrc, lpValueName = None): _RegDeleteValueA = windll.advapi32.RegDeleteValueA _RegDeleteValueA.argtypes = [HKEY, LPSTR] _RegDeleteValueA.restype = LONG _RegDeleteValueA.errcheck = RaiseIfNotErrorSuccess _RegDeleteValueA(hKeySrc, lpValueName)
null
177,374
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteValueW(hKeySrc, lpValueName = None): _RegDeleteValueW = windll.advapi32.RegDeleteValueW _RegDeleteValueW.argtypes = [HKEY, LPWSTR] _RegDeleteValueW.restype = LONG _RegDeleteValueW.errcheck = RaiseIfNotErrorSuccess _RegDeleteValueW(hKeySrc, lpValueName)
null
177,375
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteKeyValueA(hKeySrc, lpSubKey = None, lpValueName = None): _RegDeleteKeyValueA = windll.advapi32.RegDeleteKeyValueA _RegDeleteKeyValueA.argtypes = [HKEY, LPSTR, LPSTR] _RegDeleteKeyValueA.restype = LONG _RegDeleteKeyValueA.errcheck = RaiseIfNotErrorSuccess _RegDeleteKeyValueA(hKeySrc, lpSubKey, lpValueName)
null
177,376
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteKeyValueW(hKeySrc, lpSubKey = None, lpValueName = None): _RegDeleteKeyValueW = windll.advapi32.RegDeleteKeyValueW _RegDeleteKeyValueW.argtypes = [HKEY, LPWSTR, LPWSTR] _RegDeleteKeyValueW.restype = LONG _RegDeleteKeyValueW.errcheck = RaiseIfNotErrorSuccess _RegDeleteKeyValueW(hKeySrc, lpSubKey, lpValueName)
null
177,377
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteKeyA(hKeySrc, lpSubKey = None): _RegDeleteKeyA = windll.advapi32.RegDeleteKeyA _RegDeleteKeyA.argtypes = [HKEY, LPSTR] _RegDeleteKeyA.restype = LONG _RegDeleteKeyA.errcheck = RaiseIfNotErrorSuccess _RegDeleteKeyA(hKeySrc, lpSubKey)
null
177,378
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteKeyW(hKeySrc, lpSubKey = None): _RegDeleteKeyW = windll.advapi32.RegDeleteKeyW _RegDeleteKeyW.argtypes = [HKEY, LPWSTR] _RegDeleteKeyW.restype = LONG _RegDeleteKeyW.errcheck = RaiseIfNotErrorSuccess _RegDeleteKeyW(hKeySrc, lpSubKey)
null
177,379
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * KEY_WOW64_32KEY = 0x0200 def RegDeleteKeyExA(hKeySrc, lpSubKey = None, samDesired = KEY_WOW64_32KEY): _RegDeleteKeyExA = windll.advapi32.RegDeleteKeyExA _RegDeleteKeyExA.argtypes = [HKEY, LPSTR, REGSAM, DWORD] _RegDeleteKeyExA.restype = LONG _RegDeleteKeyExA.errcheck = RaiseIfNotErrorSuccess _RegDeleteKeyExA(hKeySrc, lpSubKey, samDesired, 0)
null
177,380
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * KEY_WOW64_32KEY = 0x0200 def RegDeleteKeyExW(hKeySrc, lpSubKey = None, samDesired = KEY_WOW64_32KEY): _RegDeleteKeyExW = windll.advapi32.RegDeleteKeyExW _RegDeleteKeyExW.argtypes = [HKEY, LPWSTR, REGSAM, DWORD] _RegDeleteKeyExW.restype = LONG _RegDeleteKeyExW.errcheck = RaiseIfNotErrorSuccess _RegDeleteKeyExW(hKeySrc, lpSubKey, samDesired, 0)
null
177,381
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegCopyTreeA(hKeySrc, lpSubKey, hKeyDest): _RegCopyTreeA = windll.advapi32.RegCopyTreeA _RegCopyTreeA.argtypes = [HKEY, LPSTR, HKEY] _RegCopyTreeA.restype = LONG _RegCopyTreeA.errcheck = RaiseIfNotErrorSuccess _RegCopyTreeA(hKeySrc, lpSubKey, hKeyDest)
null
177,382
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegCopyTreeW(hKeySrc, lpSubKey, hKeyDest): _RegCopyTreeW = windll.advapi32.RegCopyTreeW _RegCopyTreeW.argtypes = [HKEY, LPWSTR, HKEY] _RegCopyTreeW.restype = LONG _RegCopyTreeW.errcheck = RaiseIfNotErrorSuccess _RegCopyTreeW(hKeySrc, lpSubKey, hKeyDest)
null
177,383
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteTreeA(hKey, lpSubKey = None): _RegDeleteTreeA = windll.advapi32.RegDeleteTreeA _RegDeleteTreeA.argtypes = [HKEY, LPWSTR] _RegDeleteTreeA.restype = LONG _RegDeleteTreeA.errcheck = RaiseIfNotErrorSuccess _RegDeleteTreeA(hKey, lpSubKey)
null
177,384
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegDeleteTreeW(hKey, lpSubKey = None): _RegDeleteTreeW = windll.advapi32.RegDeleteTreeW _RegDeleteTreeW.argtypes = [HKEY, LPWSTR] _RegDeleteTreeW.restype = LONG _RegDeleteTreeW.errcheck = RaiseIfNotErrorSuccess _RegDeleteTreeW(hKey, lpSubKey)
null
177,385
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def RegFlushKey(hKey): _RegFlushKey = windll.advapi32.RegFlushKey _RegFlushKey.argtypes = [HKEY] _RegFlushKey.restype = LONG _RegFlushKey.errcheck = RaiseIfNotErrorSuccess _RegFlushKey(hKey)
null
177,386
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def CloseServiceHandle(hSCObject): _CloseServiceHandle = windll.advapi32.CloseServiceHandle _CloseServiceHandle.argtypes = [SC_HANDLE] _CloseServiceHandle.restype = bool _CloseServiceHandle.errcheck = RaiseIfZero if isinstance(hSCObject, Handle): # Prevents the handle from being closed without notifying the Handle object. hSCObject.close() else: _CloseServiceHandle(hSCObject)
null
177,387
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SC_MANAGER_ALL_ACCESS = 0xF003F class ServiceControlManagerHandle (UserModeHandle): """ Service Control Manager (SCM) handle. """ _TYPE = SC_HANDLE def _close(self): CloseServiceHandle(self.value) def OpenSCManagerA(lpMachineName = None, lpDatabaseName = None, dwDesiredAccess = SC_MANAGER_ALL_ACCESS): _OpenSCManagerA = windll.advapi32.OpenSCManagerA _OpenSCManagerA.argtypes = [LPSTR, LPSTR, DWORD] _OpenSCManagerA.restype = SC_HANDLE _OpenSCManagerA.errcheck = RaiseIfZero hSCObject = _OpenSCManagerA(lpMachineName, lpDatabaseName, dwDesiredAccess) return ServiceControlManagerHandle(hSCObject)
null
177,388
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SC_MANAGER_ALL_ACCESS = 0xF003F class ServiceControlManagerHandle (UserModeHandle): """ Service Control Manager (SCM) handle. """ _TYPE = SC_HANDLE def _close(self): CloseServiceHandle(self.value) def OpenSCManagerW(lpMachineName = None, lpDatabaseName = None, dwDesiredAccess = SC_MANAGER_ALL_ACCESS): _OpenSCManagerW = windll.advapi32.OpenSCManagerW _OpenSCManagerW.argtypes = [LPWSTR, LPWSTR, DWORD] _OpenSCManagerW.restype = SC_HANDLE _OpenSCManagerW.errcheck = RaiseIfZero hSCObject = _OpenSCManagerA(lpMachineName, lpDatabaseName, dwDesiredAccess) return ServiceControlManagerHandle(hSCObject)
null
177,389
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SERVICE_ALL_ACCESS = 0xF01FF class ServiceHandle (UserModeHandle): """ Service handle. """ _TYPE = SC_HANDLE def _close(self): CloseServiceHandle(self.value) def OpenServiceA(hSCManager, lpServiceName, dwDesiredAccess = SERVICE_ALL_ACCESS): _OpenServiceA = windll.advapi32.OpenServiceA _OpenServiceA.argtypes = [SC_HANDLE, LPSTR, DWORD] _OpenServiceA.restype = SC_HANDLE _OpenServiceA.errcheck = RaiseIfZero return ServiceHandle( _OpenServiceA(hSCManager, lpServiceName, dwDesiredAccess) )
null
177,390
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SERVICE_ALL_ACCESS = 0xF01FF class ServiceHandle (UserModeHandle): """ Service handle. """ _TYPE = SC_HANDLE def _close(self): CloseServiceHandle(self.value) def OpenServiceW(hSCManager, lpServiceName, dwDesiredAccess = SERVICE_ALL_ACCESS): _OpenServiceW = windll.advapi32.OpenServiceW _OpenServiceW.argtypes = [SC_HANDLE, LPWSTR, DWORD] _OpenServiceW.restype = SC_HANDLE _OpenServiceW.errcheck = RaiseIfZero return ServiceHandle( _OpenServiceW(hSCManager, lpServiceName, dwDesiredAccess) )
null
177,391
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SERVICE_ALL_ACCESS = 0xF01FF SERVICE_DEMAND_START = 0x00000003 SERVICE_ERROR_NORMAL = 0x00000001 SERVICE_WIN32_OWN_PROCESS = 0x00000010 class ServiceHandle (UserModeHandle): """ Service handle. """ _TYPE = SC_HANDLE def _close(self): CloseServiceHandle(self.value) def CreateServiceA(hSCManager, lpServiceName, lpDisplayName = None, dwDesiredAccess = SERVICE_ALL_ACCESS, dwServiceType = SERVICE_WIN32_OWN_PROCESS, dwStartType = SERVICE_DEMAND_START, dwErrorControl = SERVICE_ERROR_NORMAL, lpBinaryPathName = None, lpLoadOrderGroup = None, lpDependencies = None, lpServiceStartName = None, lpPassword = None): _CreateServiceA = windll.advapi32.CreateServiceA _CreateServiceA.argtypes = [SC_HANDLE, LPSTR, LPSTR, DWORD, DWORD, DWORD, DWORD, LPSTR, LPSTR, LPDWORD, LPSTR, LPSTR, LPSTR] _CreateServiceA.restype = SC_HANDLE _CreateServiceA.errcheck = RaiseIfZero dwTagId = DWORD(0) hService = _CreateServiceA(hSCManager, lpServiceName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, byref(dwTagId), lpDependencies, lpServiceStartName, lpPassword) return ServiceHandle(hService), dwTagId.value
null
177,392
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SERVICE_ALL_ACCESS = 0xF01FF SERVICE_DEMAND_START = 0x00000003 SERVICE_ERROR_NORMAL = 0x00000001 SERVICE_WIN32_OWN_PROCESS = 0x00000010 class ServiceHandle (UserModeHandle): """ Service handle. """ _TYPE = SC_HANDLE def _close(self): CloseServiceHandle(self.value) def CreateServiceW(hSCManager, lpServiceName, lpDisplayName = None, dwDesiredAccess = SERVICE_ALL_ACCESS, dwServiceType = SERVICE_WIN32_OWN_PROCESS, dwStartType = SERVICE_DEMAND_START, dwErrorControl = SERVICE_ERROR_NORMAL, lpBinaryPathName = None, lpLoadOrderGroup = None, lpDependencies = None, lpServiceStartName = None, lpPassword = None): _CreateServiceW = windll.advapi32.CreateServiceW _CreateServiceW.argtypes = [SC_HANDLE, LPWSTR, LPWSTR, DWORD, DWORD, DWORD, DWORD, LPWSTR, LPWSTR, LPDWORD, LPWSTR, LPWSTR, LPWSTR] _CreateServiceW.restype = SC_HANDLE _CreateServiceW.errcheck = RaiseIfZero dwTagId = DWORD(0) hService = _CreateServiceW(hSCManager, lpServiceName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, byref(dwTagId), lpDependencies, lpServiceStartName, lpPassword) return ServiceHandle(hService), dwTagId.value
null
177,393
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def DeleteService(hService): _DeleteService = windll.advapi32.DeleteService _DeleteService.argtypes = [SC_HANDLE] _DeleteService.restype = bool _DeleteService.errcheck = RaiseIfZero _DeleteService(hService)
null
177,394
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def GetServiceKeyNameA(hSCManager, lpDisplayName): _GetServiceKeyNameA = windll.advapi32.GetServiceKeyNameA _GetServiceKeyNameA.argtypes = [SC_HANDLE, LPSTR, LPSTR, LPDWORD] _GetServiceKeyNameA.restype = bool cchBuffer = DWORD(0) _GetServiceKeyNameA(hSCManager, lpDisplayName, None, byref(cchBuffer)) if cchBuffer.value == 0: raise ctypes.WinError() lpServiceName = ctypes.create_string_buffer(cchBuffer.value + 1) cchBuffer.value = sizeof(lpServiceName) success = _GetServiceKeyNameA(hSCManager, lpDisplayName, lpServiceName, byref(cchBuffer)) if not success: raise ctypes.WinError() return lpServiceName.value
null
177,395
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def GetServiceKeyNameW(hSCManager, lpDisplayName): _GetServiceKeyNameW = windll.advapi32.GetServiceKeyNameW _GetServiceKeyNameW.argtypes = [SC_HANDLE, LPWSTR, LPWSTR, LPDWORD] _GetServiceKeyNameW.restype = bool cchBuffer = DWORD(0) _GetServiceKeyNameW(hSCManager, lpDisplayName, None, byref(cchBuffer)) if cchBuffer.value == 0: raise ctypes.WinError() lpServiceName = ctypes.create_unicode_buffer(cchBuffer.value + 2) cchBuffer.value = sizeof(lpServiceName) success = _GetServiceKeyNameW(hSCManager, lpDisplayName, lpServiceName, byref(cchBuffer)) if not success: raise ctypes.WinError() return lpServiceName.value
null
177,396
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def GetServiceDisplayNameA(hSCManager, lpServiceName): _GetServiceDisplayNameA = windll.advapi32.GetServiceDisplayNameA _GetServiceDisplayNameA.argtypes = [SC_HANDLE, LPSTR, LPSTR, LPDWORD] _GetServiceDisplayNameA.restype = bool cchBuffer = DWORD(0) _GetServiceDisplayNameA(hSCManager, lpServiceName, None, byref(cchBuffer)) if cchBuffer.value == 0: raise ctypes.WinError() lpDisplayName = ctypes.create_string_buffer(cchBuffer.value + 1) cchBuffer.value = sizeof(lpDisplayName) success = _GetServiceDisplayNameA(hSCManager, lpServiceName, lpDisplayName, byref(cchBuffer)) if not success: raise ctypes.WinError() return lpDisplayName.value
null
177,397
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def GetServiceDisplayNameW(hSCManager, lpServiceName): _GetServiceDisplayNameW = windll.advapi32.GetServiceDisplayNameW _GetServiceDisplayNameW.argtypes = [SC_HANDLE, LPWSTR, LPWSTR, LPDWORD] _GetServiceDisplayNameW.restype = bool cchBuffer = DWORD(0) _GetServiceDisplayNameW(hSCManager, lpServiceName, None, byref(cchBuffer)) if cchBuffer.value == 0: raise ctypes.WinError() lpDisplayName = ctypes.create_unicode_buffer(cchBuffer.value + 2) cchBuffer.value = sizeof(lpDisplayName) success = _GetServiceDisplayNameW(hSCManager, lpServiceName, lpDisplayName, byref(cchBuffer)) if not success: raise ctypes.WinError() return lpDisplayName.value
null
177,398
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def StartServiceA(hService, ServiceArgVectors = None): _StartServiceA = windll.advapi32.StartServiceA _StartServiceA.argtypes = [SC_HANDLE, DWORD, LPVOID] _StartServiceA.restype = bool _StartServiceA.errcheck = RaiseIfZero if ServiceArgVectors: dwNumServiceArgs = len(ServiceArgVectors) CServiceArgVectors = (LPSTR * dwNumServiceArgs)(*ServiceArgVectors) lpServiceArgVectors = ctypes.pointer(CServiceArgVectors) else: dwNumServiceArgs = 0 lpServiceArgVectors = None _StartServiceA(hService, dwNumServiceArgs, lpServiceArgVectors)
null
177,399
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE def StartServiceW(hService, ServiceArgVectors = None): _StartServiceW = windll.advapi32.StartServiceW _StartServiceW.argtypes = [SC_HANDLE, DWORD, LPVOID] _StartServiceW.restype = bool _StartServiceW.errcheck = RaiseIfZero if ServiceArgVectors: dwNumServiceArgs = len(ServiceArgVectors) CServiceArgVectors = (LPWSTR * dwNumServiceArgs)(*ServiceArgVectors) lpServiceArgVectors = ctypes.pointer(CServiceArgVectors) else: dwNumServiceArgs = 0 lpServiceArgVectors = None _StartServiceW(hService, dwNumServiceArgs, lpServiceArgVectors)
null
177,400
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE class SERVICE_STATUS(Structure): _fields_ = [ ("dwServiceType", DWORD), ("dwCurrentState", DWORD), ("dwControlsAccepted", DWORD), ("dwWin32ExitCode", DWORD), ("dwServiceSpecificExitCode", DWORD), ("dwCheckPoint", DWORD), ("dwWaitHint", DWORD), ] LPSERVICE_STATUS = POINTER(SERVICE_STATUS) class ServiceStatus(object): """ Wrapper for the L{SERVICE_STATUS} structure. """ def __init__(self, raw): """ """ self.ServiceType = raw.dwServiceType self.CurrentState = raw.dwCurrentState self.ControlsAccepted = raw.dwControlsAccepted self.Win32ExitCode = raw.dwWin32ExitCode self.ServiceSpecificExitCode = raw.dwServiceSpecificExitCode self.CheckPoint = raw.dwCheckPoint self.WaitHint = raw.dwWaitHint def ControlService(hService, dwControl): _ControlService = windll.advapi32.ControlService _ControlService.argtypes = [SC_HANDLE, DWORD, LPSERVICE_STATUS] _ControlService.restype = bool _ControlService.errcheck = RaiseIfZero rawServiceStatus = SERVICE_STATUS() _ControlService(hService, dwControl, byref(rawServiceStatus)) return ServiceStatus(rawServiceStatus)
null
177,401
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE class SERVICE_STATUS(Structure): _fields_ = [ ("dwServiceType", DWORD), ("dwCurrentState", DWORD), ("dwControlsAccepted", DWORD), ("dwWin32ExitCode", DWORD), ("dwServiceSpecificExitCode", DWORD), ("dwCheckPoint", DWORD), ("dwWaitHint", DWORD), ] LPSERVICE_STATUS = POINTER(SERVICE_STATUS) class ServiceStatus(object): """ Wrapper for the L{SERVICE_STATUS} structure. """ def __init__(self, raw): """ """ self.ServiceType = raw.dwServiceType self.CurrentState = raw.dwCurrentState self.ControlsAccepted = raw.dwControlsAccepted self.Win32ExitCode = raw.dwWin32ExitCode self.ServiceSpecificExitCode = raw.dwServiceSpecificExitCode self.CheckPoint = raw.dwCheckPoint self.WaitHint = raw.dwWaitHint def QueryServiceStatus(hService): _QueryServiceStatus = windll.advapi32.QueryServiceStatus _QueryServiceStatus.argtypes = [SC_HANDLE, LPSERVICE_STATUS] _QueryServiceStatus.restype = bool _QueryServiceStatus.errcheck = RaiseIfZero rawServiceStatus = SERVICE_STATUS() _QueryServiceStatus(hService, byref(rawServiceStatus)) return ServiceStatus(rawServiceStatus)
null
177,402
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SC_STATUS_TYPE = ctypes.c_int SC_STATUS_PROCESS_INFO = 0 class SERVICE_STATUS_PROCESS(Structure): _fields_ = SERVICE_STATUS._fields_ + [ ("dwProcessId", DWORD), ("dwServiceFlags", DWORD), ] class ServiceStatusProcess(object): """ Wrapper for the L{SERVICE_STATUS_PROCESS} structure. """ def __init__(self, raw): """ """ self.ServiceType = raw.dwServiceType self.CurrentState = raw.dwCurrentState self.ControlsAccepted = raw.dwControlsAccepted self.Win32ExitCode = raw.dwWin32ExitCode self.ServiceSpecificExitCode = raw.dwServiceSpecificExitCode self.CheckPoint = raw.dwCheckPoint self.WaitHint = raw.dwWaitHint self.ProcessId = raw.dwProcessId self.ServiceFlags = raw.dwServiceFlags def QueryServiceStatusEx(hService, InfoLevel = SC_STATUS_PROCESS_INFO): if InfoLevel != SC_STATUS_PROCESS_INFO: raise NotImplementedError() _QueryServiceStatusEx = windll.advapi32.QueryServiceStatusEx _QueryServiceStatusEx.argtypes = [SC_HANDLE, SC_STATUS_TYPE, LPVOID, DWORD, LPDWORD] _QueryServiceStatusEx.restype = bool _QueryServiceStatusEx.errcheck = RaiseIfZero lpBuffer = SERVICE_STATUS_PROCESS() cbBytesNeeded = DWORD(sizeof(lpBuffer)) _QueryServiceStatusEx(hService, InfoLevel, byref(lpBuffer), sizeof(lpBuffer), byref(cbBytesNeeded)) return ServiceStatusProcess(lpBuffer)
null
177,403
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SERVICE_STATE_ALL = 3 SERVICE_DRIVER = 0x0000000B SERVICE_WIN32 = 0x00000030 class ENUM_SERVICE_STATUSA(Structure): LPENUM_SERVICE_STATUSA = POINTER(ENUM_SERVICE_STATUSA) class ServiceStatusEntry(object): def __init__(self, raw): def __str__(self): def EnumServicesStatusA(hSCManager, dwServiceType = SERVICE_DRIVER | SERVICE_WIN32, dwServiceState = SERVICE_STATE_ALL): _EnumServicesStatusA = windll.advapi32.EnumServicesStatusA _EnumServicesStatusA.argtypes = [SC_HANDLE, DWORD, DWORD, LPVOID, DWORD, LPDWORD, LPDWORD, LPDWORD] _EnumServicesStatusA.restype = bool cbBytesNeeded = DWORD(0) ServicesReturned = DWORD(0) ResumeHandle = DWORD(0) _EnumServicesStatusA(hSCManager, dwServiceType, dwServiceState, None, 0, byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle)) Services = [] success = False while GetLastError() == ERROR_MORE_DATA: if cbBytesNeeded.value < sizeof(ENUM_SERVICE_STATUSA): break ServicesBuffer = ctypes.create_string_buffer("", cbBytesNeeded.value) success = _EnumServicesStatusA(hSCManager, dwServiceType, dwServiceState, byref(ServicesBuffer), sizeof(ServicesBuffer), byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle)) if sizeof(ServicesBuffer) < (sizeof(ENUM_SERVICE_STATUSA) * ServicesReturned.value): raise ctypes.WinError() lpServicesArray = ctypes.cast(ctypes.cast(ctypes.pointer(ServicesBuffer), ctypes.c_void_p), LPENUM_SERVICE_STATUSA) for index in compat.xrange(0, ServicesReturned.value): Services.append( ServiceStatusEntry(lpServicesArray[index]) ) if success: break if not success: raise ctypes.WinError() return Services
null
177,404
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SERVICE_STATE_ALL = 3 SERVICE_DRIVER = 0x0000000B SERVICE_WIN32 = 0x00000030 class ENUM_SERVICE_STATUSW(Structure): _fields_ = [ ("lpServiceName", LPWSTR), ("lpDisplayName", LPWSTR), ("ServiceStatus", SERVICE_STATUS), ] LPENUM_SERVICE_STATUSW = POINTER(ENUM_SERVICE_STATUSW) class ServiceStatusEntry(object): """ Service status entry returned by L{EnumServicesStatus}. """ def __init__(self, raw): """ """ self.ServiceName = raw.lpServiceName self.DisplayName = raw.lpDisplayName self.ServiceType = raw.ServiceStatus.dwServiceType self.CurrentState = raw.ServiceStatus.dwCurrentState self.ControlsAccepted = raw.ServiceStatus.dwControlsAccepted self.Win32ExitCode = raw.ServiceStatus.dwWin32ExitCode self.ServiceSpecificExitCode = raw.ServiceStatus.dwServiceSpecificExitCode self.CheckPoint = raw.ServiceStatus.dwCheckPoint self.WaitHint = raw.ServiceStatus.dwWaitHint def __str__(self): output = [] if self.ServiceType & SERVICE_INTERACTIVE_PROCESS: output.append("Interactive service") else: output.append("Service") if self.DisplayName: output.append("\"%s\" (%s)" % (self.DisplayName, self.ServiceName)) else: output.append("\"%s\"" % self.ServiceName) if self.CurrentState == SERVICE_CONTINUE_PENDING: output.append("is about to continue.") elif self.CurrentState == SERVICE_PAUSE_PENDING: output.append("is pausing.") elif self.CurrentState == SERVICE_PAUSED: output.append("is paused.") elif self.CurrentState == SERVICE_RUNNING: output.append("is running.") elif self.CurrentState == SERVICE_START_PENDING: output.append("is starting.") elif self.CurrentState == SERVICE_STOP_PENDING: output.append("is stopping.") elif self.CurrentState == SERVICE_STOPPED: output.append("is stopped.") return " ".join(output) def EnumServicesStatusW(hSCManager, dwServiceType = SERVICE_DRIVER | SERVICE_WIN32, dwServiceState = SERVICE_STATE_ALL): _EnumServicesStatusW = windll.advapi32.EnumServicesStatusW _EnumServicesStatusW.argtypes = [SC_HANDLE, DWORD, DWORD, LPVOID, DWORD, LPDWORD, LPDWORD, LPDWORD] _EnumServicesStatusW.restype = bool cbBytesNeeded = DWORD(0) ServicesReturned = DWORD(0) ResumeHandle = DWORD(0) _EnumServicesStatusW(hSCManager, dwServiceType, dwServiceState, None, 0, byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle)) Services = [] success = False while GetLastError() == ERROR_MORE_DATA: if cbBytesNeeded.value < sizeof(ENUM_SERVICE_STATUSW): break ServicesBuffer = ctypes.create_string_buffer("", cbBytesNeeded.value) success = _EnumServicesStatusW(hSCManager, dwServiceType, dwServiceState, byref(ServicesBuffer), sizeof(ServicesBuffer), byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle)) if sizeof(ServicesBuffer) < (sizeof(ENUM_SERVICE_STATUSW) * ServicesReturned.value): raise ctypes.WinError() lpServicesArray = ctypes.cast(ctypes.cast(ctypes.pointer(ServicesBuffer), ctypes.c_void_p), LPENUM_SERVICE_STATUSW) for index in compat.xrange(0, ServicesReturned.value): Services.append( ServiceStatusEntry(lpServicesArray[index]) ) if success: break if not success: raise ctypes.WinError() return Services
null
177,405
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SC_ENUM_TYPE = ctypes.c_int SC_ENUM_PROCESS_INFO = 0 SERVICE_STATE_ALL = 3 SERVICE_DRIVER = 0x0000000B SERVICE_WIN32 = 0x00000030 class ENUM_SERVICE_STATUS_PROCESSA(Structure): _fields_ = [ ("lpServiceName", LPSTR), ("lpDisplayName", LPSTR), ("ServiceStatusProcess", SERVICE_STATUS_PROCESS), ] LPENUM_SERVICE_STATUS_PROCESSA = POINTER(ENUM_SERVICE_STATUS_PROCESSA) class ServiceStatusProcessEntry(object): """ Service status entry returned by L{EnumServicesStatusEx}. """ def __init__(self, raw): """ """ self.ServiceName = raw.lpServiceName self.DisplayName = raw.lpDisplayName self.ServiceType = raw.ServiceStatusProcess.dwServiceType self.CurrentState = raw.ServiceStatusProcess.dwCurrentState self.ControlsAccepted = raw.ServiceStatusProcess.dwControlsAccepted self.Win32ExitCode = raw.ServiceStatusProcess.dwWin32ExitCode self.ServiceSpecificExitCode = raw.ServiceStatusProcess.dwServiceSpecificExitCode self.CheckPoint = raw.ServiceStatusProcess.dwCheckPoint self.WaitHint = raw.ServiceStatusProcess.dwWaitHint self.ProcessId = raw.ServiceStatusProcess.dwProcessId self.ServiceFlags = raw.ServiceStatusProcess.dwServiceFlags def __str__(self): output = [] if self.ServiceType & SERVICE_INTERACTIVE_PROCESS: output.append("Interactive service ") else: output.append("Service ") if self.DisplayName: output.append("\"%s\" (%s)" % (self.DisplayName, self.ServiceName)) else: output.append("\"%s\"" % self.ServiceName) if self.CurrentState == SERVICE_CONTINUE_PENDING: output.append(" is about to continue") elif self.CurrentState == SERVICE_PAUSE_PENDING: output.append(" is pausing") elif self.CurrentState == SERVICE_PAUSED: output.append(" is paused") elif self.CurrentState == SERVICE_RUNNING: output.append(" is running") elif self.CurrentState == SERVICE_START_PENDING: output.append(" is starting") elif self.CurrentState == SERVICE_STOP_PENDING: output.append(" is stopping") elif self.CurrentState == SERVICE_STOPPED: output.append(" is stopped") if self.ProcessId: output.append(" at process %d" % self.ProcessId) output.append(".") return "".join(output) def EnumServicesStatusExA(hSCManager, InfoLevel = SC_ENUM_PROCESS_INFO, dwServiceType = SERVICE_DRIVER | SERVICE_WIN32, dwServiceState = SERVICE_STATE_ALL, pszGroupName = None): if InfoLevel != SC_ENUM_PROCESS_INFO: raise NotImplementedError() _EnumServicesStatusExA = windll.advapi32.EnumServicesStatusExA _EnumServicesStatusExA.argtypes = [SC_HANDLE, SC_ENUM_TYPE, DWORD, DWORD, LPVOID, DWORD, LPDWORD, LPDWORD, LPDWORD, LPSTR] _EnumServicesStatusExA.restype = bool cbBytesNeeded = DWORD(0) ServicesReturned = DWORD(0) ResumeHandle = DWORD(0) _EnumServicesStatusExA(hSCManager, InfoLevel, dwServiceType, dwServiceState, None, 0, byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle), pszGroupName) Services = [] success = False while GetLastError() == ERROR_MORE_DATA: if cbBytesNeeded.value < sizeof(ENUM_SERVICE_STATUS_PROCESSA): break ServicesBuffer = ctypes.create_string_buffer("", cbBytesNeeded.value) success = _EnumServicesStatusExA(hSCManager, InfoLevel, dwServiceType, dwServiceState, byref(ServicesBuffer), sizeof(ServicesBuffer), byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle), pszGroupName) if sizeof(ServicesBuffer) < (sizeof(ENUM_SERVICE_STATUS_PROCESSA) * ServicesReturned.value): raise ctypes.WinError() lpServicesArray = ctypes.cast(ctypes.cast(ctypes.pointer(ServicesBuffer), ctypes.c_void_p), LPENUM_SERVICE_STATUS_PROCESSA) for index in compat.xrange(0, ServicesReturned.value): Services.append( ServiceStatusProcessEntry(lpServicesArray[index]) ) if success: break if not success: raise ctypes.WinError() return Services
null
177,406
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * SC_HANDLE = HANDLE SC_ENUM_TYPE = ctypes.c_int SC_ENUM_PROCESS_INFO = 0 SERVICE_STATE_ALL = 3 SERVICE_DRIVER = 0x0000000B SERVICE_WIN32 = 0x00000030 class ENUM_SERVICE_STATUS_PROCESSW(Structure): _fields_ = [ ("lpServiceName", LPWSTR), ("lpDisplayName", LPWSTR), ("ServiceStatusProcess", SERVICE_STATUS_PROCESS), ] LPENUM_SERVICE_STATUS_PROCESSW = POINTER(ENUM_SERVICE_STATUS_PROCESSW) class ServiceStatusProcessEntry(object): """ Service status entry returned by L{EnumServicesStatusEx}. """ def __init__(self, raw): """ """ self.ServiceName = raw.lpServiceName self.DisplayName = raw.lpDisplayName self.ServiceType = raw.ServiceStatusProcess.dwServiceType self.CurrentState = raw.ServiceStatusProcess.dwCurrentState self.ControlsAccepted = raw.ServiceStatusProcess.dwControlsAccepted self.Win32ExitCode = raw.ServiceStatusProcess.dwWin32ExitCode self.ServiceSpecificExitCode = raw.ServiceStatusProcess.dwServiceSpecificExitCode self.CheckPoint = raw.ServiceStatusProcess.dwCheckPoint self.WaitHint = raw.ServiceStatusProcess.dwWaitHint self.ProcessId = raw.ServiceStatusProcess.dwProcessId self.ServiceFlags = raw.ServiceStatusProcess.dwServiceFlags def __str__(self): output = [] if self.ServiceType & SERVICE_INTERACTIVE_PROCESS: output.append("Interactive service ") else: output.append("Service ") if self.DisplayName: output.append("\"%s\" (%s)" % (self.DisplayName, self.ServiceName)) else: output.append("\"%s\"" % self.ServiceName) if self.CurrentState == SERVICE_CONTINUE_PENDING: output.append(" is about to continue") elif self.CurrentState == SERVICE_PAUSE_PENDING: output.append(" is pausing") elif self.CurrentState == SERVICE_PAUSED: output.append(" is paused") elif self.CurrentState == SERVICE_RUNNING: output.append(" is running") elif self.CurrentState == SERVICE_START_PENDING: output.append(" is starting") elif self.CurrentState == SERVICE_STOP_PENDING: output.append(" is stopping") elif self.CurrentState == SERVICE_STOPPED: output.append(" is stopped") if self.ProcessId: output.append(" at process %d" % self.ProcessId) output.append(".") return "".join(output) def EnumServicesStatusExW(hSCManager, InfoLevel = SC_ENUM_PROCESS_INFO, dwServiceType = SERVICE_DRIVER | SERVICE_WIN32, dwServiceState = SERVICE_STATE_ALL, pszGroupName = None): _EnumServicesStatusExW = windll.advapi32.EnumServicesStatusExW _EnumServicesStatusExW.argtypes = [SC_HANDLE, SC_ENUM_TYPE, DWORD, DWORD, LPVOID, DWORD, LPDWORD, LPDWORD, LPDWORD, LPWSTR] _EnumServicesStatusExW.restype = bool if InfoLevel != SC_ENUM_PROCESS_INFO: raise NotImplementedError() cbBytesNeeded = DWORD(0) ServicesReturned = DWORD(0) ResumeHandle = DWORD(0) _EnumServicesStatusExW(hSCManager, InfoLevel, dwServiceType, dwServiceState, None, 0, byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle), pszGroupName) Services = [] success = False while GetLastError() == ERROR_MORE_DATA: if cbBytesNeeded.value < sizeof(ENUM_SERVICE_STATUS_PROCESSW): break ServicesBuffer = ctypes.create_string_buffer("", cbBytesNeeded.value) success = _EnumServicesStatusExW(hSCManager, InfoLevel, dwServiceType, dwServiceState, byref(ServicesBuffer), sizeof(ServicesBuffer), byref(cbBytesNeeded), byref(ServicesReturned), byref(ResumeHandle), pszGroupName) if sizeof(ServicesBuffer) < (sizeof(ENUM_SERVICE_STATUS_PROCESSW) * ServicesReturned.value): raise ctypes.WinError() lpServicesArray = ctypes.cast(ctypes.cast(ctypes.pointer(ServicesBuffer), ctypes.c_void_p), LPENUM_SERVICE_STATUS_PROCESSW) for index in compat.xrange(0, ServicesReturned.value): Services.append( ServiceStatusProcessEntry(lpServicesArray[index]) ) if success: break if not success: raise ctypes.WinError() return Services
null
177,407
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import GetLastError, SetLastError def GetDC(hWnd): _GetDC = windll.gdi32.GetDC _GetDC.argtypes = [HWND] _GetDC.restype = HDC _GetDC.errcheck = RaiseIfZero return _GetDC(hWnd)
null
177,408
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import GetLastError, SetLastError def GetWindowDC(hWnd): _GetWindowDC = windll.gdi32.GetWindowDC _GetWindowDC.argtypes = [HWND] _GetWindowDC.restype = HDC _GetWindowDC.errcheck = RaiseIfZero return _GetWindowDC(hWnd)
null
177,409
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import GetLastError, SetLastError def ReleaseDC(hWnd, hDC): _ReleaseDC = windll.gdi32.ReleaseDC _ReleaseDC.argtypes = [HWND, HDC] _ReleaseDC.restype = ctypes.c_int _ReleaseDC.errcheck = RaiseIfZero _ReleaseDC(hWnd, hDC)
null
177,410
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import GetLastError, SetLastError def SelectObject(hdc, hgdiobj): _SelectObject = windll.gdi32.SelectObject _SelectObject.argtypes = [HDC, HGDIOBJ] _SelectObject.restype = HGDIOBJ _SelectObject.errcheck = RaiseIfZero return _SelectObject(hdc, hgdiobj)
null
177,411
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import GetLastError, SetLastError def GetStockObject(fnObject): _GetStockObject = windll.gdi32.GetStockObject _GetStockObject.argtypes = [ctypes.c_int] _GetStockObject.restype = HGDIOBJ _GetStockObject.errcheck = RaiseIfZero return _GetStockObject(fnObject)
null
177,412
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import GetLastError, SetLastError class BITMAP(Structure): _fields_ = [ ("bmType", LONG), ("bmWidth", LONG), ("bmHeight", LONG), ("bmWidthBytes", LONG), ("bmPlanes", WORD), ("bmBitsPixel", WORD), ("bmBits", LPVOID), ] def GetObject(hgdiobj, cbBuffer = None, lpvObject = None): _GetObject = windll.gdi32.GetObject _GetObject.argtypes = [HGDIOBJ, ctypes.c_int, LPVOID] _GetObject.restype = ctypes.c_int _GetObject.errcheck = RaiseIfZero # Both cbBuffer and lpvObject can be omitted, the correct # size and structure to return are automatically deduced. # If lpvObject is given it must be a ctypes object, not a pointer. # Always returns a ctypes object. if cbBuffer is not None: if lpvObject is None: lpvObject = ctypes.create_string_buffer("", cbBuffer) elif lpvObject is not None: cbBuffer = sizeof(lpvObject) else: # most likely case, both are None t = GetObjectType(hgdiobj) if t == OBJ_PEN: cbBuffer = sizeof(LOGPEN) lpvObject = LOGPEN() elif t == OBJ_BRUSH: cbBuffer = sizeof(LOGBRUSH) lpvObject = LOGBRUSH() elif t == OBJ_PAL: cbBuffer = _GetObject(hgdiobj, 0, None) lpvObject = (WORD * (cbBuffer // sizeof(WORD)))() elif t == OBJ_FONT: cbBuffer = sizeof(LOGFONT) lpvObject = LOGFONT() elif t == OBJ_BITMAP: # try the two possible types of bitmap cbBuffer = sizeof(DIBSECTION) lpvObject = DIBSECTION() try: _GetObject(hgdiobj, cbBuffer, byref(lpvObject)) return lpvObject except WindowsError: cbBuffer = sizeof(BITMAP) lpvObject = BITMAP() elif t == OBJ_EXTPEN: cbBuffer = sizeof(LOGEXTPEN) lpvObject = LOGEXTPEN() else: cbBuffer = _GetObject(hgdiobj, 0, None) lpvObject = ctypes.create_string_buffer("", cbBuffer) _GetObject(hgdiobj, cbBuffer, byref(lpvObject)) return lpvObject def GetBitmapBits(hbmp): _GetBitmapBits = windll.gdi32.GetBitmapBits _GetBitmapBits.argtypes = [HBITMAP, LONG, LPVOID] _GetBitmapBits.restype = LONG _GetBitmapBits.errcheck = RaiseIfZero bitmap = GetObject(hbmp, lpvObject = BITMAP()) cbBuffer = bitmap.bmWidthBytes * bitmap.bmHeight lpvBits = ctypes.create_string_buffer("", cbBuffer) _GetBitmapBits(hbmp, cbBuffer, byref(lpvBits)) return lpvBits.raw
null
177,413
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import GetLastError, SetLastError PBITMAP = POINTER(BITMAP) def CreateBitmapIndirect(lpbm): _CreateBitmapIndirect = windll.gdi32.CreateBitmapIndirect _CreateBitmapIndirect.argtypes = [PBITMAP] _CreateBitmapIndirect.restype = HBITMAP _CreateBitmapIndirect.errcheck = RaiseIfZero return _CreateBitmapIndirect(lpbm)
null
177,414
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def IsOS(dwOS): try: _IsOS = windll.shlwapi.IsOS _IsOS.argtypes = [DWORD] _IsOS.restype = bool except AttributeError: # According to MSDN, on Windows versions prior to Vista # this function is exported only by ordinal number 437. # http://msdn.microsoft.com/en-us/library/bb773795%28VS.85%29.aspx _GetProcAddress = windll.kernel32.GetProcAddress _GetProcAddress.argtypes = [HINSTANCE, DWORD] _GetProcAddress.restype = LPVOID _IsOS = windll.kernel32.GetProcAddress(windll.shlwapi._handle, 437) _IsOS = WINFUNCTYPE(bool, DWORD)(_IsOS) return _IsOS(dwOS)
null
177,415
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathAddBackslashA(lpszPath): _PathAddBackslashA = windll.shlwapi.PathAddBackslashA _PathAddBackslashA.argtypes = [LPSTR] _PathAddBackslashA.restype = LPSTR lpszPath = ctypes.create_string_buffer(lpszPath, MAX_PATH) retval = _PathAddBackslashA(lpszPath) if retval == NULL: raise ctypes.WinError() return lpszPath.value
null
177,416
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathAddBackslashW(lpszPath): _PathAddBackslashW = windll.shlwapi.PathAddBackslashW _PathAddBackslashW.argtypes = [LPWSTR] _PathAddBackslashW.restype = LPWSTR lpszPath = ctypes.create_unicode_buffer(lpszPath, MAX_PATH) retval = _PathAddBackslashW(lpszPath) if retval == NULL: raise ctypes.WinError() return lpszPath.value
null
177,417
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathAddExtensionA(lpszPath, pszExtension = None): _PathAddExtensionA = windll.shlwapi.PathAddExtensionA _PathAddExtensionA.argtypes = [LPSTR, LPSTR] _PathAddExtensionA.restype = bool _PathAddExtensionA.errcheck = RaiseIfZero if not pszExtension: pszExtension = None lpszPath = ctypes.create_string_buffer(lpszPath, MAX_PATH) _PathAddExtensionA(lpszPath, pszExtension) return lpszPath.value
null
177,418
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathAddExtensionW(lpszPath, pszExtension = None): _PathAddExtensionW = windll.shlwapi.PathAddExtensionW _PathAddExtensionW.argtypes = [LPWSTR, LPWSTR] _PathAddExtensionW.restype = bool _PathAddExtensionW.errcheck = RaiseIfZero if not pszExtension: pszExtension = None lpszPath = ctypes.create_unicode_buffer(lpszPath, MAX_PATH) _PathAddExtensionW(lpszPath, pszExtension) return lpszPath.value
null
177,419
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathAppendA(lpszPath, pszMore = None): _PathAppendA = windll.shlwapi.PathAppendA _PathAppendA.argtypes = [LPSTR, LPSTR] _PathAppendA.restype = bool _PathAppendA.errcheck = RaiseIfZero if not pszMore: pszMore = None lpszPath = ctypes.create_string_buffer(lpszPath, MAX_PATH) _PathAppendA(lpszPath, pszMore) return lpszPath.value
null
177,420
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathAppendW(lpszPath, pszMore = None): _PathAppendW = windll.shlwapi.PathAppendW _PathAppendW.argtypes = [LPWSTR, LPWSTR] _PathAppendW.restype = bool _PathAppendW.errcheck = RaiseIfZero if not pszMore: pszMore = None lpszPath = ctypes.create_unicode_buffer(lpszPath, MAX_PATH) _PathAppendW(lpszPath, pszMore) return lpszPath.value
null
177,421
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathCombineA(lpszDir, lpszFile): _PathCombineA = windll.shlwapi.PathCombineA _PathCombineA.argtypes = [LPSTR, LPSTR, LPSTR] _PathCombineA.restype = LPSTR lpszDest = ctypes.create_string_buffer("", max(MAX_PATH, len(lpszDir) + len(lpszFile) + 1)) retval = _PathCombineA(lpszDest, lpszDir, lpszFile) if retval == NULL: return None return lpszDest.value
null
177,422
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathCombineW(lpszDir, lpszFile): _PathCombineW = windll.shlwapi.PathCombineW _PathCombineW.argtypes = [LPWSTR, LPWSTR, LPWSTR] _PathCombineW.restype = LPWSTR lpszDest = ctypes.create_unicode_buffer(u"", max(MAX_PATH, len(lpszDir) + len(lpszFile) + 1)) retval = _PathCombineW(lpszDest, lpszDir, lpszFile) if retval == NULL: return None return lpszDest.value
null
177,423
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathCanonicalizeA(lpszSrc): _PathCanonicalizeA = windll.shlwapi.PathCanonicalizeA _PathCanonicalizeA.argtypes = [LPSTR, LPSTR] _PathCanonicalizeA.restype = bool _PathCanonicalizeA.errcheck = RaiseIfZero lpszDst = ctypes.create_string_buffer("", MAX_PATH) _PathCanonicalizeA(lpszDst, lpszSrc) return lpszDst.value
null
177,424
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathCanonicalizeW(lpszSrc): _PathCanonicalizeW = windll.shlwapi.PathCanonicalizeW _PathCanonicalizeW.argtypes = [LPWSTR, LPWSTR] _PathCanonicalizeW.restype = bool _PathCanonicalizeW.errcheck = RaiseIfZero lpszDst = ctypes.create_unicode_buffer(u"", MAX_PATH) _PathCanonicalizeW(lpszDst, lpszSrc) return lpszDst.value
null
177,425
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRelativePathToA(pszFrom = None, dwAttrFrom = FILE_ATTRIBUTE_DIRECTORY, pszTo = None, dwAttrTo = FILE_ATTRIBUTE_DIRECTORY): _PathRelativePathToA = windll.shlwapi.PathRelativePathToA _PathRelativePathToA.argtypes = [LPSTR, LPSTR, DWORD, LPSTR, DWORD] _PathRelativePathToA.restype = bool _PathRelativePathToA.errcheck = RaiseIfZero # Make the paths absolute or the function fails. if pszFrom: pszFrom = GetFullPathNameA(pszFrom)[0] else: pszFrom = GetCurrentDirectoryA() if pszTo: pszTo = GetFullPathNameA(pszTo)[0] else: pszTo = GetCurrentDirectoryA() # Argh, this function doesn't receive an output buffer size! # We'll try to guess the maximum possible buffer size. dwPath = max((len(pszFrom) + len(pszTo)) * 2 + 1, MAX_PATH + 1) pszPath = ctypes.create_string_buffer('', dwPath) # Also, it doesn't set the last error value. # Whoever coded it must have been drunk or tripping on acid. Or both. # The only failure conditions I've seen were invalid paths, paths not # on the same drive, or the path is not absolute. SetLastError(ERROR_INVALID_PARAMETER) _PathRelativePathToA(pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo) return pszPath.value
null
177,426
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRelativePathToW(pszFrom = None, dwAttrFrom = FILE_ATTRIBUTE_DIRECTORY, pszTo = None, dwAttrTo = FILE_ATTRIBUTE_DIRECTORY): _PathRelativePathToW = windll.shlwapi.PathRelativePathToW _PathRelativePathToW.argtypes = [LPWSTR, LPWSTR, DWORD, LPWSTR, DWORD] _PathRelativePathToW.restype = bool _PathRelativePathToW.errcheck = RaiseIfZero # Refer to PathRelativePathToA to know why this code is so ugly. if pszFrom: pszFrom = GetFullPathNameW(pszFrom)[0] else: pszFrom = GetCurrentDirectoryW() if pszTo: pszTo = GetFullPathNameW(pszTo)[0] else: pszTo = GetCurrentDirectoryW() dwPath = max((len(pszFrom) + len(pszTo)) * 2 + 1, MAX_PATH + 1) pszPath = ctypes.create_unicode_buffer(u'', dwPath) SetLastError(ERROR_INVALID_PARAMETER) _PathRelativePathToW(pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo) return pszPath.value
null
177,427
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFileExistsA(pszPath): _PathFileExistsA = windll.shlwapi.PathFileExistsA _PathFileExistsA.argtypes = [LPSTR] _PathFileExistsA.restype = bool return _PathFileExistsA(pszPath)
null
177,428
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFileExistsW(pszPath): _PathFileExistsW = windll.shlwapi.PathFileExistsW _PathFileExistsW.argtypes = [LPWSTR] _PathFileExistsW.restype = bool return _PathFileExistsW(pszPath)
null
177,429
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFindExtensionA(pszPath): _PathFindExtensionA = windll.shlwapi.PathFindExtensionA _PathFindExtensionA.argtypes = [LPSTR] _PathFindExtensionA.restype = LPSTR pszPath = ctypes.create_string_buffer(pszPath) return _PathFindExtensionA(pszPath)
null
177,430
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFindExtensionW(pszPath): _PathFindExtensionW = windll.shlwapi.PathFindExtensionW _PathFindExtensionW.argtypes = [LPWSTR] _PathFindExtensionW.restype = LPWSTR pszPath = ctypes.create_unicode_buffer(pszPath) return _PathFindExtensionW(pszPath)
null
177,431
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFindFileNameA(pszPath): _PathFindFileNameA = windll.shlwapi.PathFindFileNameA _PathFindFileNameA.argtypes = [LPSTR] _PathFindFileNameA.restype = LPSTR pszPath = ctypes.create_string_buffer(pszPath) return _PathFindFileNameA(pszPath)
null
177,432
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFindFileNameW(pszPath): _PathFindFileNameW = windll.shlwapi.PathFindFileNameW _PathFindFileNameW.argtypes = [LPWSTR] _PathFindFileNameW.restype = LPWSTR pszPath = ctypes.create_unicode_buffer(pszPath) return _PathFindFileNameW(pszPath)
null
177,433
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFindNextComponentA(pszPath): _PathFindNextComponentA = windll.shlwapi.PathFindNextComponentA _PathFindNextComponentA.argtypes = [LPSTR] _PathFindNextComponentA.restype = LPSTR pszPath = ctypes.create_string_buffer(pszPath) return _PathFindNextComponentA(pszPath)
null
177,434
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFindNextComponentW(pszPath): _PathFindNextComponentW = windll.shlwapi.PathFindNextComponentW _PathFindNextComponentW.argtypes = [LPWSTR] _PathFindNextComponentW.restype = LPWSTR pszPath = ctypes.create_unicode_buffer(pszPath) return _PathFindNextComponentW(pszPath)
null
177,435
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathFindOnPathA(pszFile, ppszOtherDirs = None): _PathFindOnPathA = windll.shlwapi.PathFindOnPathA _PathFindOnPathA.argtypes = [LPSTR, LPSTR] _PathFindOnPathA.restype = bool pszFile = ctypes.create_string_buffer(pszFile, MAX_PATH) if not ppszOtherDirs: ppszOtherDirs = None else: szArray = "" for pszOtherDirs in ppszOtherDirs: if pszOtherDirs: szArray = "%s%s\0" % (szArray, pszOtherDirs) szArray = szArray + "\0" pszOtherDirs = ctypes.create_string_buffer(szArray) ppszOtherDirs = ctypes.pointer(pszOtherDirs) if _PathFindOnPathA(pszFile, ppszOtherDirs): return pszFile.value return None def PathFindOnPathW(pszFile, ppszOtherDirs = None): _PathFindOnPathW = windll.shlwapi.PathFindOnPathA _PathFindOnPathW.argtypes = [LPWSTR, LPWSTR] _PathFindOnPathW.restype = bool pszFile = ctypes.create_unicode_buffer(pszFile, MAX_PATH) if not ppszOtherDirs: ppszOtherDirs = None else: szArray = u"" for pszOtherDirs in ppszOtherDirs: if pszOtherDirs: szArray = u"%s%s\0" % (szArray, pszOtherDirs) szArray = szArray + u"\0" pszOtherDirs = ctypes.create_unicode_buffer(szArray) ppszOtherDirs = ctypes.pointer(pszOtherDirs) if _PathFindOnPathW(pszFile, ppszOtherDirs): return pszFile.value return None
null
177,436
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathGetArgsA(pszPath): _PathGetArgsA = windll.shlwapi.PathGetArgsA _PathGetArgsA.argtypes = [LPSTR] _PathGetArgsA.restype = LPSTR pszPath = ctypes.create_string_buffer(pszPath) return _PathGetArgsA(pszPath)
null
177,437
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathGetArgsW(pszPath): _PathGetArgsW = windll.shlwapi.PathGetArgsW _PathGetArgsW.argtypes = [LPWSTR] _PathGetArgsW.restype = LPWSTR pszPath = ctypes.create_unicode_buffer(pszPath) return _PathGetArgsW(pszPath)
null
177,438
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsContentTypeA(pszPath, pszContentType): _PathIsContentTypeA = windll.shlwapi.PathIsContentTypeA _PathIsContentTypeA.argtypes = [LPSTR, LPSTR] _PathIsContentTypeA.restype = bool return _PathIsContentTypeA(pszPath, pszContentType)
null
177,439
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsContentTypeW(pszPath, pszContentType): _PathIsContentTypeW = windll.shlwapi.PathIsContentTypeW _PathIsContentTypeW.argtypes = [LPWSTR, LPWSTR] _PathIsContentTypeW.restype = bool return _PathIsContentTypeW(pszPath, pszContentType)
null
177,440
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsDirectoryA(pszPath): _PathIsDirectoryA = windll.shlwapi.PathIsDirectoryA _PathIsDirectoryA.argtypes = [LPSTR] _PathIsDirectoryA.restype = bool return _PathIsDirectoryA(pszPath)
null
177,441
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsDirectoryW(pszPath): _PathIsDirectoryW = windll.shlwapi.PathIsDirectoryW _PathIsDirectoryW.argtypes = [LPWSTR] _PathIsDirectoryW.restype = bool return _PathIsDirectoryW(pszPath)
null
177,442
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsDirectoryEmptyA(pszPath): _PathIsDirectoryEmptyA = windll.shlwapi.PathIsDirectoryEmptyA _PathIsDirectoryEmptyA.argtypes = [LPSTR] _PathIsDirectoryEmptyA.restype = bool return _PathIsDirectoryEmptyA(pszPath)
null
177,443
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsDirectoryEmptyW(pszPath): _PathIsDirectoryEmptyW = windll.shlwapi.PathIsDirectoryEmptyW _PathIsDirectoryEmptyW.argtypes = [LPWSTR] _PathIsDirectoryEmptyW.restype = bool return _PathIsDirectoryEmptyW(pszPath)
null
177,444
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsNetworkPathA(pszPath): _PathIsNetworkPathA = windll.shlwapi.PathIsNetworkPathA _PathIsNetworkPathA.argtypes = [LPSTR] _PathIsNetworkPathA.restype = bool return _PathIsNetworkPathA(pszPath)
null
177,445
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsNetworkPathW(pszPath): _PathIsNetworkPathW = windll.shlwapi.PathIsNetworkPathW _PathIsNetworkPathW.argtypes = [LPWSTR] _PathIsNetworkPathW.restype = bool return _PathIsNetworkPathW(pszPath)
null
177,446
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsRelativeA(pszPath): _PathIsRelativeA = windll.shlwapi.PathIsRelativeA _PathIsRelativeA.argtypes = [LPSTR] _PathIsRelativeA.restype = bool return _PathIsRelativeA(pszPath)
null
177,447
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsRelativeW(pszPath): _PathIsRelativeW = windll.shlwapi.PathIsRelativeW _PathIsRelativeW.argtypes = [LPWSTR] _PathIsRelativeW.restype = bool return _PathIsRelativeW(pszPath)
null
177,448
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsRootA(pszPath): _PathIsRootA = windll.shlwapi.PathIsRootA _PathIsRootA.argtypes = [LPSTR] _PathIsRootA.restype = bool return _PathIsRootA(pszPath)
null
177,449
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsRootW(pszPath): _PathIsRootW = windll.shlwapi.PathIsRootW _PathIsRootW.argtypes = [LPWSTR] _PathIsRootW.restype = bool return _PathIsRootW(pszPath)
null
177,450
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsSameRootA(pszPath1, pszPath2): _PathIsSameRootA = windll.shlwapi.PathIsSameRootA _PathIsSameRootA.argtypes = [LPSTR, LPSTR] _PathIsSameRootA.restype = bool return _PathIsSameRootA(pszPath1, pszPath2)
null
177,451
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsSameRootW(pszPath1, pszPath2): _PathIsSameRootW = windll.shlwapi.PathIsSameRootW _PathIsSameRootW.argtypes = [LPWSTR, LPWSTR] _PathIsSameRootW.restype = bool return _PathIsSameRootW(pszPath1, pszPath2)
null
177,452
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsUNCA(pszPath): _PathIsUNCA = windll.shlwapi.PathIsUNCA _PathIsUNCA.argtypes = [LPSTR] _PathIsUNCA.restype = bool return _PathIsUNCA(pszPath)
null
177,453
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathIsUNCW(pszPath): _PathIsUNCW = windll.shlwapi.PathIsUNCW _PathIsUNCW.argtypes = [LPWSTR] _PathIsUNCW.restype = bool return _PathIsUNCW(pszPath)
null
177,454
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathMakePrettyA(pszPath): _PathMakePrettyA = windll.shlwapi.PathMakePrettyA _PathMakePrettyA.argtypes = [LPSTR] _PathMakePrettyA.restype = bool _PathMakePrettyA.errcheck = RaiseIfZero pszPath = ctypes.create_string_buffer(pszPath, MAX_PATH) _PathMakePrettyA(pszPath) return pszPath.value
null
177,455
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathMakePrettyW(pszPath): _PathMakePrettyW = windll.shlwapi.PathMakePrettyW _PathMakePrettyW.argtypes = [LPWSTR] _PathMakePrettyW.restype = bool _PathMakePrettyW.errcheck = RaiseIfZero pszPath = ctypes.create_unicode_buffer(pszPath, MAX_PATH) _PathMakePrettyW(pszPath) return pszPath.value
null
177,456
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveArgsA(pszPath): _PathRemoveArgsA = windll.shlwapi.PathRemoveArgsA _PathRemoveArgsA.argtypes = [LPSTR] pszPath = ctypes.create_string_buffer(pszPath, MAX_PATH) _PathRemoveArgsA(pszPath) return pszPath.value
null
177,457
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveArgsW(pszPath): _PathRemoveArgsW = windll.shlwapi.PathRemoveArgsW _PathRemoveArgsW.argtypes = [LPWSTR] pszPath = ctypes.create_unicode_buffer(pszPath, MAX_PATH) _PathRemoveArgsW(pszPath) return pszPath.value
null
177,458
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveBackslashA(pszPath): _PathRemoveBackslashA = windll.shlwapi.PathRemoveBackslashA _PathRemoveBackslashA.argtypes = [LPSTR] pszPath = ctypes.create_string_buffer(pszPath, MAX_PATH) _PathRemoveBackslashA(pszPath) return pszPath.value
null
177,459
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveBackslashW(pszPath): _PathRemoveBackslashW = windll.shlwapi.PathRemoveBackslashW _PathRemoveBackslashW.argtypes = [LPWSTR] pszPath = ctypes.create_unicode_buffer(pszPath, MAX_PATH) _PathRemoveBackslashW(pszPath) return pszPath.value
null
177,460
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveExtensionA(pszPath): _PathRemoveExtensionA = windll.shlwapi.PathRemoveExtensionA _PathRemoveExtensionA.argtypes = [LPSTR] pszPath = ctypes.create_string_buffer(pszPath, MAX_PATH) _PathRemoveExtensionA(pszPath) return pszPath.value
null
177,461
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveExtensionW(pszPath): _PathRemoveExtensionW = windll.shlwapi.PathRemoveExtensionW _PathRemoveExtensionW.argtypes = [LPWSTR] pszPath = ctypes.create_unicode_buffer(pszPath, MAX_PATH) _PathRemoveExtensionW(pszPath) return pszPath.value
null
177,462
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveFileSpecA(pszPath): _PathRemoveFileSpecA = windll.shlwapi.PathRemoveFileSpecA _PathRemoveFileSpecA.argtypes = [LPSTR] pszPath = ctypes.create_string_buffer(pszPath, MAX_PATH) _PathRemoveFileSpecA(pszPath) return pszPath.value
null
177,463
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRemoveFileSpecW(pszPath): _PathRemoveFileSpecW = windll.shlwapi.PathRemoveFileSpecW _PathRemoveFileSpecW.argtypes = [LPWSTR] pszPath = ctypes.create_unicode_buffer(pszPath, MAX_PATH) _PathRemoveFileSpecW(pszPath) return pszPath.value
null
177,464
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRenameExtensionA(pszPath, pszExt): _PathRenameExtensionA = windll.shlwapi.PathRenameExtensionA _PathRenameExtensionA.argtypes = [LPSTR, LPSTR] _PathRenameExtensionA.restype = bool pszPath = ctypes.create_string_buffer(pszPath, MAX_PATH) if _PathRenameExtensionA(pszPath, pszExt): return pszPath.value return None
null
177,465
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathRenameExtensionW(pszPath, pszExt): _PathRenameExtensionW = windll.shlwapi.PathRenameExtensionW _PathRenameExtensionW.argtypes = [LPWSTR, LPWSTR] _PathRenameExtensionW.restype = bool pszPath = ctypes.create_unicode_buffer(pszPath, MAX_PATH) if _PathRenameExtensionW(pszPath, pszExt): return pszPath.value return None
null
177,466
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathUnExpandEnvStringsA(pszPath): _PathUnExpandEnvStringsA = windll.shlwapi.PathUnExpandEnvStringsA _PathUnExpandEnvStringsA.argtypes = [LPSTR, LPSTR] _PathUnExpandEnvStringsA.restype = bool _PathUnExpandEnvStringsA.errcheck = RaiseIfZero cchBuf = MAX_PATH pszBuf = ctypes.create_string_buffer("", cchBuf) _PathUnExpandEnvStringsA(pszPath, pszBuf, cchBuf) return pszBuf.value
null
177,467
from winappdbg.win32.defines import * from winappdbg.win32.kernel32 import * def PathUnExpandEnvStringsW(pszPath): _PathUnExpandEnvStringsW = windll.shlwapi.PathUnExpandEnvStringsW _PathUnExpandEnvStringsW.argtypes = [LPWSTR, LPWSTR] _PathUnExpandEnvStringsW.restype = bool _PathUnExpandEnvStringsW.errcheck = RaiseIfZero cchBuf = MAX_PATH pszBuf = ctypes.create_unicode_buffer(u"", cchBuf) _PathUnExpandEnvStringsW(pszPath, pszBuf, cchBuf) return pszBuf.value
null
177,468
from winappdbg.win32.defines import * from winappdbg.win32.version import bits from winappdbg.win32.kernel32 import GetLastError, SetLastError from winappdbg.win32.gdi32 import POINT, PPOINT, LPPOINT, RECT, PRECT, LPRECT def SetLastErrorEx(dwErrCode, dwType = 0): _SetLastErrorEx = windll.user32.SetLastErrorEx _SetLastErrorEx.argtypes = [DWORD, DWORD] _SetLastErrorEx.restype = None _SetLastErrorEx(dwErrCode, dwType)
null
177,469
from winappdbg.win32.defines import * from winappdbg.win32.version import bits from winappdbg.win32.kernel32 import GetLastError, SetLastError from winappdbg.win32.gdi32 import POINT, PPOINT, LPPOINT, RECT, PRECT, LPRECT def GetLastError(): _GetLastError = windll.kernel32.GetLastError _GetLastError.argtypes = [] _GetLastError.restype = DWORD return _GetLastError() def FindWindowA(lpClassName = None, lpWindowName = None): _FindWindowA = windll.user32.FindWindowA _FindWindowA.argtypes = [LPSTR, LPSTR] _FindWindowA.restype = HWND hWnd = _FindWindowA(lpClassName, lpWindowName) if not hWnd: errcode = GetLastError() if errcode != ERROR_SUCCESS: raise ctypes.WinError(errcode) return hWnd
null
177,470
from winappdbg.win32.defines import * from winappdbg.win32.version import bits from winappdbg.win32.kernel32 import GetLastError, SetLastError from winappdbg.win32.gdi32 import POINT, PPOINT, LPPOINT, RECT, PRECT, LPRECT def GetLastError(): _GetLastError = windll.kernel32.GetLastError _GetLastError.argtypes = [] _GetLastError.restype = DWORD return _GetLastError() def FindWindowW(lpClassName = None, lpWindowName = None): _FindWindowW = windll.user32.FindWindowW _FindWindowW.argtypes = [LPWSTR, LPWSTR] _FindWindowW.restype = HWND hWnd = _FindWindowW(lpClassName, lpWindowName) if not hWnd: errcode = GetLastError() if errcode != ERROR_SUCCESS: raise ctypes.WinError(errcode) return hWnd
null
177,471
from winappdbg.win32.defines import * from winappdbg.win32.version import bits from winappdbg.win32.kernel32 import GetLastError, SetLastError from winappdbg.win32.gdi32 import POINT, PPOINT, LPPOINT, RECT, PRECT, LPRECT def GetLastError(): _GetLastError = windll.kernel32.GetLastError _GetLastError.argtypes = [] _GetLastError.restype = DWORD return _GetLastError() def FindWindowExA(hwndParent = None, hwndChildAfter = None, lpClassName = None, lpWindowName = None): _FindWindowExA = windll.user32.FindWindowExA _FindWindowExA.argtypes = [HWND, HWND, LPSTR, LPSTR] _FindWindowExA.restype = HWND hWnd = _FindWindowExA(hwndParent, hwndChildAfter, lpClassName, lpWindowName) if not hWnd: errcode = GetLastError() if errcode != ERROR_SUCCESS: raise ctypes.WinError(errcode) return hWnd
null