本文整理汇总了Python中_winreg.KEY_WOW64_32KEY属性的典型用法代码示例。如果您正苦于以下问题:Python _winreg.KEY_WOW64_32KEY属性的具体用法?Python _winreg.KEY_WOW64_32KEY怎么用?Python _winreg.KEY_WOW64_32KEY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类_winreg
的用法示例。
在下文中一共展示了_winreg.KEY_WOW64_32KEY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: uninstall_all
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_WOW64_32KEY [as 别名]
def uninstall_all():
"""uninstalls PyXLL from all installed Excel versions"""
for wow64_flags in (winreg.KEY_WOW64_64KEY, winreg.KEY_WOW64_32KEY):
for root in _root_keys.keys():
try:
flags = wow64_flags | winreg.KEY_READ
office_root = winreg.OpenKey(root, r"Software\Microsoft\Office", 0, flags)
except WindowsError:
continue
# look for all installed versions of Excel and uninstall PyXLL
i = 0
while True:
try:
subkey = winreg.EnumKey(office_root, i)
except WindowsError:
break
match = re.match("^(\d+(?:\.\d+)?)$", subkey)
if match:
office_version = match.group(1)
uninstall(office_root, office_version, wow64_flags)
i += 1
winreg.CloseKey(office_root)
示例2: getRegKey
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_WOW64_32KEY [as 别名]
def getRegKey(registry, key, architecture=None):
""" Returns a _winreg hkey or none.
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:
A _winreg handle object
"""
# Do not want to import _winreg unless it is neccissary
regKey = None
import _winreg
aReg = _winreg.ConnectRegistry(None, getattr(_winreg, registry))
if architecture == 32:
sam = _winreg.KEY_WOW64_32KEY
elif architecture == 64:
sam = _winreg.KEY_WOW64_64KEY
else:
sam = 0
try:
regKey = _winreg.OpenKey(aReg, key, 0, _winreg.KEY_READ | sam)
except WindowsError:
pass
return regKey
示例3: _get_arch
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_WOW64_32KEY [as 别名]
def _get_arch(flags):
if flags & winreg.KEY_WOW64_64KEY:
return "64 bit"
elif flags & winreg.KEY_WOW64_32KEY:
return "32 bit"
return "unknown"
示例4: Reg32GetValue
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_WOW64_32KEY [as 别名]
def Reg32GetValue(rootkey, keyname, valname):
key, val = None, None
try:
key = reg.OpenKey(rootkey, keyname, 0, reg.KEY_READ | reg.KEY_WOW64_32KEY)
val = str(reg.QueryValueEx(key, valname)[0])
except WindowsError:
pass
finally:
if key is not None:
reg.CloseKey(key)
return val