mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #45694 from twangboy/win_reg_add_keys
Add support for additional reg keys
This commit is contained in:
commit
a550e8d25d
1 changed files with 21 additions and 3 deletions
|
@ -95,9 +95,13 @@ class Registry(object): # pylint: disable=R0903
|
|||
'''
|
||||
def __init__(self):
|
||||
self.hkeys = {
|
||||
'HKEY_CURRENT_CONFIG': win32con.HKEY_CURRENT_CONFIG,
|
||||
'HKEY_CLASSES_ROOT': win32con.HKEY_CLASSES_ROOT,
|
||||
'HKEY_CURRENT_USER': win32con.HKEY_CURRENT_USER,
|
||||
'HKEY_LOCAL_MACHINE': win32con.HKEY_LOCAL_MACHINE,
|
||||
'HKEY_USERS': win32con.HKEY_USERS,
|
||||
'HKCC': win32con.HKEY_CURRENT_CONFIG,
|
||||
'HKCR': win32con.HKEY_CLASSES_ROOT,
|
||||
'HKCU': win32con.HKEY_CURRENT_USER,
|
||||
'HKLM': win32con.HKEY_LOCAL_MACHINE,
|
||||
'HKU': win32con.HKEY_USERS,
|
||||
|
@ -130,9 +134,11 @@ class Registry(object): # pylint: disable=R0903
|
|||
# delete_key_recursive uses this to check the subkey contains enough \
|
||||
# as we do not want to remove all or most of the registry
|
||||
self.subkey_slash_check = {
|
||||
win32con.HKEY_CURRENT_USER: 0,
|
||||
win32con.HKEY_LOCAL_MACHINE: 1,
|
||||
win32con.HKEY_USERS: 1
|
||||
win32con.HKEY_CURRENT_USER: 0,
|
||||
win32con.HKEY_LOCAL_MACHINE: 1,
|
||||
win32con.HKEY_USERS: 1,
|
||||
win32con.HKEY_CURRENT_CONFIG: 1,
|
||||
win32con.HKEY_CLASSES_ROOT: 1
|
||||
}
|
||||
|
||||
self.registry_32 = {
|
||||
|
@ -203,6 +209,8 @@ def list_keys(hive, key=None, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name. If a key is
|
||||
not passed, the keys under the hive will be returned.
|
||||
|
@ -257,6 +265,8 @@ def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name. If a key is
|
||||
not passed, the values under the hive will be returned.
|
||||
|
@ -325,6 +335,8 @@ def read_value(hive, key, vname=None, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name.
|
||||
|
||||
|
@ -422,6 +434,8 @@ def set_value(hive,
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name.
|
||||
|
||||
|
@ -562,6 +576,8 @@ def delete_key_recursive(hive, key, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param key: The key to remove (looks like a path)
|
||||
|
||||
|
@ -656,6 +672,8 @@ def delete_value(hive, key, vname=None, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue