Python ctypes.WINFUNCTYPE Examples
The following are 30
code examples of ctypes.WINFUNCTYPE().
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
, 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 GetMethodOrigin(self, method_name): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.POINTER(BSTR)) paramflags = ((_In_, 'wszMethodName'), (_Out_, 'pstrClassName'), ) _GetMethodOrigin = prototype(IWbemClassObject_GetMethodOrigin_Idx, 'GetMethodOrigin', paramflags) _GetMethodOrigin.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetMethodOrigin(self.this, method_name ) return_obj = winapi.convert_bstr_to_str(return_obj) return return_obj
Example #3
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_, 'ppCopy'), ) _Clone = prototype(IWbemClassObject_Clone_Idx, 'Clone', paramflags) _Clone.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _Clone(self.this ) try: return_obj = IWbemClassObject(return_obj) except WindowsError: return_obj = None return return_obj
Example #4
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 #5
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 #6
Source File: winapi.py From cWMI with Apache License 2.0 | 6 votes |
def SafeArrayCreate(vt, dims, bound): prototype = ctypes.WINFUNCTYPE( ctypes.POINTER(SAFEARRAY), VARTYPE, wintypes.UINT, ctypes.POINTER(SAFEARRAYBOUND) ) paramflags = ( (_In_, 'vt'), (_In_, 'cDims'), (_In_, 'rgsabound'), ) _SafeArrayCreate = prototype(('SafeArrayCreate', oleaut32), paramflags) return _SafeArrayCreate(vt, dims, bound)
Example #7
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 #8
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Get(self, name, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.c_long, ctypes.POINTER(winapi.VARIANT), ctypes.POINTER(CIMTYPE), ctypes.POINTER(ctypes.c_long)) paramflags = ((_In_, 'wszName'), (_In_, 'lFlags'), (_Out_, 'pVal'), (_Out_, 'pType'), (_Out_, 'plFlavor'), ) _Get = prototype(IWbemClassObject_Get_Idx, 'Get', paramflags) _Get.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj, return_obj2, return_obj3 = _Get(self.this, name, flags ) return return_obj, return_obj2, return_obj3
Example #9
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 #10
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Next(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(BSTR), ctypes.POINTER(winapi.VARIANT), ctypes.POINTER(ctypes.c_long)) paramflags = ((_In_, 'lFlags'), (_Out_, 'pstrName'), (_Out_, 'pVal'), (_Out_, 'plFlavor'), ) _Next = prototype(IWbemQualifierSet_Next_Idx, 'Next', paramflags) _Next.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj, return_obj2, return_obj3 = _Next(self.this, flags ) return_obj = winapi.convert_bstr_to_str(return_obj) return return_obj, return_obj2, return_obj3
Example #11
Source File: winapi.py From cWMI with Apache License 2.0 | 6 votes |
def SafeArrayAccessData(sa): prototype = ctypes.WINFUNCTYPE( HRESULT, ctypes.POINTER(SAFEARRAY), ctypes.POINTER(wintypes.LPVOID) ) paramflags = ( (_In_, 'psa'), (_Out_, 'ppvData', ctypes.pointer(wintypes.LPVOID(None))), ) _SafeArrayAccessData = prototype(('SafeArrayAccessData', oleaut32), paramflags) _SafeArrayAccessData.errcheck = RAISE_NON_ZERO_ERR return_obj = _SafeArrayAccessData(sa) return return_obj.contents
Example #12
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Put(self, name, val, flavor): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.POINTER(winapi.VARIANT), ctypes.c_long) paramflags = ((_In_, 'wszName'), (_In_, 'pVal'), (_In_, 'lFlavor'), ) _Put = prototype(IWbemQualifierSet_Put_Idx, 'Put', paramflags) _Put.errcheck = winapi.RAISE_NON_ZERO_ERR _Put(self.this, name, ctypes.byref(val) if val else None, flavor )
Example #13
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Next(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(BSTR), ctypes.POINTER(winapi.VARIANT), ctypes.POINTER(CIMTYPE), ctypes.POINTER(ctypes.c_long)) paramflags = ((_In_, 'lFlags'), (_Out_, 'strName'), (_Out_, 'pVal'), (_Out_, 'pType'), (_Out_, 'plFlavor'), ) _Next = prototype(IWbemClassObject_Next_Idx, 'Next', paramflags) _Next.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj, return_obj2, return_obj3, return_obj4 = _Next(self.this, flags ) return_obj = winapi.convert_bstr_to_str(return_obj) return return_obj, return_obj2, return_obj3, return_obj4
Example #14
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def PutMethod(self, name, flags, in_signature, out_signature): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.c_long, ctypes.POINTER(IWbemClassObject), ctypes.POINTER(IWbemClassObject)) paramflags = ((_In_, 'wszName'), (_In_, 'lFlags'), (_In_, 'pInSignature'), (_In_, 'pOutSignature'), ) _PutMethod = prototype(IWbemClassObject_PutMethod_Idx, 'PutMethod', paramflags) _PutMethod.errcheck = winapi.RAISE_NON_ZERO_ERR _PutMethod(self.this, name, flags, in_signature.this if in_signature else None, out_signature.this if out_signature else None )
Example #15
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 #16
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 #17
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 #18
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 #19
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 #20
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Skip(self, timeout, count): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, wintypes.ULONG) paramflags = ((_In_, 'lTimeout'), (_In_, 'nCount'), ) _Skip = prototype(IEnumWbemClassObject_Skip_Idx, 'Skip', paramflags) _Skip.errcheck = winapi.RAISE_NON_ZERO_ERR _Skip(self.this, timeout, count )
Example #21
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 #22
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetResultString(self, timeout): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(BSTR)) paramflags = ((_In_, 'lTimeout'), (_Out_, 'pstrResultString'), ) _GetResultString = prototype(IWbemCallResult_GetResultString_Idx, 'GetResultString', paramflags) _GetResultString.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetResultString(self.this, timeout ) return_obj = winapi.convert_bstr_to_str(return_obj) return return_obj
Example #23
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 #24
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 #25
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 #26
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def Next(self, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.c_long, ctypes.POINTER(BSTR), ctypes.POINTER(winapi.VARIANT)) paramflags = ((_In_, 'lFlags'), (_Out_, 'pstrName'), (_Out_, 'pValue'), ) _Next = prototype(IWbemContext_Next_Idx, 'Next', paramflags) _Next.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj, return_obj2 = _Next(self.this, flags ) return_obj = winapi.convert_bstr_to_str(return_obj) return return_obj, return_obj2
Example #27
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def GetValue(self, name, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.c_long, ctypes.POINTER(winapi.VARIANT)) paramflags = ((_In_, 'wszName'), (_In_, 'lFlags'), (_Out_, 'pValue'), ) _GetValue = prototype(IWbemContext_GetValue_Idx, 'GetValue', paramflags) _GetValue.errcheck = winapi.RAISE_NON_ZERO_ERR return_obj = _GetValue(self.this, name, flags ) return return_obj
Example #28
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def DeleteValue(self, name, flags): prototype = ctypes.WINFUNCTYPE(HRESULT, wintypes.LPCWSTR, ctypes.c_long) paramflags = ((_In_, 'wszName'), (_In_, 'lFlags'), ) _DeleteValue = prototype(IWbemContext_DeleteValue_Idx, 'DeleteValue', paramflags) _DeleteValue.errcheck = winapi.RAISE_NON_ZERO_ERR _DeleteValue(self.this, name, flags )
Example #29
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def PutClassAsync(self, object_param, flags, ctx, response_handler): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.POINTER(IWbemClassObject), ctypes.c_long, ctypes.POINTER(IWbemContext), ctypes.POINTER(IWbemObjectSink)) paramflags = ((_In_, 'pObject'), (_In_, 'lFlags'), (_In_, 'pCtx'), (_In_, 'pResponseHandler'), ) _PutClassAsync = prototype(IWbemServices_PutClassAsync_Idx, 'PutClassAsync', paramflags) _PutClassAsync.errcheck = winapi.RAISE_NON_ZERO_ERR _PutClassAsync(self.this, object_param.this if object_param else None, flags, ctx.this if ctx else None, response_handler.this if response_handler else None )
Example #30
Source File: wmi.py From cWMI with Apache License 2.0 | 6 votes |
def PutInstanceAsync(self, inst, flags, ctx, response_handler): prototype = ctypes.WINFUNCTYPE(HRESULT, ctypes.POINTER(IWbemClassObject), ctypes.c_long, ctypes.POINTER(IWbemContext), ctypes.POINTER(IWbemObjectSink)) paramflags = ((_In_, 'pInst'), (_In_, 'lFlags'), (_In_, 'pCtx'), (_In_, 'pResponseHandler'), ) _PutInstanceAsync = prototype(IWbemServices_PutInstanceAsync_Idx, 'PutInstanceAsync', paramflags) _PutInstanceAsync.errcheck = winapi.RAISE_NON_ZERO_ERR _PutInstanceAsync(self.this, inst.this if inst else None, flags, ctx.this if ctx else None, response_handler.this if response_handler else None )