File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/win_reg.cpython-310.pyc
o
�N�gHz � @ s d Z ddlZddlZddlZddlmZ zddlZddlZddl Z dZ
W n ey/ dZ
Y nw e�e
�ZdZdd� Zd d
� Zdd� ZG d
d� d�Zd$dd�Zd$dd�Zdd� Zd%dd�Zd%dd�Zd%dd�Z d&dd�Zd'dd�Zd$d d!�Zd%d"d#�ZdS )(aM
Manage the Windows registry
-----
Hives
-----
Hives are the main sections of the registry and all begin with the word HKEY.
- HKEY_LOCAL_MACHINE
- HKEY_CURRENT_USER
- HKEY_USER
----
Keys
----
Keys are the folders in the registry. Keys can have many nested subkeys. Keys
can have a value assigned to them under the (Default) value name
-----------------
Values or Entries
-----------------
Values/Entries are name/data pairs. There can be many values in a key. The
(Default) value corresponds to the Key itself, the rest are their own name/value
pairs.
:depends: PyWin32
� N)�CommandExecutionErrorTFZregc C s t jj�� sdS tsdS tS )z8
Only works on Windows systems with the PyWin32
)FzPreg execution module failed to load: The module will only run on Windows systems)Fznreg execution module failed to load: One of the following libraries did not load: win32gui, win32con, win32api)�salt�utils�platformZ
is_windows�HAS_WINDOWS_MODULES�__virtualname__� r r �F/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/win_reg.py�__virtual__3 s
r
c C s t jj�| d�S )zq
Converts unicode to current users character encoding. Use this for values
returned by reg functions
�mbcs)r r �stringutils�
to_unicode��vdatar r r �_to_mbcsI s r c C s. | du rd} t | t�rt| �} tjj�| d�S )z|
Converts from current users character encoding to unicode. Use this for
parameters being pass to reg functions
N� �utf-8)�
isinstance�int�strr r r r
r r r r �_to_unicodeQ s
r c @ s e Zd ZdZdd� Zdd� ZdS )�Registryz�
This was put in a class to delay usage until this module is actually used
This class contains all the lookup dicts for working with the registry
c C s� t jt jt jt jt jt jt jt jt jt jd�
| _dt jt jt j t j
t jt jd�| _
ddd�| _ddt jdt jdt j d t j
d
t jdt jdi| _d
dd�| _t jdt jdt jdt jdt jdi| _t jt jB t jd�| _d S )N)
�HKEY_CURRENT_CONFIG�HKEY_CLASSES_ROOT�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�
HKEY_USERSZHKCCZHKCRZHKCUZHKLMZHKUr )�REG_NONE�
REG_BINARY� REG_DWORD�
REG_EXPAND_SZ�REG_MULTI_SZ�REG_SZ� REG_QWORD� )�REG_OPTION_NON_VOLATILE�REG_OPTION_VOLATILEr r r r r! r"