Python six.moves.winreg.REG_DWORD Examples
The following are 28
code examples of six.moves.winreg.REG_DWORD().
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
six.moves.winreg
, or try the search function
.
Example #1
Source File: win.py From telegram-robot-rss with Mozilla Public License 2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #2
Source File: win.py From android_universal with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #3
Source File: win.py From aws-kube-codesuite with Apache License 2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #4
Source File: win.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #5
Source File: win.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #6
Source File: win.py From CogAlg with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #7
Source File: win.py From bazarr with GNU General Public License v3.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #8
Source File: win.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #9
Source File: win.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #10
Source File: win.py From aws-extender with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #11
Source File: win.py From planespotter with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #12
Source File: win.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #13
Source File: win.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #14
Source File: win.py From bash-lambda-layer with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #15
Source File: win.py From plugin.video.emby with GNU General Public License v3.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #16
Source File: win.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #17
Source File: win.py From pipenv with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #18
Source File: win.py From deepWordBug with Apache License 2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #19
Source File: win.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #20
Source File: win.py From vnpy_crypto with MIT License | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #21
Source File: win.py From faces with GNU General Public License v2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #22
Source File: win.py From faces with GNU General Public License v2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #23
Source File: win.py From recruit with Apache License 2.0 | 6 votes |
def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout
Example #24
Source File: windows.py From cloudbase-init with Apache License 2.0 | 5 votes |
def set_real_time_clock_utc(self, utc): with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'SYSTEM\\CurrentControlSet\\Control\\' 'TimeZoneInformation', 0, winreg.KEY_ALL_ACCESS) as key: winreg.SetValueEx(key, 'RealTimeIsUniversal', 0, winreg.REG_DWORD, 1 if utc else 0)
Example #25
Source File: windows.py From cloudbase-init with Apache License 2.0 | 5 votes |
def set_config_value(self, name, value, section=None): key_name = self._get_config_key_name(section) with winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, key_name) as key: if type(value) == int: regtype = winreg.REG_DWORD else: regtype = winreg.REG_SZ winreg.SetValueEx(key, name, 0, regtype, value)
Example #26
Source File: windows.py From cloudbase-init with Apache License 2.0 | 5 votes |
def _fix_network_adapter_dhcp(interface_name, enable_dhcp, address_family): interface_id = WindowsUtils._get_network_adapter(interface_name).GUID tcpip_key = "Tcpip6" if address_family == AF_INET6 else "Tcpip" with winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\services\\%(tcpip_key)s\\" "Parameters\\Interfaces\\%(interface_id)s" % {"tcpip_key": tcpip_key, "interface_id": interface_id}, 0, winreg.KEY_SET_VALUE) as key: winreg.SetValueEx( key, 'EnableDHCP', 0, winreg.REG_DWORD, 1 if enable_dhcp else 0)
Example #27
Source File: rdp.py From cloudbase-init with Apache License 2.0 | 5 votes |
def set_rdp_keepalive(enable, interval=1): with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Policies\\Microsoft\\' 'Windows NT\\Terminal Services', 0, winreg.KEY_ALL_ACCESS) as key: LOG.debug("Setting RDP KeepAliveEnabled: %s", enable) winreg.SetValueEx( key, 'KeepAliveEnable', 0, winreg.REG_DWORD, 1 if enable else 0) LOG.debug("Setting RDP keepAliveInterval (minutes): %s", interval) winreg.SetValueEx( key, 'keepAliveInterval', 0, winreg.REG_DWORD, interval)
Example #28
Source File: security.py From cloudbase-init with Apache License 2.0 | 5 votes |
def set_uac_remote_restrictions(self, enable=True): with winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, self._SYSTEM_POLICIES_KEY) as key_name: winreg.SetValueEx(key_name, self._LATFP_VALUE_NAME, 0, winreg.REG_DWORD, int(not enable))