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


Python _winreg.KEY_ALL_ACCESS属性代码示例

本文整理汇总了Python中_winreg.KEY_ALL_ACCESS属性的典型用法代码示例。如果您正苦于以下问题:Python _winreg.KEY_ALL_ACCESS属性的具体用法?Python _winreg.KEY_ALL_ACCESS怎么用?Python _winreg.KEY_ALL_ACCESS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在_winreg的用法示例。


在下文中一共展示了_winreg.KEY_ALL_ACCESS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_windows_path_var

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def set_windows_path_var(self, value):
        import ctypes

        with winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) as root:
            with winreg.OpenKey(root, "Environment", 0, winreg.KEY_ALL_ACCESS) as key:
                winreg.SetValueEx(key, "PATH", 0, winreg.REG_EXPAND_SZ, value)

        # Tell other processes to update their environment
        HWND_BROADCAST = 0xFFFF
        WM_SETTINGCHANGE = 0x1A

        SMTO_ABORTIFHUNG = 0x0002

        result = ctypes.c_long()
        SendMessageTimeoutW = ctypes.windll.user32.SendMessageTimeoutW
        SendMessageTimeoutW(
            HWND_BROADCAST,
            WM_SETTINGCHANGE,
            0,
            u"Environment",
            SMTO_ABORTIFHUNG,
            5000,
            ctypes.byref(result),
        ) 
开发者ID:python-poetry,项目名称:poetry,代码行数:26,代码来源:get-poetry.py

示例2: get_proxy_state

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def get_proxy_state(self):
        REG_PATH = r'Software\Microsoft\Windows\CurrentVersion\Internet Settings'
        INTERNET_SETTINGS = winreg.OpenKey(winreg.HKEY_CURRENT_USER,REG_PATH,0, winreg.KEY_ALL_ACCESS)
        try:
            AutoConfigURL, reg_type = winreg.QueryValueEx(INTERNET_SETTINGS, 'AutoConfigURL')
            if AutoConfigURL:
                return "auto"
        except Exception as e:
            pass

        try:
            ProxyEnable, reg_type = winreg.QueryValueEx(INTERNET_SETTINGS, 'ProxyEnable')
            if ProxyEnable:
                return "enable"
        except Exception as e:
            pass
        return "disable" 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:19,代码来源:win_tray.py

示例3: set_envvar_in_registry

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def set_envvar_in_registry(envvar, value):
    try:
        import winreg
    except ImportError:
        import _winreg as winreg

    reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
    with winreg.OpenKey(reg, KEY, 0, winreg.KEY_ALL_ACCESS) as regkey:
        winreg.SetValueEx(regkey, envvar, 0, winreg.REG_EXPAND_SZ, value) 
开发者ID:coala,项目名称:coala-quickstart,代码行数:11,代码来源:store_env_in_registry.py

示例4: get_windows_path_var

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def get_windows_path_var(self):
        with winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) as root:
            with winreg.OpenKey(root, "Environment", 0, winreg.KEY_ALL_ACCESS) as key:
                path, _ = winreg.QueryValueEx(key, "PATH")

                return path 
开发者ID:python-poetry,项目名称:poetry,代码行数:8,代码来源:get-poetry.py

示例5: __init__

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def __init__(self):
        icon_path = os.path.join(os.path.dirname(__file__), "web_ui", "favicon.ico")
        self.systray = SysTrayIcon(icon_path, "OSS-FTP", self.make_menu(), self.on_quit, left_click=self.on_show, right_click=self.on_right_click)

        reg_path = r'Software\Microsoft\Windows\CurrentVersion\Internet Settings'
        self.INTERNET_SETTINGS = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
            reg_path,
            0, winreg.KEY_ALL_ACCESS) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:10,代码来源:win_tray.py

示例6: get_runonce

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def get_runonce():
        return _winreg.OpenKey(_registry,
                r"Software\Microsoft\Windows\CurrentVersion\Run", 0,
        _winreg.KEY_ALL_ACCESS) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:6,代码来源:autorun.py

示例7: __init__

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def __init__(self, parent, name):
        self.parent, self.name = parent, name
        self.level=parent.level+1
        # ! ! ! opens keys in read/write mode ! ! !
        self.wrk=reg.OpenKey(parent.wrk, self.name, 0, reg.KEY_ALL_ACCESS)
        self._keys = self._vals = None 
开发者ID:ActiveState,项目名称:code,代码行数:8,代码来源:recipe-502268.py

示例8: setenv

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def setenv(self, name, value):
        # Note: for 'system' scope, you must run this as Administrator
        key = winreg.OpenKey(self.root, self.subkey, 0, winreg.KEY_ALL_ACCESS)
        winreg.SetValueEx(key, name, 0, winreg.REG_EXPAND_SZ, value)
        winreg.CloseKey(key)
        # For some strange reason, calling SendMessage from the current process
        # doesn't propagate environment changes at all.
        # TODO: handle CalledProcessError (for assert)
        check_call('''\
"%s" -c "import win32api, win32con; assert win32api.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SETTINGCHANGE, 0, 'Environment')"''' % sys.executable) 
开发者ID:ActiveState,项目名称:code,代码行数:12,代码来源:recipe-577621.py

示例9: __delitem__

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def __delitem__(self, k):
        key, subkey = self._compute_subkey(k)
        with _winreg.OpenKey(self._hive, key,
                             0, _winreg.KEY_ALL_ACCESS) as root_key:
            try:
                _winreg.DeleteValue(root_key, subkey)
            except WindowsError:
                try:
                    _winreg.DeleteKey(root_key, subkey)
                except WindowsError:
                    raise KeyError 
开发者ID:ActiveState,项目名称:code,代码行数:13,代码来源:recipe-577381.py

示例10: create_registry_entry

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def create_registry_entry(product, arc_version):
    """Create a registry link back to the arcgisbinding package."""
    root_key = winreg.HKEY_CURRENT_USER
    if product == 'Pro':
        product_name = "ArcGISPro"
    else:
        product_name = "Desktop{}".format(arc_version)
    reg_path = "SOFTWARE\\Esri\\{}".format(product_name)

    package_key = 'RintegrationProPackagePath'
    link_key = None

    try:
        full_access = (winreg.KEY_WOW64_64KEY + winreg.KEY_ALL_ACCESS)
        # find the key, 64- or 32-bit we want it all
        link_key = winreg.OpenKey(root_key, reg_path, 0, full_access)
    except fnf_exception as error:
        handle_fnf(error)

    if link_key:
        try:
            arcpy.AddMessage("Using registry key to link install.")
            binding_path = "{}\\{}".format(r_lib_path(), "arcgisbinding")
            winreg.SetValueEx(link_key, package_key, 0,
                              winreg.REG_SZ, binding_path)
        except fnf_exception as error:
            handle_fnf(error) 
开发者ID:R-ArcGIS,项目名称:r-bridge-install,代码行数:29,代码来源:install_package.py

示例11: _remove_registry_key

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def _remove_registry_key(value=None, name='Java-Update-Manager'):
    try:
        if _methods['registry_key'].established:
            value = _methods['registry_key'].result
            try:
                key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 0, _winreg.KEY_ALL_ACCESS)
                _winreg.DeleteValue(key, name)
                _winreg.CloseKey(key)
                return (False, None)
            except: pass
        return (_methods['registry_key'].established, _methods['registry_key'].result)
    except Exception as e:
        util.log(str(e)) 
开发者ID:malwaredllc,项目名称:byob,代码行数:15,代码来源:persistence.py

示例12: regload

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def regload(path, leaf):
    key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, path, 0,
                          _winreg.KEY_ALL_ACCESS)
    try:
        value = _winreg.QueryValueEx(key, leaf)[0]
    except WindowsError:
        value = None
    return value 
开发者ID:rajeshmajumdar,项目名称:BruteXSS,代码行数:10,代码来源:_msiecookiejar.py

示例13: AddOrRemoveHIDKeys

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def AddOrRemoveHIDKeys(isInstall):
    HID_SUB_KEY = "SYSTEM\\CurrentControlSet\\Services\\HidIr\\Remotes\\745a17a0-74d3-11d0-b6fe-00a0c90f57d"
    ValuesToCheck = ['a','b']
    for a in ValuesToCheck:
        tmpkey = HID_SUB_KEY+a
        try:
            key = reg.OpenKey(reg.HKEY_LOCAL_MACHINE, tmpkey, 0, reg.KEY_ALL_ACCESS)
            for i in xrange(4):
                valueName = 'CodeSetNum%i' % i
                if isInstall:
                    reg.DeleteValue(key, valueName)
                else:
                    reg.SetValueEx(key, valueName, 0, reg.REG_DWORD, i + 1)
        except WindowsError:
            continue 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:17,代码来源:Install.py

示例14: Uninstall

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def Uninstall():
    AddOrRemoveHIDKeys(False)
    key = reg.OpenKey(reg.HKEY_LOCAL_MACHINE, ServiceKey, 0, reg.KEY_ALL_ACCESS)
    reg.DeleteKey(key, "AlternateMceIrService")
    service = Service(u"AlternateMceIrService")
    service.Stop()
    service.Uninstall()
    print "Service successfully uninstalled" 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:10,代码来源:Install.py

示例15: SetHidState

# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import KEY_ALL_ACCESS [as 别名]
def SetHidState(self, disableHid):
        """
        Sets the HID registry values. Will raise WindowsError if not
        successful.
        """
        key = reg.OpenKey(
            reg.HKEY_LOCAL_MACHINE, HID_SUB_KEY, 0, reg.KEY_ALL_ACCESS
        )
        for i in xrange(4):
            valueName = 'CodeSetNum%i' % i
            if disableHid:
                reg.DeleteValue(key, valueName)
            else:
                reg.SetValueEx(key, valueName, 0, reg.REG_DWORD, i + 1) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:16,代码来源:__init__.py


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