Python ctypes.wintypes.LPVOID Examples
The following are 30
code examples of ctypes.wintypes.LPVOID().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ctypes.wintypes
, or try the search function
.
Example #1
Source File: com.py From cWMI with Apache License 2.0 | 9 votes |
def QueryInterface(self, riid): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.POINTER(winapi.GUID), ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'riid'), (_Out_, 'ppvObject', ctypes.pointer(wintypes.LPVOID(None))) ) _QueryInterface = prototype(IUnknown_QueryInterface_Idx, 'QueryInterface', paramflags) _QueryInterface.errcheck = winapi.RAISE_NON_ZERO_ERR return_ptr = _QueryInterface(self.this, ctypes.byref(riid)) return IUnknown(return_ptr.contents)
Example #2
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Clone(self): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_Out_, 'ppNewCopy'), ) _Clone = prototype(IWbemContext_Clone_Idx, 'Clone', paramflags) _Clone.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _Clone(self.this ) try: return_obj = IWbemContext(return_obj) except WindowsError: return_obj = None return return_obj
Example #3
Source File: winapi.py From cWMI with Apache License 2.0 | 6 votes |
def CoInitializeEx(reserved, co_init): prototype = ctypes.WINFUNCTYPE( HRESULT, wintypes.LPVOID, wintypes.DWORD ) paramflags = ( (_In_, 'pvReserved'), (_In_, 'dwCoInit') ) _CoInitializeEx = prototype(('CoInitializeEx', ole32), paramflags) _CoInitializeEx.errcheck = RAISE_NON_ZERO_ERR return _CoInitializeEx(reserved, co_init)
Example #4
Source File: winapi.py From cWMI with Apache License 2.0 | 6 votes |
def CoCreateInstance(clsid, unk, ctx, iid): prototype = ctypes.WINFUNCTYPE( HRESULT, ctypes.POINTER(GUID), wintypes.LPVOID, wintypes.DWORD, ctypes.POINTER(GUID), ctypes.POINTER(wintypes.LPVOID) ) paramflags = ( (_In_, 'rclsid'), (_In_, 'pUnkOuter'), (_In_, 'dwClsContext'), (_In_, 'riid'), (_Out_, 'ppv') ) _CoCreateInstance = prototype(('CoCreateInstance', ole32), paramflags) _CoCreateInstance.errcheck = RAISE_NON_ZERO_ERR return _CoCreateInstance(clsid, unk, ctx, iid)
Example #5
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def QueryObjectSink(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lFlags'), (_Out_, 'ppResponseHandler'), ) _QueryObjectSink = prototype(IWbemServices_QueryObjectSink_Idx, 'QueryObjectSink', paramflags) _QueryObjectSink.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _QueryObjectSink(self.this, flags ) try: return_obj = IWbemObjectSink(return_obj) except WindowsError: return_obj = None return return_obj
Example #6
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetNames(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lFlags'), (_Out_, 'pNames'), ) _GetNames = prototype(IWbemContext_GetNames_Idx, 'GetNames', paramflags) _GetNames.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetNames(self.this, flags ) return_obj = ctypes.cast(wintypes.LPVOID(return_obj), ctypes.POINTER(winapi.SAFEARRAY)) return return_obj
Example #7
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetResultServices(self, timeout): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lTimeout'), (_Out_, 'ppServices'), ) _GetResultServices = prototype(IWbemCallResult_GetResultServices_Idx, 'GetResultServices', paramflags) _GetResultServices.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetResultServices(self.this, timeout ) try: return_obj = IWbemServices(return_obj) except WindowsError: return_obj = None return return_obj
Example #8
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetResultObject(self, timeout): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lTimeout'), (_Out_, 'ppResultObject'), ) _GetResultObject = prototype(IWbemCallResult_GetResultObject_Idx, 'GetResultObject', paramflags) _GetResultObject.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetResultObject(self.this, timeout ) try: return_obj = IWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #9
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Clone(self): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_Out_, 'ppEnum'), ) _Clone = prototype(IEnumWbemClassObject_Clone_Idx, 'Clone', paramflags) _Clone.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _Clone(self.this ) try: return_obj = IEnumWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #10
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetNames(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lFlags'), (_Out_, 'pNames'), ) _GetNames = prototype(IWbemQualifierSet_GetNames_Idx, 'GetNames', paramflags) _GetNames.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetNames(self.this, flags ) return_obj = ctypes.cast(wintypes.LPVOID(return_obj), ctypes.POINTER(winapi.SAFEARRAY)) return return_obj
Example #11
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Indicate(self, object_count, obj_array): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lObjectCount'), (_In_, 'apObjArray'), ) _Indicate = prototype(IWbemObjectSink_Indicate_Idx, 'Indicate', paramflags) _Indicate.errcheck = winapi.RAISE_NON_ZERO_ERR _Indicate(self.this, object_count, obj_array.this if obj_array else None )
Example #12
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def SpawnInstance(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lFlags'), (_Out_, 'ppNewInstance'), ) _SpawnInstance = prototype(IWbemClassObject_SpawnInstance_Idx, 'SpawnInstance', paramflags) _SpawnInstance.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _SpawnInstance(self.this, flags ) try: return_obj = IWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #13
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetQualifierSet(self): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_Out_, 'ppQualSet'), ) _GetQualifierSet = prototype(IWbemClassObject_GetQualifierSet_Idx, 'GetQualifierSet', paramflags) _GetQualifierSet.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetQualifierSet(self.this ) try: return_obj = IWbemQualifierSet(return_obj) except WindowsError: return_obj = None return return_obj
Example #14
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def SpawnDerivedClass(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'lFlags'), (_Out_, 'ppNewClass'), ) _SpawnDerivedClass = prototype(IWbemClassObject_SpawnDerivedClass_Idx, 'SpawnDerivedClass', paramflags) _SpawnDerivedClass.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _SpawnDerivedClass(self.this, flags ) try: return_obj = IWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #15
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetPropertyQualifierSet(self, property_param): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'wszProperty'), (_Out_, 'ppQualSet'), ) _GetPropertyQualifierSet = prototype(IWbemClassObject_GetPropertyQualifierSet_Idx, 'GetPropertyQualifierSet', paramflags) _GetPropertyQualifierSet.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetPropertyQualifierSet(self.this, property_param ) try: return_obj = IWbemQualifierSet(return_obj) except WindowsError: return_obj = None return return_obj
Example #16
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetNames(self, qualifier_name, flags, qualifier_val): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.c_long, ctypes.POINTER(winapi.VARIANT), ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'wszQualifierName'), (_In_, 'lFlags'), (_In_, 'pQualifierVal'), (_Out_, 'pNames'), ) _GetNames = prototype(IWbemClassObject_GetNames_Idx, 'GetNames', paramflags) _GetNames.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetNames(self.this, qualifier_name, flags, ctypes.byref(qualifier_val) if qualifier_val else None ) return_obj = ctypes.cast(wintypes.LPVOID(return_obj), ctypes.POINTER(winapi.SAFEARRAY)) return return_obj
Example #17
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetMethodQualifierSet(self, method): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'wszMethod'), (_Out_, 'ppQualSet'), ) _GetMethodQualifierSet = prototype(IWbemClassObject_GetMethodQualifierSet_Idx, 'GetMethodQualifierSet', paramflags) _GetMethodQualifierSet.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetMethodQualifierSet(self.this, method ) try: return_obj = IWbemQualifierSet(return_obj) except WindowsError: return_obj = None return return_obj
Example #18
Source File: win.py From gd.py with MIT License | 5 votes |
def virtual_alloc_ex( handle: wintypes.HANDLE, address: wintypes.LPVOID, size: ctypes.c_size_t, allocation_type: wintypes.DWORD, protect: wintypes.DWORD, ) -> wintypes.LPVOID: pass
Example #19
Source File: winapi.py From cWMI with Apache License 2.0 | 5 votes |
def CoSetProxyBlanket(proxy, authn_svc, authz_svc, server_p_name, authn_level, imp_level, auth_info, capabilities): prototype = ctypes.WINFUNCTYPE( HRESULT, wintypes.LPVOID, wintypes.DWORD, wintypes.DWORD, wintypes.OLESTR, wintypes.DWORD, wintypes.DWORD, RPC_AUTH_IDENTITY_HANDLE, wintypes.DWORD ) paramflags = ( (_In_, 'pProxy'), (_In_, 'dwAuthnSvc'), (_In_, 'dwAuthzSvc'), (_In_, 'pServerPrincName'), (_In_, 'dwAuthnLevel'), (_In_, 'dwImpLevel'), (_In_, 'pAuthInfo'), (_In_, 'dwCapabilities') ) _CoSetProxyBlanket = prototype(('CoSetProxyBlanket', ole32), paramflags) _CoSetProxyBlanket.errcheck = RAISE_NON_ZERO_ERR return _CoSetProxyBlanket(proxy, authn_svc, authz_svc, server_p_name, authn_level, imp_level, auth_info, capabilities)
Example #20
Source File: driverlib.py From win_driver_plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
def send_ioctl(self, ioctl, inbuf, inbufsiz, outbuf, outbufsiz): """See: DeviceIoControl function http://msdn.microsoft.com/en-us/library/aa363216(v=vs.85).aspx """ DeviceIoControl_Fn = ctypes.windll.kernel32.DeviceIoControl DeviceIoControl_Fn.argtypes = [ wintypes.HANDLE, # _In_ HANDLE hDevice wintypes.DWORD, # _In_ DWORD dwIoControlCode wintypes.LPVOID, # _In_opt_ LPVOID lpInBuffer wintypes.DWORD, # _In_ DWORD nInBufferSize wintypes.LPVOID, # _Out_opt_ LPVOID lpOutBuffer wintypes.DWORD, # _In_ DWORD nOutBufferSize LPDWORD, # _Out_opt_ LPDWORD lpBytesReturned LPOVERLAPPED] # _Inout_opt_ LPOVERLAPPED lpOverlapped DeviceIoControl_Fn.restype = wintypes.BOOL # allocate a DWORD, and take its reference dwBytesReturned = wintypes.DWORD(0) lpBytesReturned = ctypes.byref(dwBytesReturned) status = DeviceIoControl_Fn(self.handle, ioctl, inbuf, inbufsiz, outbuf, outbufsiz, lpBytesReturned, None) return status, dwBytesReturned
Example #21
Source File: win.py From gd.py with MIT License | 5 votes |
def read_process_memory( handle: wintypes.HANDLE, base_address: wintypes.LPVOID, buffer: wintypes.LPCVOID, size: ctypes.c_size_t, size_ptr: ctypes.POINTER(ctypes.c_size_t), ) -> wintypes.BOOL: pass
Example #22
Source File: win.py From gd.py with MIT License | 5 votes |
def write_process_memory( handle: wintypes.HANDLE, base_address: wintypes.LPVOID, buffer: wintypes.LPCVOID, size: ctypes.c_size_t, size_ptr: ctypes.POINTER(ctypes.c_size_t), ) -> wintypes.BOOL: pass
Example #23
Source File: win.py From gd.py with MIT License | 5 votes |
def virtual_protect_ex( handle: wintypes.HANDLE, address: wintypes.LPVOID, size: ctypes.c_size_t, flags: wintypes.DWORD, old_protect: wintypes.PDWORD, ) -> wintypes.BOOL: pass
Example #24
Source File: win.py From gd.py with MIT License | 5 votes |
def virtual_free_ex( handle: wintypes.HANDLE, address: wintypes.LPVOID, size: ctypes.c_size_t, free_type: wintypes.DWORD, ) -> wintypes.BOOL: pass
Example #25
Source File: shellDev.py From shellDev.py with GNU General Public License v3.0 | 5 votes |
def jitInject(path, shellcode): info = win32process.CreateProcess(None, path, None, None, False, 0x04, None, None, win32process.STARTUPINFO()) page_rwx_value = 0x40 process_all = 0x1F0FFF memcommit = 0x00001000 shellcode_length = len(shellcode) process_handle = info[0].handle # phandle VirtualAllocEx = windll.kernel32.VirtualAllocEx VirtualAllocEx.restype = LPVOID VirtualAllocEx.argtypes = (HANDLE, LPVOID, DWORD, DWORD, DWORD) WriteProcessMemory = ctypes.windll.kernel32.WriteProcessMemory WriteProcessMemory.restype = BOOL WriteProcessMemory.argtypes = (HANDLE, LPVOID, LPCVOID, DWORD, DWORD) CreateRemoteThread = ctypes.windll.kernel32.CreateRemoteThread CreateRemoteThread.restype = HANDLE CreateRemoteThread.argtypes = (HANDLE, LPSECURITY_ATTRIBUTES, DWORD, LPTHREAD_START_ROUTINE, LPVOID, DWORD, DWORD) lpBuffer = VirtualAllocEx(process_handle, 0, shellcode_length, memcommit, page_rwx_value) print(hex(lpBuffer)) WriteProcessMemory(process_handle, lpBuffer, shellcode, shellcode_length, 0) CreateRemoteThread(process_handle, None, 0, lpBuffer, 0, 0, 0) print('JIT Injection, done.') # -------------------------------------------------- #
Example #26
Source File: win.py From gd.py with MIT License | 5 votes |
def get_proc_address( module_handle: wintypes.HMODULE, proc_name: wintypes.LPCSTR ) -> wintypes.LPVOID: pass
Example #27
Source File: wmi.py From cWMI with Apache License 2.0 | 5 votes |
def ExecNotificationQuery(self, query_language, query, flags, ctx): prototype = ctypes.WINFUNCTYPE(HRESULT, BSTR, BSTR, ctypes.c_long, ctypes.POINTER(IWbemContext), ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'strQueryLanguage'), (_In_, 'strQuery'), (_In_, 'lFlags'), (_In_, 'pCtx'), (_Out_, 'ppEnum'), ) _ExecNotificationQuery = prototype(IWbemServices_ExecNotificationQuery_Idx, 'ExecNotificationQuery', paramflags) _ExecNotificationQuery.errcheck = winapi.RAISE_NON_ZERO_ERR query_language_bstr = winapi.SysAllocString(query_language) if query_language is not None else None query_bstr = winapi.SysAllocString(query) if query is not None else None try: return_obj = _ExecNotificationQuery(self.this, query_language_bstr, query_bstr, flags, ctx.this if ctx else None ) finally: if query_language_bstr is not None: winapi.SysFreeString(query_language_bstr) if query_bstr is not None: winapi.SysFreeString(query_bstr) try: return_obj = IEnumWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #28
Source File: wmi.py From cWMI with Apache License 2.0 | 5 votes |
def ExecQuery(self, query_language, query, flags, ctx): prototype = ctypes.WINFUNCTYPE(HRESULT, BSTR, BSTR, ctypes.c_long, ctypes.POINTER(IWbemContext), ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'strQueryLanguage'), (_In_, 'strQuery'), (_In_, 'lFlags'), (_In_, 'pCtx'), (_Out_, 'ppEnum'), ) _ExecQuery = prototype(IWbemServices_ExecQuery_Idx, 'ExecQuery', paramflags) _ExecQuery.errcheck = winapi.RAISE_NON_ZERO_ERR query_language_bstr = winapi.SysAllocString(query_language) if query_language is not None else None query_bstr = winapi.SysAllocString(query) if query is not None else None try: return_obj = _ExecQuery(self.this, query_language_bstr, query_bstr, flags, ctx.this if ctx else None ) finally: if query_language_bstr is not None: winapi.SysFreeString(query_language_bstr) if query_bstr is not None: winapi.SysFreeString(query_bstr) try: return_obj = IEnumWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #29
Source File: wmi.py From cWMI with Apache License 2.0 | 5 votes |
def CreateInstanceEnum(self, filter_param, flags, ctx): prototype = ctypes.WINFUNCTYPE(HRESULT, BSTR, ctypes.c_long, ctypes.POINTER(IWbemContext), ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'strFilter'), (_In_, 'lFlags'), (_In_, 'pCtx'), (_Out_, 'ppEnum'), ) _CreateInstanceEnum = prototype(IWbemServices_CreateInstanceEnum_Idx, 'CreateInstanceEnum', paramflags) _CreateInstanceEnum.errcheck = winapi.RAISE_NON_ZERO_ERR filter_param_bstr = winapi.SysAllocString(filter_param) if filter_param is not None else None try: return_obj = _CreateInstanceEnum(self.this, filter_param_bstr, flags, ctx.this if ctx else None ) finally: if filter_param_bstr is not None: winapi.SysFreeString(filter_param_bstr) try: return_obj = IEnumWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #30
Source File: wmi.py From cWMI with Apache License 2.0 | 5 votes |
def DeleteInstanceWithResult(self, object_path, flags, ctx): prototype = ctypes.WINFUNCTYPE(HRESULT, BSTR, ctypes.c_long, ctypes.POINTER(IWbemContext), ctypes.POINTER(wintypes.LPVOID)) paramflags = ((_In_, 'strObjectPath'), (_In_, 'lFlags'), (_In_, 'pCtx'), (_Out_, 'ppCallResult'), ) _DeleteInstance = prototype(IWbemServices_DeleteInstance_Idx, 'DeleteInstance', paramflags) _DeleteInstance.errcheck = winapi.RAISE_NON_ZERO_ERR object_path_bstr = winapi.SysAllocString(object_path) if object_path is not None else None try: return_obj = _DeleteInstance(self.this, object_path_bstr, flags, ctx.this if ctx else None ) finally: if object_path_bstr is not None: winapi.SysFreeString(object_path_bstr) try: return_obj = IWbemCallResult(return_obj) except WindowsError: return_obj = None return return_obj