Python _winreg.KEY_WOW64_32KEY Examples

The following are 4 code examples of _winreg.KEY_WOW64_32KEY(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module _winreg , or try the search function .
Example #1
Source File: uninstall.py    From pyxll-examples with The Unlicense 6 votes vote down vote up
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) 
Example #2
Source File: winregistry.py    From cross3d with MIT License 5 votes vote down vote up
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 
Example #3
Source File: uninstall.py    From pyxll-examples with The Unlicense 5 votes vote down vote up
def _get_arch(flags):
    if flags & winreg.KEY_WOW64_64KEY:
        return "64 bit"
    elif flags & winreg.KEY_WOW64_32KEY:
        return "32 bit"
    return "unknown" 
Example #4
Source File: fuse.py    From ff4d with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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