本文整理汇总了Python中six.moves.winreg.REG_DWORD属性的典型用法代码示例。如果您正苦于以下问题:Python winreg.REG_DWORD属性的具体用法?Python winreg.REG_DWORD怎么用?Python winreg.REG_DWORD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类six.moves.winreg
的用法示例。
在下文中一共展示了winreg.REG_DWORD属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: valuestodict
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import REG_DWORD [as 别名]
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
示例2: set_uac_remote_restrictions
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import REG_DWORD [as 别名]
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))
示例3: set_rdp_keepalive
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import REG_DWORD [as 别名]
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)
示例4: _fix_network_adapter_dhcp
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import REG_DWORD [as 别名]
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)
示例5: set_config_value
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import REG_DWORD [as 别名]
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)
示例6: set_real_time_clock_utc
# 需要导入模块: from six.moves import winreg [as 别名]
# 或者: from six.moves.winreg import REG_DWORD [as 别名]
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)