Python源码示例:ctypes.POINTER

示例1
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
                  ) 
示例2
def Get(self, name, flags):
        prototype = ctypes.WINFUNCTYPE(HRESULT,
                                       wintypes.LPCWSTR,
                                       ctypes.c_long,
                                       ctypes.POINTER(winapi.VARIANT),
                                       ctypes.POINTER(ctypes.c_long))

        paramflags = ((_In_, 'wszName'),
                      (_In_, 'lFlags'),
                      (_Out_, 'pVal'),
                      (_Out_, 'plFlavor'),
                      )

        _Get = prototype(IWbemQualifierSet_Get_Idx,
                         'Get',
                         paramflags)
        _Get.errcheck = winapi.RAISE_NON_ZERO_ERR
        return_obj, return_obj2 = _Get(self.this,
                                       name,
                                       flags
                                       )
        return return_obj, return_obj2 
示例3
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
             ) 
示例4
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 
示例5
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 
示例6
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 
示例7
def Put(self, name, flags, val, type_param):
        prototype = ctypes.WINFUNCTYPE(HRESULT,
                                       wintypes.LPCWSTR,
                                       ctypes.c_long,
                                       ctypes.POINTER(winapi.VARIANT),
                                       CIMTYPE)

        paramflags = ((_In_, 'wszName'),
                      (_In_, 'lFlags'),
                      (_In_, 'pVal'),
                      (_In_, 'Type'),
                      )

        _Put = prototype(IWbemClassObject_Put_Idx,
                         'Put',
                         paramflags)
        _Put.errcheck = winapi.RAISE_NON_ZERO_ERR
        _Put(self.this,
             name,
             flags,
             ctypes.byref(val) if val else None,
             type_param
             ) 
示例8
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 
示例9
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 
示例10
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 
示例11
def GetObjectText(self, flags):
        prototype = ctypes.WINFUNCTYPE(HRESULT,
                                       ctypes.c_long,
                                       ctypes.POINTER(BSTR))

        paramflags = ((_In_, 'lFlags'),
                      (_Out_, 'pstrObjectText'),
                      )

        _GetObjectText = prototype(IWbemClassObject_GetObjectText_Idx,
                                   'GetObjectText',
                                   paramflags)
        _GetObjectText.errcheck = winapi.RAISE_NON_ZERO_ERR
        return_obj = _GetObjectText(self.this,
                                    flags
                                    )
        return_obj = winapi.convert_bstr_to_str(return_obj)
        return return_obj 
示例12
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 
示例13
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 
示例14
def CompareTo(self, flags, compare_to):
        prototype = ctypes.WINFUNCTYPE(HRESULT,
                                       ctypes.c_long,
                                       ctypes.POINTER(IWbemClassObject))

        paramflags = ((_In_, 'lFlags'),
                      (_In_, 'pCompareTo'),
                      )

        _CompareTo = prototype(IWbemClassObject_CompareTo_Idx,
                               'CompareTo',
                               paramflags)
        _CompareTo.errcheck = winapi.RAISE_NON_ZERO_ERR
        _CompareTo(self.this,
                   flags,
                   compare_to.this if compare_to else None
                   ) 
示例15
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
                   ) 
示例16
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 
示例17
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 
示例18
def NextAsync(self, count, sink):
        prototype = ctypes.WINFUNCTYPE(HRESULT,
                                       wintypes.ULONG,
                                       ctypes.POINTER(IWbemObjectSink))

        paramflags = ((_In_, 'uCount'),
                      (_In_, 'pSink'),
                      )

        _NextAsync = prototype(IEnumWbemClassObject_NextAsync_Idx,
                               'NextAsync',
                               paramflags)
        _NextAsync.errcheck = winapi.RAISE_NON_ZERO_ERR
        _NextAsync(self.this,
                   count,
                   sink.this if sink else None
                   ) 
示例19
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 
示例20
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 
示例21
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 
示例22
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 
示例23
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 
示例24
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 
示例25
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 
示例26
def SetValue(self, name, flags, value):
        prototype = ctypes.WINFUNCTYPE(HRESULT,
                                       wintypes.LPCWSTR,
                                       ctypes.c_long,
                                       ctypes.POINTER(winapi.VARIANT))

        paramflags = ((_In_, 'wszName'),
                      (_In_, 'lFlags'),
                      (_In_, 'pValue'),
                      )

        _SetValue = prototype(IWbemContext_SetValue_Idx,
                              'SetValue',
                              paramflags)
        _SetValue.errcheck = winapi.RAISE_NON_ZERO_ERR
        _SetValue(self.this,
                  name,
                  flags,
                  ctypes.byref(value) if value else None
                  ) 
示例27
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 
示例28
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 
示例29
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) 
示例30
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)