当前位置: 首页>>代码示例>>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;未经允许,请勿转载。