本文整理匯總了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