Python _winreg.QueryInfoKey() Examples
The following are 30
code examples of _winreg.QueryInfoKey().
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: terminal.py From collection with MIT License | 6 votes |
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
Example #2
Source File: win.py From luci-py with Apache License 2.0 | 6 votes |
def get_reboot_required(): """Returns True if the system should be rebooted to apply updates. This is not guaranteed to notice all conditions that could require reboot. """ # Based on https://stackoverflow.com/a/45717438 k = None import _winreg try: k = _winreg.OpenKey( _winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\' 'Auto Update\\RebootRequired') _, num_values, _ = _winreg.QueryInfoKey(k) return num_values > 0 except WindowsError: # pylint: disable=undefined-variable # This error very likely means the RebootRequired key does not exist, # meaning reboot is not required. return False finally: if k: k.Close()
Example #3
Source File: terminal.py From terminal with MIT License | 6 votes |
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
Example #4
Source File: recipe-502268.py From code with MIT License | 6 votes |
def __init__(self): self.hkey={} for key in (k for k in dir(reg) if k.startswith('HKEY_')): try: chk = reg.ConnectRegistry(None, getattr(reg, key)) inf = reg.QueryInfoKey(chk) reg.CloseKey(chk) except WindowsError: pass # some keys may appear in _winreg but can't be reached else: hk = Hkey(key) try: chk=hk.keys except WindowsError: pass # some keys can be accessed but not enumerated else: # some keys work fine ... name=key[5:].lower() self.hkey[name]=hk # for iterating setattr(self, name, hk) # for easy access
Example #5
Source File: DS301_index.py From CANFestivino with GNU Lesser General Public License v2.1 | 6 votes |
def get_acroversion(): " Return version of Adobe Acrobat executable or None" import _winreg adobesoft = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'Software\Adobe') for index in range(_winreg.QueryInfoKey(adobesoft)[0]): key = _winreg.EnumKey(adobesoft, index) if "acrobat" in key.lower(): acrokey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'Software\\Adobe\\%s' % key) for index in range(_winreg.QueryInfoKey(acrokey)[0]): numver = _winreg.EnumKey(acrokey, index) try: res = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE, 'Software\\Adobe\\%s\\%s\\InstallPath' % (key, numver)) return res except: pass return None
Example #6
Source File: winregistry.py From cross3d with MIT License | 6 votes |
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
Example #7
Source File: win32.py From komodo-wakatime with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #8
Source File: win32.py From plugin.video.iptv.recorder with GNU General Public License v3.0 | 5 votes |
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
Example #9
Source File: tzwin.py From SmartAlarmClock with MIT License | 5 votes |
def list(): """Return a list of all time zones known to the system.""" handle = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) tzkey = _winreg.OpenKey(handle, TZKEYNAME) result = [_winreg.EnumKey(tzkey, i) for i in range(_winreg.QueryInfoKey(tzkey)[0])] tzkey.Close() handle.Close() return result
Example #10
Source File: tzwin.py From SmartAlarmClock with MIT License | 5 votes |
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
Example #11
Source File: registry_obj.py From Fastir_Collector with GNU General Public License v3.0 | 5 votes |
def get_last_written_time(self): return utils.utils.convert_windate(QueryInfoKey(self.key)[2])
Example #12
Source File: registry_obj.py From Fastir_Collector with GNU General Public License v3.0 | 5 votes |
def get_number_of_sub_keys(self): return QueryInfoKey(self.key)[0]
Example #13
Source File: registry_obj.py From Fastir_Collector with GNU General Public License v3.0 | 5 votes |
def get_number_of_values(self): return QueryInfoKey(self.key)[1]
Example #14
Source File: win32.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
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
Example #15
Source File: tzwin.py From Crunchyroll-XML-Decoder with GNU General Public License v2.0 | 5 votes |
def list(): """Return a list of all time zones known to the system.""" handle = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) tzkey = _winreg.OpenKey(handle, TZKEYNAME) result = [_winreg.EnumKey(tzkey, i) for i in range(_winreg.QueryInfoKey(tzkey)[0])] tzkey.Close() handle.Close() return result
Example #16
Source File: tzwin.py From Crunchyroll-XML-Decoder with GNU General Public License v2.0 | 5 votes |
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
Example #17
Source File: win32.py From bazarr with GNU General Public License v3.0 | 5 votes |
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
Example #18
Source File: tzwin.py From script.tv.show.next.aired with GNU General Public License v2.0 | 5 votes |
def list(): """Return a list of all time zones known to the system.""" handle = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) tzkey = _winreg.OpenKey(handle, TZKEYNAME) result = [_winreg.EnumKey(tzkey, i) for i in range(_winreg.QueryInfoKey(tzkey)[0])] tzkey.Close() handle.Close() return result
Example #19
Source File: tzwin.py From script.tv.show.next.aired with GNU General Public License v2.0 | 5 votes |
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
Example #20
Source File: windows.py From mbed-os-tools with Apache License 2.0 | 5 votes |
def _iter_keys_as_str(key): """! Iterate over subkeys of a key returning subkey as string """ for i in range(winreg.QueryInfoKey(key)[0]): yield winreg.EnumKey(key, i)
Example #21
Source File: windows.py From mbed-os-tools with Apache License 2.0 | 5 votes |
def _iter_keys(key): """! Iterate over subkeys of a key """ for i in range(winreg.QueryInfoKey(key)[0]): yield winreg.OpenKey(key, winreg.EnumKey(key, i))
Example #22
Source File: windows.py From mbed-os-tools with Apache License 2.0 | 5 votes |
def _iter_vals(key): """! Iterate over values of a key """ logger.debug("_iter_vals %r", key) for i in range(winreg.QueryInfoKey(key)[1]): yield winreg.EnumValue(key, i)
Example #23
Source File: win32.py From Tautulli with GNU General Public License v3.0 | 5 votes |
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
Example #24
Source File: regobj.py From NVDARemote with GNU General Public License v2.0 | 5 votes |
def __len__(self): """len() gives the number of values and subkeys.""" info = _winreg.QueryInfoKey(self.hkey) return info[0] + info[1]
Example #25
Source File: regobj.py From NVDARemote with GNU General Public License v2.0 | 5 votes |
def __len__(self): return _winreg.QueryInfoKey(self.key.hkey)[0]
Example #26
Source File: regobj.py From NVDARemote with GNU General Public License v2.0 | 5 votes |
def __len__(self): return _winreg.QueryInfoKey(self.key.hkey)[1]
Example #27
Source File: _win32.py From sndlatr with Apache License 2.0 | 5 votes |
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
Example #28
Source File: tzwin.py From Computable with MIT License | 5 votes |
def list(): """Return a list of all time zones known to the system.""" handle = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) tzkey = _winreg.OpenKey(handle, TZKEYNAME) result = [_winreg.EnumKey(tzkey, i) for i in range(_winreg.QueryInfoKey(tzkey)[0])] tzkey.Close() handle.Close() return result
Example #29
Source File: tzwin.py From Computable with MIT License | 5 votes |
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
Example #30
Source File: tzwin.py From crunchy-xml-decoder with GNU General Public License v2.0 | 5 votes |
def list(): """Return a list of all time zones known to the system.""" handle = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) tzkey = _winreg.OpenKey(handle, TZKEYNAME) result = [_winreg.EnumKey(tzkey, i) for i in range(_winreg.QueryInfoKey(tzkey)[0])] tzkey.Close() handle.Close() return result