当前位置: 首页>>代码示例>>Python>>正文


Python winreg.REG_DWORD属性代码示例

本文整理汇总了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 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:26,代码来源:win.py

示例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)) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:7,代码来源:security.py

示例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) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:13,代码来源:rdp.py

示例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) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:15,代码来源:windows.py

示例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) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:12,代码来源:windows.py

示例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) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:9,代码来源:windows.py


注:本文中的six.moves.winreg.REG_DWORD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。