Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8173fb3

Browse files
committed
Recorded merge of revisions 80466-80469 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r80466 | georg.brandl | 2010-04-25 12:54:42 +0200 (So, 25 Apr 2010) | 1 line Patch from Tim Hatch: Better cross-referencing in socket and winreg docs. ........ r80467 | georg.brandl | 2010-04-25 12:55:16 +0200 (So, 25 Apr 2010) | 1 line Patch from Tim Hatch: Remove reference to winreg being the fabled high-level registry interface. ........ r80468 | georg.brandl | 2010-04-25 12:55:58 +0200 (So, 25 Apr 2010) | 1 line Patch from Tim Hatch: Minor spelling changes to _winreg docs. ........ r80469 | georg.brandl | 2010-04-25 12:56:41 +0200 (So, 25 Apr 2010) | 1 line Fix code example to have valid syntax so that it can be highlighted. ........
1 parent c955560 commit 8173fb3

1 file changed

Lines changed: 43 additions & 40 deletions

File tree

Doc/library/winreg.rst

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@
88

99

1010
These functions expose the Windows registry API to Python. Instead of using an
11-
integer as the registry handle, a handle object is used to ensure that the
12-
handles are closed correctly, even if the programmer neglects to explicitly
13-
close them.
11+
integer as the registry handle, a :ref:`handle object <handle-object>` is used
12+
to ensure that the handles are closed correctly, even if the programmer neglects
13+
to explicitly close them.
1414

1515
This module offers the following functions:
1616

1717

1818
.. function:: CloseKey(hkey)
1919

20-
Closes a previously opened registry key. The hkey argument specifies a
20+
Closes a previously opened registry key. The *hkey* argument specifies a
2121
previously opened key.
2222

2323
.. note::
24-
If *hkey* is not closed using this method (or via :meth:`hkey.Close() <PyHKEY.Close>`),
25-
it is closed when the *hkey* object is destroyed by Python.
24+
25+
If *hkey* is not closed using this method (or via :meth:`hkey.Close()
26+
<PyHKEY.Close>`), it is closed when the *hkey* object is destroyed by
27+
Python.
2628

2729

2830
.. function:: ConnectRegistry(computer_name, key)
@@ -120,7 +122,7 @@ This module offers the following functions:
120122

121123
*res* is a reserved integer, and must be zero. The default is zero.
122124

123-
*sam* is an integer that specifies an access mask that describes the
125+
*sam* is an integer that specifies an access mask that describes the desired
124126
security access for the key. Default is :const:`KEY_ALL_ACCESS`. See
125127
:ref:`Access Rights <access-rights>` for other allowed values.
126128

@@ -183,13 +185,15 @@ This module offers the following functions:
183185
| | registry type |
184186
+-------+--------------------------------------------+
185187
| ``2`` | An integer that identifies the type of the |
186-
| | value data |
188+
| | value data (see table in docs for |
189+
| | :meth:`SetValueEx`) |
187190
+-------+--------------------------------------------+
188191

189192

190193
.. function:: ExpandEnvironmentStrings(str)
191194

192-
Expands environment strings %NAME% in unicode string like :const:`REG_EXPAND_SZ`::
195+
Expands environment variable placeholders ``%NAME%`` in strings like
196+
:const:`REG_EXPAND_SZ`::
193197

194198
>>> ExpandEnvironmentStrings('%windir%')
195199
'C:\\Windows'
@@ -223,23 +227,20 @@ This module offers the following functions:
223227
*key* is a handle returned by :func:`ConnectRegistry` or one of the constants
224228
:const:`HKEY_USERS` or :const:`HKEY_LOCAL_MACHINE`.
225229

226-
*sub_key* is a string that identifies the sub_key to load.
230+
*sub_key* is a string that identifies the subkey to load.
227231

228232
*file_name* is the name of the file to load registry data from. This file must
229233
have been created with the :func:`SaveKey` function. Under the file allocation
230234
table (FAT) file system, the filename may not have an extension.
231235

232-
A call to LoadKey() fails if the calling process does not have the
233-
:const:`SE_RESTORE_PRIVILEGE` privilege. Note that privileges are different than
236+
A call to :func:`LoadKey` fails if the calling process does not have the
237+
:const:`SE_RESTORE_PRIVILEGE` privilege. Note that privileges are different
234238
from permissions -- see the `RegLoadKey documentation
235239
<http://msdn.microsoft.com/en-us/library/ms724889%28v=VS.85%29.aspx>`__ for
236240
more details.
237241

238242
If *key* is a handle returned by :func:`ConnectRegistry`, then the path
239-
specified in *fileName* is relative to the remote computer.
240-
241-
The Win32 documentation implies *key* must be in the :const:`HKEY_USER` or
242-
:const:`HKEY_LOCAL_MACHINE` tree. This may or may not be true.
243+
specified in *file_name* is relative to the remote computer.
243244

244245

245246
.. function:: OpenKey(key, sub_key[, res[, sam]])
@@ -254,8 +255,8 @@ This module offers the following functions:
254255
*res* is a reserved integer, and must be zero. The default is zero.
255256

256257
*sam* is an integer that specifies an access mask that describes the desired
257-
security access for the key. Default is :const:`KEY_READ`. See
258-
:ref:`Access Rights <access-rights>` for other allowed values.
258+
security access for the key. Default is :const:`KEY_READ`. See :ref:`Access
259+
Rights <access-rights>` for other allowed values.
259260

260261
The result is a new handle to the specified key.
261262

@@ -327,7 +328,8 @@ This module offers the following functions:
327328
| ``0`` | The value of the registry item. |
328329
+-------+-----------------------------------------+
329330
| ``1`` | An integer giving the registry type for |
330-
| | this value. |
331+
| | this value (see table in docs for |
332+
| | :meth:`SetValueEx`) |
331333
+-------+-----------------------------------------+
332334

333335

@@ -338,10 +340,10 @@ This module offers the following functions:
338340
*key* is an already open key, or one of the predefined
339341
:ref:`HKEY_* constants <hkey-constants>`.
340342

341-
*file_name* is the name of the file to save registry data to. This file cannot
342-
already exist. If this filename includes an extension, it cannot be used on file
343-
allocation table (FAT) file systems by the :meth:`LoadKey`, :meth:`ReplaceKey`
344-
or :meth:`RestoreKey` methods.
343+
*file_name* is the name of the file to save registry data to. This file
344+
cannot already exist. If this filename includes an extension, it cannot be
345+
used on file allocation table (FAT) file systems by the :meth:`LoadKey`
346+
method.
345347

346348
If *key* represents a key on a remote computer, the path described by
347349
*file_name* is relative to the remote computer. The caller of this method must
@@ -411,28 +413,28 @@ This module offers the following functions:
411413
.. function:: DisableReflectionKey(key)
412414

413415
Disables registry reflection for 32-bit processes running on a 64-bit
414-
Operating System.
416+
operating system.
415417

416-
*key* is an already open key, or one of the predefined
417-
:ref:`HKEY_* constants <hkey-constants>`.
418+
*key* is an already open key, or one of the predefined :ref:`HKEY_* constants
419+
<hkey-constants>`.
418420

419-
Will generally raise :exc:`NotImplemented` if executed on a 32-bit
420-
Operating System.
421+
Will generally raise :exc:`NotImplemented` if executed on a 32-bit operating
422+
system.
421423

422424
If the key is not on the reflection list, the function succeeds but has no
423-
effect. Disabling reflection for a key does not affect reflection of any
425+
effect. Disabling reflection for a key does not affect reflection of any
424426
subkeys.
425427

426428

427429
.. function:: EnableReflectionKey(key)
428430

429431
Restores registry reflection for the specified disabled key.
430432

431-
*key* is an already open key, or one of the predefined
432-
:ref:`HKEY_* constants <hkey-constants>`.
433+
*key* is an already open key, or one of the predefined :ref:`HKEY_* constants
434+
<hkey-constants>`.
433435

434-
Will generally raise :exc:`NotImplemented` if executed on a 32-bit
435-
Operating System.
436+
Will generally raise :exc:`NotImplemented` if executed on a 32-bit operating
437+
system.
436438

437439
Restoring reflection for a key does not affect reflection of any subkeys.
438440

@@ -447,7 +449,7 @@ This module offers the following functions:
447449
Returns ``True`` if reflection is disabled.
448450

449451
Will generally raise :exc:`NotImplemented` if executed on a 32-bit
450-
Operating System.
452+
operating system.
451453

452454

453455
.. _constants:
@@ -646,7 +648,7 @@ Registry Handle Objects
646648

647649
This object wraps a Windows HKEY object, automatically closing it when the
648650
object is destroyed. To guarantee cleanup, you can call either the
649-
:meth:`Close` method on the object, or the :func:`CloseKey` function.
651+
:meth:`~PyHKEY.Close` method on the object, or the :func:`CloseKey` function.
650652

651653
All registry functions in this module return one of these objects.
652654

@@ -666,8 +668,8 @@ true if they both reference the same underlying Windows handle value.
666668

667669
Handle objects can be converted to an integer (e.g., using the built-in
668670
:func:`int` function), in which case the underlying Windows handle value is
669-
returned. You can also use the :meth:`Detach` method to return the integer
670-
handle, and also disconnect the Windows handle from the handle object.
671+
returned. You can also use the :meth:`~PyHKEY.Detach` method to return the
672+
integer handle, and also disconnect the Windows handle from the handle object.
671673

672674

673675
.. method:: PyHKEY.Close()
@@ -692,11 +694,12 @@ handle, and also disconnect the Windows handle from the handle object.
692694
.. method:: PyHKEY.__enter__()
693695
PyHKEY.__exit__(\*exc_info)
694696

695-
The HKEY object implements :meth:`__enter__` and :meth:`__exit__` and thus
696-
supports the context protocol for the :keyword:`with` statement::
697+
The HKEY object implements :meth:`~object.__enter__` and
698+
:meth:`~object.__exit__` and thus supports the context protocol for the
699+
:keyword:`with` statement::
697700

698701
with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key:
699-
# ... work with key ...
702+
... # work with key
700703

701704
will automatically close *key* when control leaves the :keyword:`with` block.
702705

0 commit comments

Comments
 (0)