Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/_winreg.rst

    r2 r391  
    88
    99.. note::
    10    The :mod:`_winreg` module has been renamed to :mod:`winreg` in Python 3.0.
     10   The :mod:`_winreg` module has been renamed to :mod:`winreg` in Python 3.
    1111   The :term:`2to3` tool will automatically adapt imports when converting your
    12    sources to 3.0.
     12   sources to Python 3.
    1313
    1414
     
    1616
    1717These functions expose the Windows registry API to Python.  Instead of using an
    18 integer as the registry handle, a handle object is used to ensure that the
    19 handles are closed correctly, even if the programmer neglects to explicitly
    20 close them.
    21 
    22 This module exposes a very low-level interface to the Windows registry; it is
    23 expected that in the future a new ``winreg``  module will be created offering a
    24 higher-level interface to the registry API.
     18integer as the registry handle, a :ref:`handle object <handle-object>` is used
     19to ensure that the handles are closed correctly, even if the programmer neglects
     20to explicitly close them.
    2521
    2622This module offers the following functions:
     
    2925.. function:: CloseKey(hkey)
    3026
    31    Closes a previously opened registry key. The hkey argument specifies a
     27   Closes a previously opened registry key.  The *hkey* argument specifies a
    3228   previously opened key.
    3329
    34    Note that if *hkey* is not closed using this method (or via
    35    :meth:`handle.Close`), it is closed when the *hkey* object is destroyed by
    36    Python.
     30   .. note::
     31      If *hkey* is not closed using this method (or via :meth:`hkey.Close() <PyHKEY.Close>`),
     32      it is closed when the *hkey* object is destroyed by Python.
    3733
    3834
    3935.. function:: ConnectRegistry(computer_name, key)
    4036
    41    Establishes a connection to a predefined registry handle on  another computer,
    42    and returns a :dfn:`handle object`
    43 
    44    *computer_name* is the name of the remote computer, of the  form
     37   Establishes a connection to a predefined registry handle on another computer,
     38   and returns a :ref:`handle object <handle-object>`.
     39
     40   *computer_name* is the name of the remote computer, of the form
    4541   ``r"\\computername"``.  If ``None``, the local computer is used.
    4642
     
    4844
    4945   The return value is the handle of the opened key. If the function fails, a
    50    :exc:`WindowsError` exception is  raised.
     46   :exc:`WindowsError` exception is raised.
    5147
    5248
    5349.. function:: CreateKey(key, sub_key)
    5450
    55    Creates or opens the specified key, returning a :dfn:`handle object`
    56 
    57    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    58    constants.
    59 
    60    *sub_key* is a string that names the key this method opens  or creates.
    61 
    62    If *key* is one of the predefined keys, *sub_key* may  be ``None``. In that
    63    case, the handle returned is the same key handle  passed in to the function.
     51   Creates or opens the specified key, returning a
     52   :ref:`handle object <handle-object>`.
     53
     54   *key* is an already open key, or one of the predefined
     55   :ref:`HKEY_* constants <hkey-constants>`.
     56
     57   *sub_key* is a string that names the key this method opens or creates.
     58
     59   If *key* is one of the predefined keys, *sub_key* may be ``None``. In that
     60   case, the handle returned is the same key handle passed in to the function.
    6461
    6562   If the key already exists, this function opens the existing key.
    6663
    6764   The return value is the handle of the opened key. If the function fails, a
    68    :exc:`WindowsError` exception is  raised.
     65   :exc:`WindowsError` exception is raised.
     66
     67
     68.. function:: CreateKeyEx(key, sub_key[, res[, sam]])
     69
     70   Creates or opens the specified key, returning a
     71   :ref:`handle object <handle-object>`.
     72
     73   *key* is an already open key, or one of the predefined
     74   :ref:`HKEY_* constants <hkey-constants>`.
     75
     76   *sub_key* is a string that names the key this method opens or creates.
     77
     78   *res* is a reserved integer, and must be zero. The default is zero.
     79
     80   *sam* is an integer that specifies an access mask that describes the desired
     81   security access for the key.  Default is :const:`KEY_ALL_ACCESS`.  See
     82   :ref:`Access Rights <access-rights>` for other allowed values.
     83
     84
     85   If *key* is one of the predefined keys, *sub_key* may be ``None``. In that
     86   case, the handle returned is the same key handle passed in to the function.
     87
     88   If the key already exists, this function opens the existing key.
     89
     90   The return value is the handle of the opened key. If the function fails, a
     91   :exc:`WindowsError` exception is raised.
     92
     93.. versionadded:: 2.7
    6994
    7095
     
    7398   Deletes the specified key.
    7499
    75    *key* is an already open key, or any one of the predefined  :const:`HKEY_\*`
    76    constants.
    77 
    78    *sub_key* is a string that must be a subkey of the key  identified by the *key*
    79    parameter.  This value must not be  ``None``, and the key may not have subkeys.
     100   *key* is an already open key, or any one of the predefined
     101   :ref:`HKEY_* constants <hkey-constants>`.
     102
     103   *sub_key* is a string that must be a subkey of the key identified by the *key*
     104   parameter.  This value must not be ``None``, and the key may not have subkeys.
    80105
    81106   *This method can not delete keys with subkeys.*
    82107
    83108   If the method succeeds, the entire key, including all of its values, is removed.
    84    If the method fails, a :exc:`WindowsError`  exception is raised.
     109   If the method fails, a :exc:`WindowsError` exception is raised.
     110
     111
     112.. function:: DeleteKeyEx(key, sub_key[, sam[, res]])
     113
     114   Deletes the specified key.
     115
     116   .. note::
     117      The :func:`DeleteKeyEx` function is implemented with the RegDeleteKeyEx
     118      Windows API function, which is specific to 64-bit versions of Windows.
     119      See the `RegDeleteKeyEx documentation
     120      <http://msdn.microsoft.com/en-us/library/ms724847%28VS.85%29.aspx>`__.
     121
     122   *key* is an already open key, or any one of the predefined
     123   :ref:`HKEY_* constants <hkey-constants>`.
     124
     125   *sub_key* is a string that must be a subkey of the key identified by the
     126   *key* parameter. This value must not be ``None``, and the key may not have
     127   subkeys.
     128
     129   *res* is a reserved integer, and must be zero. The default is zero.
     130
     131   *sam* is an integer that specifies an access mask that describes the desired
     132   security access for the key.  Default is :const:`KEY_WOW64_64KEY`.  See
     133   :ref:`Access Rights <access-rights>` for other allowed values.
     134
     135
     136   *This method can not delete keys with subkeys.*
     137
     138   If the method succeeds, the entire key, including all of its values, is
     139   removed. If the method fails, a :exc:`WindowsError` exception is raised.
     140
     141   On unsupported Windows versions, :exc:`NotImplementedError` is raised.
     142
     143.. versionadded:: 2.7
    85144
    86145
     
    89148   Removes a named value from a registry key.
    90149
    91    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    92    constants.
     150   *key* is an already open key, or one of the predefined
     151   :ref:`HKEY_* constants <hkey-constants>`.
    93152
    94153   *value* is a string that identifies the value to remove.
     
    99158   Enumerates subkeys of an open registry key, returning a string.
    100159
    101    *key* is an already open key, or any one of the predefined  :const:`HKEY_\*`
    102    constants.
    103 
    104    *index* is an integer that identifies the index of the key to  retrieve.
    105 
    106    The function retrieves the name of one subkey each time it  is called.  It is
    107    typically called repeatedly until a  :exc:`WindowsError` exception is
     160   *key* is an already open key, or any one of the predefined
     161   :ref:`HKEY_* constants <hkey-constants>`.
     162
     163   *index* is an integer that identifies the index of the key to retrieve.
     164
     165   The function retrieves the name of one subkey each time it is called.  It is
     166   typically called repeatedly until a :exc:`WindowsError` exception is
    108167   raised, indicating, no more values are available.
    109168
     
    113172   Enumerates values of an open registry key, returning a tuple.
    114173
    115    *key* is an already open key, or any one of the predefined  :const:`HKEY_\*`
    116    constants.
    117 
    118    *index* is an integer that identifies the index of the value  to retrieve.
    119 
    120    The function retrieves the name of one subkey each time it is  called. It is
    121    typically called repeatedly, until a  :exc:`WindowsError` exception is
    122    raised, indicating  no more values.
     174   *key* is an already open key, or any one of the predefined
     175   :ref:`HKEY_* constants <hkey-constants>`.
     176
     177   *index* is an integer that identifies the index of the value to retrieve.
     178
     179   The function retrieves the name of one subkey each time it is called. It is
     180   typically called repeatedly, until a :exc:`WindowsError` exception is
     181   raised, indicating no more values.
    123182
    124183   The result is a tuple of 3 items:
     
    134193   +-------+--------------------------------------------+
    135194   | ``2`` | An integer that identifies the type of the |
    136    |       | value data                                 |
     195   |       | value data (see table in docs for          |
     196   |       | :meth:`SetValueEx`)                        |
    137197   +-------+--------------------------------------------+
    138198
     
    140200.. function:: ExpandEnvironmentStrings(unicode)
    141201
    142    Expands environment strings %NAME% in unicode string like const:`REG_EXPAND_SZ`::
     202   Expands environment variable placeholders ``%NAME%`` in unicode strings like
     203   :const:`REG_EXPAND_SZ`::
    143204
    144205      >>> ExpandEnvironmentStrings(u"%windir%")
     
    152213   Writes all the attributes of a key to the registry.
    153214
    154    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    155    constants.
     215   *key* is an already open key, or one of the predefined
     216   :ref:`HKEY_* constants <hkey-constants>`.
    156217
    157218   It is not necessary to call :func:`FlushKey` to change a key. Registry changes are
    158    flushed to disk by the registry using its lazy  flusher.  Registry changes are
    159    also flushed to disk at system  shutdown.  Unlike :func:`CloseKey`, the
    160    :func:`FlushKey` method  returns only when all the data has been written to the
     219   flushed to disk by the registry using its lazy flusher.  Registry changes are
     220   also flushed to disk at system shutdown.  Unlike :func:`CloseKey`, the
     221   :func:`FlushKey` method returns only when all the data has been written to the
    161222   registry. An application should only call :func:`FlushKey` if it requires
    162    absolute  certainty that registry changes are on disk.
     223   absolute certainty that registry changes are on disk.
    163224
    164225   .. note::
    165226
    166       If you don't know whether a :func:`FlushKey` call is required, it  probably
     227      If you don't know whether a :func:`FlushKey` call is required, it probably
    167228      isn't.
    168229
     
    170231.. function:: LoadKey(key, sub_key, file_name)
    171232
    172    Creates a subkey under the specified key and stores registration  information
     233   Creates a subkey under the specified key and stores registration information
    173234   from a specified file into that subkey.
    174235
    175    *key* is an already open key, or any of the predefined :const:`HKEY_\*`
    176    constants.
    177 
    178    *sub_key* is a string that identifies the sub_key to load.
     236   *key* is a handle returned by :func:`ConnectRegistry` or one of the constants
     237   :const:`HKEY_USERS` or :const:`HKEY_LOCAL_MACHINE`.
     238
     239   *sub_key* is a string that identifies the subkey to load.
    179240
    180241   *file_name* is the name of the file to load registry data from. This file must
     
    182243   table (FAT) file system, the filename may not have an extension.
    183244
    184    A call to LoadKey() fails if the calling process does not have the
    185    :const:`SE_RESTORE_PRIVILEGE` privilege. Note that privileges are different than
    186    permissions - see the Win32 documentation for more details.
    187 
    188    If *key* is a handle returned by :func:`ConnectRegistry`,  then the path
    189    specified in *fileName* is relative to the  remote computer.
    190 
    191    The Win32 documentation implies *key* must be in the  :const:`HKEY_USER` or
    192    :const:`HKEY_LOCAL_MACHINE` tree. This may or may not be true.
    193 
    194 
    195 .. function:: OpenKey(key, sub_key[, res=0][, sam=KEY_READ])
    196 
    197    Opens the specified key, returning a :dfn:`handle object`
    198 
    199    *key* is an already open key, or any one of the predefined :const:`HKEY_\*`
    200    constants.
     245   A call to :func:`LoadKey` fails if the calling process does not have the
     246   :const:`SE_RESTORE_PRIVILEGE` privilege.  Note that privileges are different
     247   from permissions -- see the `RegLoadKey documentation
     248   <http://msdn.microsoft.com/en-us/library/ms724889%28v=VS.85%29.aspx>`__ for
     249   more details.
     250
     251   If *key* is a handle returned by :func:`ConnectRegistry`, then the path
     252   specified in *file_name* is relative to the remote computer.
     253
     254
     255.. function:: OpenKey(key, sub_key[, res[, sam]])
     256
     257   Opens the specified key, returning a :ref:`handle object <handle-object>`.
     258
     259   *key* is an already open key, or any one of the predefined
     260   :ref:`HKEY_* constants <hkey-constants>`.
    201261
    202262   *sub_key* is a string that identifies the sub_key to open.
     
    204264   *res* is a reserved integer, and must be zero.  The default is zero.
    205265
    206    *sam* is an integer that specifies an access mask that describes  the desired
    207    security access for the key.  Default is :const:`KEY_READ`
     266   *sam* is an integer that specifies an access mask that describes the desired
     267   security access for the key.  Default is :const:`KEY_READ`.  See
     268   :ref:`Access Rights <access-rights>` for other allowed values.
    208269
    209270   The result is a new handle to the specified key.
     
    214275.. function:: OpenKeyEx()
    215276
    216    The functionality of :func:`OpenKeyEx` is provided via :func:`OpenKey`, by the
    217    use of default arguments.
     277   The functionality of :func:`OpenKeyEx` is provided via :func:`OpenKey`,
     278   by the use of default arguments.
    218279
    219280
     
    222283   Returns information about a key, as a tuple.
    223284
    224    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    225    constants.
     285   *key* is an already open key, or one of the predefined
     286   :ref:`HKEY_* constants <hkey-constants>`.
    226287
    227288   The result is a tuple of 3 items:
     
    244305.. function:: QueryValue(key, sub_key)
    245306
    246    Retrieves the unnamed value for a key, as a string
    247 
    248    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    249    constants.
    250 
    251    *sub_key* is a string that holds the name of the subkey with which  the value is
    252    associated.  If this parameter is ``None`` or empty, the  function retrieves the
    253    value set by the :func:`SetValue` method  for the key identified by *key*.
     307   Retrieves the unnamed value for a key, as a string.
     308
     309   *key* is an already open key, or one of the predefined
     310   :ref:`HKEY_* constants <hkey-constants>`.
     311
     312   *sub_key* is a string that holds the name of the subkey with which the value is
     313   associated.  If this parameter is ``None`` or empty, the function retrieves the
     314   value set by the :func:`SetValue` method for the key identified by *key*.
    254315
    255316   Values in the registry have name, type, and data components. This method
     
    261322.. function:: QueryValueEx(key, value_name)
    262323
    263    Retrieves the type and data for a specified value name associated with  an open
    264    registry key.
    265 
    266    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    267    constants.
     324   Retrieves the type and data for a specified value name associated with
     325   an open registry key.
     326
     327   *key* is an already open key, or one of the predefined
     328   :ref:`HKEY_* constants <hkey-constants>`.
    268329
    269330   *value_name* is a string indicating the value to query.
     
    277338   +-------+-----------------------------------------+
    278339   | ``1`` | An integer giving the registry type for |
    279    |       | this value.                             |
     340   |       | this value (see table in docs for       |
     341   |       | :meth:`SetValueEx`)                     |
    280342   +-------+-----------------------------------------+
    281343
     
    285347   Saves the specified key, and all its subkeys to the specified file.
    286348
    287    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    288    constants.
    289 
    290    *file_name* is the name of the file to save registry data to. This file cannot
    291    already exist. If this filename includes an extension, it cannot be used on file
    292    allocation table (FAT) file systems by the :meth:`LoadKey`, :meth:`ReplaceKey`
    293    or  :meth:`RestoreKey` methods.
    294 
    295    If *key* represents a key on a remote computer, the path  described by
     349   *key* is an already open key, or one of the predefined
     350   :ref:`HKEY_* constants <hkey-constants>`.
     351
     352   *file_name* is the name of the file to save registry data to.  This file
     353   cannot already exist. If this filename includes an extension, it cannot be
     354   used on file allocation table (FAT) file systems by the :meth:`LoadKey`
     355   method.
     356
     357   If *key* represents a key on a remote computer, the path described by
    296358   *file_name* is relative to the remote computer. The caller of this method must
    297    possess the :const:`SeBackupPrivilege`  security privilege.  Note that
    298    privileges are different than permissions  - see the Win32 documentation for
    299    more details.
     359   possess the :const:`SeBackupPrivilege` security privilege.  Note that
     360   privileges are different than permissions -- see the
     361   `Conflicts Between User Rights and Permissions documentation
     362   <http://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx>`__
     363   for more details.
    300364
    301365   This function passes NULL for *security_attributes* to the API.
     
    306370   Associates a value with a specified key.
    307371
    308    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    309    constants.
    310 
    311    *sub_key* is a string that names the subkey with which the value  is associated.
     372   *key* is an already open key, or one of the predefined
     373   :ref:`HKEY_* constants <hkey-constants>`.
     374
     375   *sub_key* is a string that names the subkey with which the value is associated.
    312376
    313377   *type* is an integer that specifies the type of the data. Currently this must be
     
    324388   registry.  This helps the registry perform efficiently.
    325389
    326    The key identified by the *key* parameter must have been  opened with
     390   The key identified by the *key* parameter must have been opened with
    327391   :const:`KEY_SET_VALUE` access.
    328392
     
    332396   Stores data in the value field of an open registry key.
    333397
    334    *key* is an already open key, or one of the predefined  :const:`HKEY_\*`
    335    constants.
    336 
    337    *value_name* is a string that names the subkey with which the  value is
     398   *key* is an already open key, or one of the predefined
     399   :ref:`HKEY_* constants <hkey-constants>`.
     400
     401   *value_name* is a string that names the subkey with which the value is
    338402   associated.
    339403
    340    *type* is an integer that specifies the type of the data.   This should be one
    341    of the following constants defined in this module:
    342 
    343    +----------------------------------+---------------------------------------------+
    344    | Constant                         | Meaning                                     |
    345    +==================================+=============================================+
    346    | :const:`REG_BINARY`              | Binary data in any form.                    |
    347    +----------------------------------+---------------------------------------------+
    348    | :const:`REG_DWORD`               | A 32-bit number.                            |
    349    +----------------------------------+---------------------------------------------+
    350    | :const:`REG_DWORD_LITTLE_ENDIAN` | A 32-bit number in little-endian format.    |
    351    +----------------------------------+---------------------------------------------+
    352    | :const:`REG_DWORD_BIG_ENDIAN`    | A 32-bit number in big-endian format.       |
    353    +----------------------------------+---------------------------------------------+
    354    | :const:`REG_EXPAND_SZ`           | Null-terminated string containing           |
    355    |                                  | references to environment variables         |
    356    |                                  | (``%PATH%``).                               |
    357    +----------------------------------+---------------------------------------------+
    358    | :const:`REG_LINK`                | A Unicode symbolic link.                    |
    359    +----------------------------------+---------------------------------------------+
    360    | :const:`REG_MULTI_SZ`            | A sequence of null-terminated strings,      |
    361    |                                  | terminated by two null characters.  (Python |
    362    |                                  | handles  this termination automatically.)   |
    363    +----------------------------------+---------------------------------------------+
    364    | :const:`REG_NONE`                | No defined value type.                      |
    365    +----------------------------------+---------------------------------------------+
    366    | :const:`REG_RESOURCE_LIST`       | A device-driver resource list.              |
    367    +----------------------------------+---------------------------------------------+
    368    | :const:`REG_SZ`                  | A null-terminated string.                   |
    369    +----------------------------------+---------------------------------------------+
    370 
    371    *reserved* can be anything - zero is always passed to the  API.
     404   *type* is an integer that specifies the type of the data. See
     405   :ref:`Value Types <value-types>` for the available types.
     406
     407   *reserved* can be anything -- zero is always passed to the API.
    372408
    373409   *value* is a string that specifies the new value.
     
    377413   :const:`KEY_SET_VALUE` access.
    378414
    379    To open the key, use the :func:`CreateKey` or  :func:`OpenKey` methods.
     415   To open the key, use the :func:`CreateKey` or :func:`OpenKey` methods.
    380416
    381417   Value lengths are limited by available memory. Long values (more than 2048
     
    384420
    385421
     422.. function:: DisableReflectionKey(key)
     423
     424   Disables registry reflection for 32-bit processes running on a 64-bit
     425   operating system.
     426
     427   *key* is an already open key, or one of the predefined
     428   :ref:`HKEY_* constants <hkey-constants>`.
     429
     430   Will generally raise :exc:`NotImplemented` if executed on a 32-bit
     431   operating system.
     432
     433   If the key is not on the reflection list, the function succeeds but has no
     434   effect. Disabling reflection for a key does not affect reflection of any
     435   subkeys.
     436
     437
     438.. function:: EnableReflectionKey(key)
     439
     440   Restores registry reflection for the specified disabled key.
     441
     442   *key* is an already open key, or one of the predefined
     443   :ref:`HKEY_* constants <hkey-constants>`.
     444
     445   Will generally raise :exc:`NotImplemented` if executed on a 32-bit
     446   operating system.
     447
     448   Restoring reflection for a key does not affect reflection of any subkeys.
     449
     450
     451.. function:: QueryReflectionKey(key)
     452
     453   Determines the reflection state for the specified key.
     454
     455   *key* is an already open key, or one of the predefined
     456   :ref:`HKEY_* constants <hkey-constants>`.
     457
     458   Returns ``True`` if reflection is disabled.
     459
     460   Will generally raise :exc:`NotImplemented` if executed on a 32-bit
     461   operating system.
     462
     463
     464.. _constants:
     465
     466Constants
     467------------------
     468
     469The following constants are defined for use in many :mod:`_winreg` functions.
     470
     471.. _hkey-constants:
     472
     473HKEY_* Constants
     474++++++++++++++++
     475
     476.. data:: HKEY_CLASSES_ROOT
     477
     478   Registry entries subordinate to this key define types (or classes) of
     479   documents and the properties associated with those types. Shell and
     480   COM applications use the information stored under this key.
     481
     482
     483.. data:: HKEY_CURRENT_USER
     484
     485   Registry entries subordinate to this key define the preferences of
     486   the current user. These preferences include the settings of
     487   environment variables, data about program groups, colors, printers,
     488   network connections, and application preferences.
     489
     490.. data:: HKEY_LOCAL_MACHINE
     491
     492   Registry entries subordinate to this key define the physical state
     493   of the computer, including data about the bus type, system memory,
     494   and installed hardware and software.
     495
     496.. data:: HKEY_USERS
     497
     498   Registry entries subordinate to this key define the default user
     499   configuration for new users on the local computer and the user
     500   configuration for the current user.
     501
     502.. data:: HKEY_PERFORMANCE_DATA
     503
     504   Registry entries subordinate to this key allow you to access
     505   performance data. The data is not actually stored in the registry;
     506   the registry functions cause the system to collect the data from
     507   its source.
     508
     509
     510.. data:: HKEY_CURRENT_CONFIG
     511
     512   Contains information about the current hardware profile of the
     513   local computer system.
     514
     515.. data:: HKEY_DYN_DATA
     516
     517   This key is not used in versions of Windows after 98.
     518
     519
     520.. _access-rights:
     521
     522Access Rights
     523+++++++++++++
     524
     525For more information, see `Registry Key Security and Access
     526<http://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx>`__.
     527
     528.. data:: KEY_ALL_ACCESS
     529
     530   Combines the STANDARD_RIGHTS_REQUIRED, :const:`KEY_QUERY_VALUE`,
     531   :const:`KEY_SET_VALUE`, :const:`KEY_CREATE_SUB_KEY`,
     532   :const:`KEY_ENUMERATE_SUB_KEYS`, :const:`KEY_NOTIFY`,
     533   and :const:`KEY_CREATE_LINK` access rights.
     534
     535.. data:: KEY_WRITE
     536
     537   Combines the STANDARD_RIGHTS_WRITE, :const:`KEY_SET_VALUE`, and
     538   :const:`KEY_CREATE_SUB_KEY` access rights.
     539
     540.. data:: KEY_READ
     541
     542   Combines the STANDARD_RIGHTS_READ, :const:`KEY_QUERY_VALUE`,
     543   :const:`KEY_ENUMERATE_SUB_KEYS`, and :const:`KEY_NOTIFY` values.
     544
     545.. data:: KEY_EXECUTE
     546
     547   Equivalent to :const:`KEY_READ`.
     548
     549.. data:: KEY_QUERY_VALUE
     550
     551   Required to query the values of a registry key.
     552
     553.. data:: KEY_SET_VALUE
     554
     555   Required to create, delete, or set a registry value.
     556
     557.. data:: KEY_CREATE_SUB_KEY
     558
     559   Required to create a subkey of a registry key.
     560
     561.. data:: KEY_ENUMERATE_SUB_KEYS
     562
     563   Required to enumerate the subkeys of a registry key.
     564
     565.. data:: KEY_NOTIFY
     566
     567   Required to request change notifications for a registry key or for
     568   subkeys of a registry key.
     569
     570.. data:: KEY_CREATE_LINK
     571
     572   Reserved for system use.
     573
     574
     575.. _64-bit-access-rights:
     576
     57764-bit Specific
     578***************
     579
     580For more information, see `Accesing an Alternate Registry View
     581<http://msdn.microsoft.com/en-us/library/aa384129(v=VS.85).aspx>`__.
     582
     583.. data:: KEY_WOW64_64KEY
     584
     585   Indicates that an application on 64-bit Windows should operate on
     586   the 64-bit registry view.
     587
     588.. data:: KEY_WOW64_32KEY
     589
     590   Indicates that an application on 64-bit Windows should operate on
     591   the 32-bit registry view.
     592
     593
     594.. _value-types:
     595
     596Value Types
     597+++++++++++
     598
     599For more information, see `Registry Value Types
     600<http://msdn.microsoft.com/en-us/library/ms724884%28v=VS.85%29.aspx>`__.
     601
     602.. data:: REG_BINARY
     603
     604   Binary data in any form.
     605
     606.. data:: REG_DWORD
     607
     608   32-bit number.
     609
     610.. data:: REG_DWORD_LITTLE_ENDIAN
     611
     612   A 32-bit number in little-endian format.
     613
     614.. data:: REG_DWORD_BIG_ENDIAN
     615
     616   A 32-bit number in big-endian format.
     617
     618.. data:: REG_EXPAND_SZ
     619
     620   Null-terminated string containing references to environment
     621   variables (``%PATH%``).
     622
     623.. data:: REG_LINK
     624
     625   A Unicode symbolic link.
     626
     627.. data:: REG_MULTI_SZ
     628
     629   A sequence of null-terminated strings, terminated by two null characters.
     630   (Python handles this termination automatically.)
     631
     632.. data:: REG_NONE
     633
     634   No defined value type.
     635
     636.. data:: REG_RESOURCE_LIST
     637
     638   A device-driver resource list.
     639
     640.. data:: REG_FULL_RESOURCE_DESCRIPTOR
     641
     642   A hardware setting.
     643
     644.. data:: REG_RESOURCE_REQUIREMENTS_LIST
     645
     646   A hardware resource list.
     647
     648.. data:: REG_SZ
     649
     650   A null-terminated string.
     651
     652
    386653.. _handle-object:
    387654
     
    391658This object wraps a Windows HKEY object, automatically closing it when the
    392659object is destroyed.  To guarantee cleanup, you can call either the
    393 :meth:`Close` method on the object, or the :func:`CloseKey` function.
     660:meth:`~PyHKEY.Close` method on the object, or the :func:`CloseKey` function.
    394661
    395662All registry functions in this module return one of these objects.
    396663
    397 All registry functions in this module which accept a handle object  also accept
    398 an integer, however, use of the handle object is  encouraged.
    399 
    400 Handle objects provide semantics for :meth:`__nonzero__` - thus  ::
     664All registry functions in this module which accept a handle object also accept
     665an integer, however, use of the handle object is encouraged.
     666
     667Handle objects provide semantics for :meth:`__nonzero__` -- thus::
    401668
    402669   if handle:
     
    411678Handle objects can be converted to an integer (e.g., using the built-in
    412679:func:`int` function), in which case the underlying Windows handle value is
    413 returned.  You can also use the  :meth:`Detach` method to return the integer
    414 handle, and also disconnect the Windows handle from the handle object.
     680returned.  You can also use the :meth:`~PyHKEY.Detach` method to return the
     681integer handle, and also disconnect the Windows handle from the handle object.
    415682
    416683
     
    431698
    432699   After calling this function, the handle is effectively invalidated, but the
    433    handle is not closed.  You would call this function when  you need the
    434    underlying Win32 handle to exist beyond the lifetime  of the handle object.
     700   handle is not closed.  You would call this function when you need the
     701   underlying Win32 handle to exist beyond the lifetime of the handle object.
    435702
    436703.. method:: PyHKEY.__enter__()
    437704            PyHKEY.__exit__(\*exc_info)
    438705
    439    The HKEY object implements :meth:`__enter__` and :meth:`__exit__` and thus
    440    supports the context protocol for the :keyword:`with` statement::
     706   The HKEY object implements :meth:`~object.__enter__` and
     707   :meth:`~object.__exit__` and thus supports the context protocol for the
     708   :keyword:`with` statement::
    441709
    442710      with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key:
    443           # ... work with key ...
     711          ...  # work with key
    444712
    445713   will automatically close *key* when control leaves the :keyword:`with` block.
Note: See TracChangeset for help on using the changeset viewer.