當前位置: 首頁>>代碼示例>>Python>>正文


Python wintypes.LPCWSTR屬性代碼示例

本文整理匯總了Python中ctypes.wintypes.LPCWSTR屬性的典型用法代碼示例。如果您正苦於以下問題:Python wintypes.LPCWSTR屬性的具體用法?Python wintypes.LPCWSTR怎麽用?Python wintypes.LPCWSTR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在ctypes.wintypes的用法示例。


在下文中一共展示了wintypes.LPCWSTR屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Get

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:24,代碼來源:wmi.py

示例2: Put

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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
             ) 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:22,代碼來源:wmi.py

示例3: GetNames

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:26,代碼來源:wmi.py

示例4: GetPropertyQualifierSet

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:23,代碼來源:wmi.py

示例5: GetPropertyOrigin

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
def GetPropertyOrigin(self, name):
        prototype = ctypes.WINFUNCTYPE(HRESULT,
                                       wintypes.LPCWSTR,
                                       ctypes.POINTER(BSTR))

        paramflags = ((_In_, 'wszName'),
                      (_Out_, 'pstrClassName'),
                      )

        _GetPropertyOrigin = prototype(IWbemClassObject_GetPropertyOrigin_Idx,
                                       'GetPropertyOrigin',
                                       paramflags)
        _GetPropertyOrigin.errcheck = winapi.RAISE_NON_ZERO_ERR
        return_obj = _GetPropertyOrigin(self.this,
                                        name
                                        )
        return_obj = winapi.convert_bstr_to_str(return_obj)
        return return_obj 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:20,代碼來源:wmi.py

示例6: GetMethodQualifierSet

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:23,代碼來源:wmi.py

示例7: GetMethodOrigin

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:20,代碼來源:wmi.py

示例8: SetValue

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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
                  ) 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:22,代碼來源:wmi.py

示例9: GetValue

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
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 
開發者ID:fireeye,項目名稱:cWMI,代碼行數:22,代碼來源:wmi.py

示例10: WlanDeleteProfile

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
def WlanDeleteProfile(hClientHandle, pInterfaceGuid, profileName):
    """
    DWORD WINAPI WlanDeleteProfile(
        _In_             HANDLE  hClientHandle,
        _In_       const GUID    *pInterfaceGuid,
        _In_             LPCWSTR strProfileName,
        _Reserved_       PVOID   pReserved
    );
    """
    func_ref = wlanapi.WlanDeleteProfile
    func_ref.argtypes = [HANDLE,
                         POINTER(GUID),
                         LPCWSTR,
                         c_void_p]
    func_ref.restype = DWORD
    result = func_ref(hClientHandle,
                      byref(pInterfaceGuid),
                      profileName,
                      None)
    if result != ERROR_SUCCESS:
        raise Exception("WlanDeleteProfile failed. error %d" % result, result)
    return result 
開發者ID:kedos,項目名稱:win32wifi,代碼行數:24,代碼來源:Win32NativeWifiApi.py

示例11: arg_split

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
def arg_split(commandline, posix=False, strict=True):
        """Split a command line's arguments in a shell-like manner.

        This is a special version for windows that use a ctypes call to CommandLineToArgvW
        to do the argv splitting. The posix paramter is ignored.
        
        If strict=False, process_common.arg_split(...strict=False) is used instead.
        """
        #CommandLineToArgvW returns path to executable if called with empty string.
        if commandline.strip() == "":
            return []
        if not strict:
            # not really a cl-arg, fallback on _process_common
            return py_arg_split(commandline, posix=posix, strict=strict)
        argvn = c_int()
        result_pointer = CommandLineToArgvW(py3compat.cast_unicode(commandline.lstrip()), ctypes.byref(argvn))
        result_array_type = LPCWSTR * argvn.value
        result = [arg for arg in result_array_type.from_address(ctypes.addressof(result_pointer.contents))]
        retval = LocalFree(result_pointer)
        return result 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:22,代碼來源:_process_win32.py

示例12: send2trash

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
def send2trash(path):
    if not isinstance(path, text_type):
        path = text_type(path, 'mbcs')
    if not op.isabs(path):
        path = op.abspath(path)
    fileop = SHFILEOPSTRUCTW()
    fileop.hwnd = 0
    fileop.wFunc = FO_DELETE
    fileop.pFrom = LPCWSTR(path + '\0')
    fileop.pTo = None
    fileop.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT
    fileop.fAnyOperationsAborted = 0
    fileop.hNameMappings = 0
    fileop.lpszProgressTitle = None
    result = SHFileOperationW(byref(fileop))
    if result:
        msg = "Couldn't perform operation. Error code: %d" % result
        raise OSError(msg) 
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:20,代碼來源:plat_win.py

示例13: get_short_path_name

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
def get_short_path_name(path):
    from ctypes import windll, wintypes, create_unicode_buffer

    # Set the GetShortPathNameW prototype
    _GetShortPathNameW = windll.kernel32.GetShortPathNameW
    _GetShortPathNameW.argtypes = [wintypes.LPCWSTR,
                                   wintypes.LPWSTR,
                                   wintypes.DWORD]
    _GetShortPathNameW.restype = wintypes.DWORD

    output_buf_size = 0

    while True:
        output_buf = create_unicode_buffer(output_buf_size)
        needed = _GetShortPathNameW(path, output_buf, output_buf_size)
        if output_buf_size >= needed:
            return output_buf.value
        output_buf_size = needed


# A wrapper for subprocess.Popen that fixes quirks on Windows. 
開發者ID:vheon,項目名稱:JediHTTP,代碼行數:23,代碼來源:utils.py

示例14: check_aslr

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
def check_aslr():
    # first check for a potentially rebased user32.dll
    from ctypes import windll
    from ctypes import wintypes
    check_dlls = ["user32.dll", "kernel32.dll", "ntdll.dll"]
    offsets = []
    is_aslr = False
    windll.kernel32.GetModuleHandleW.restype = wintypes.HMODULE
    windll.kernel32.GetModuleHandleW.argtypes = [wintypes.LPCWSTR]
    windll.kernel32.GetModuleFileNameW.restype = wintypes.DWORD
    windll.kernel32.GetModuleFileNameW.argtypes = [wintypes.HANDLE, wintypes.LPWSTR, wintypes.DWORD]
    for dll_name in check_dlls:
        h_module_base = windll.kernel32.GetModuleHandleW(dll_name)
        # next get the module's file path
        module_path = ctypes.create_unicode_buffer(255)
        windll.kernel32.GetModuleFileNameW(h_module_base, module_path, 255)
        # then the ImageBase from python.exe file
        pe = pefile.PE(module_path.value)
        pe_header_base_addr = pe.OPTIONAL_HEADER.ImageBase
        offsets.append(pe_header_base_addr - h_module_base)
    for dll_name, offset in zip(check_dlls, offsets):
        LOG.debug("Memory vs. File ImageBase offset (%s): 0x%x", dll_name, offset)
        is_aslr |= offset != 0
    return is_aslr 
開發者ID:danielplohmann,項目名稱:apiscout,代碼行數:26,代碼來源:DatabaseBuilder.py

示例15: unicode_sys_argv

# 需要導入模塊: from ctypes import wintypes [as 別名]
# 或者: from ctypes.wintypes import LPCWSTR [as 別名]
def unicode_sys_argv():
    """Uses shell32.GetCommandLineArgvW to fix sys.argv as a list of
    unicode strings.
    """
    GetCommandLineW = ctypes.cdll.kernel32.GetCommandLineW
    GetCommandLineW.argtypes = []
    GetCommandLineW.restype = wintypes.LPCWSTR
    cmd_line = GetCommandLineW()

    CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW
    CommandLineToArgvW.argtypes = [wintypes.LPCWSTR,
                                   ctypes.POINTER(ctypes.c_int)]
    CommandLineToArgvW.restype = ctypes.POINTER(wintypes.LPWSTR)
    argc = ctypes.c_int(0)
    argv = CommandLineToArgvW(cmd_line, ctypes.byref(argc))

    if argc.value:
        rng = xrange(argc.value - len(sys.argv), argc.value)
        sys.argv = [argv[i] for i in rng] 
開發者ID:sk1project,項目名稱:uniconvertor,代碼行數:21,代碼來源:msw_utils.py


注:本文中的ctypes.wintypes.LPCWSTR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。