本文整理汇总了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),
)
示例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"
示例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)
示例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
示例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)
示例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)
示例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
示例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)
示例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
示例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)
示例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))
示例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
示例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
示例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"
示例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)