%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/reg.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z e j e � Z d � Z d � Z e e d e e e e e e d � Z e e d � Z e d � Z d S( u� 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 i ( t absolute_importt print_functiont unicode_literalsNc C@ s\ d t k r t d f Sd t k r, t d f Sd t k rB t d f Sd t k rX t d f Sd S( u2 Load this state if the reg module exists u reg.read_valueuF reg state module failed to load: missing util function: reg.read_valueu reg.set_valueuE reg state module failed to load: missing util function: reg.set_valueu reg.delete_valueuH reg state module failed to load: missing util function: reg.delete_valueu reg.delete_key_recursiveuP reg state module failed to load: missing util function: reg.delete_key_recursiveu reg( t __utils__t False( ( ( s3 /usr/lib/python2.7/site-packages/salt/states/reg.pyt __virtual__Q s c C@ s7 | j d � } | j d � } d j | � } | | f S( u% split the hive from the key u \i ( t splitt popt join( t keyt spltt hive( ( s3 /usr/lib/python2.7/site-packages/salt/states/reg.pyt _parse_keyh s u REG_SZc C@ s� i | d 6t d 6i d 6i d 6d d 6} t | � \ } } t d d | d | d | d | � } | | d k ow | d rd j | r� t j j j | d � n d t j j j | d � � | d <t d d d j | | g � d | r� d n d d | d | d | d | d | d | � Sn t d d | d | � } i d j | | � d! 6d"