File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/reg.cpython-310.pyc
o
�N�gvL � @ sb d Z ddlZddlZe�e�Zdd� Zdd� Z dd
d�Z ddd
�Z
ddd�ZdS )a�
Manage the Windows registry
===========================
Many python developers think of registry keys as if they were python keys in a
dictionary which is not the case. The windows registry is broken down into the
following components:
Hives
-----
This is the top level of the registry. They all begin with HKEY.
- HKEY_CLASSES_ROOT (HKCR)
- HKEY_CURRENT_USER (HKCU)
- HKEY_LOCAL MACHINE (HKLM)
- HKEY_USER (HKU)
- HKEY_CURRENT_CONFIG
Keys
----
Hives contain keys. These are basically the folders beneath the hives. They can
contain any number of subkeys.
When passing the hive\key values they must be quoted correctly depending on the
backslashes being used (``\`` vs ``\\``). The way backslashes are handled in
the state file is different from the way they are handled when working on the
CLI. The following are valid methods of passing the hive\key:
Using single backslashes:
HKLM\SOFTWARE\Python
'HKLM\SOFTWARE\Python'
Using double backslashes:
"HKLM\\SOFTWARE\\Python"
Values or Entries
-----------------
Values or Entries are the name/data pairs beneath the keys and subkeys. All keys
have a default name/data pair. The name is ``(Default)`` with a displayed value
of ``(value not set)``. The actual value is Null.
Example
-------
The following example is taken from the windows startup portion of the registry:
.. code-block:: text
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"RTHDVCPL"="\"C:\\Program Files\\Realtek\\Audio\\HDA\\RtkNGUI64.exe\" -s"
"NvBackend"="\"C:\\Program Files (x86)\\NVIDIA Corporation\\Update Core\\NvBackend.exe\""
"BTMTrayAgent"="rundll32.exe \"C:\\Program Files (x86)\\Intel\\Bluetooth\\btmshellex.dll\",TrayApp"
In this example these are the values for each:
Hive:
``HKEY_LOCAL_MACHINE``
Key and subkeys:
``SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run``
Value:
- There are 3 value names: ``RTHDVCPL``, ``NvBackend``, and ``BTMTrayAgent``
- Each value name has a corresponding value
� Nc C s4 dt vrdS dt vrdS dt vrdS dt vrdS d S )
z2
Load this state if the reg module exists
�reg.read_value)FzFreg state module failed to load: missing util function: reg.read_value�
reg.set_value)FzEreg state module failed to load: missing util function: reg.set_value�reg.delete_value)FzHreg state module failed to load: missing util function: reg.delete_value�reg.delete_key_recursive)FzPreg state module failed to load: missing util function: reg.delete_key_recursive�reg)� __utils__� r r �C/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/reg.py�__virtual__O s r
c C s&