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

Skip to content

Commit 97bb179

Browse files
committed
Merged revisions 80472 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r80472 | ezio.melotti | 2010-04-25 20:48:01 +0300 (Sun, 25 Apr 2010) | 9 lines Merged revisions 79786 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r79786 | ezio.melotti | 2010-04-05 11:02:54 +0300 (Mon, 05 Apr 2010) | 1 line Fix markup, punctuation and whitespaces in _winreg.rst. ........ ................
1 parent 3aba37a commit 97bb179

1 file changed

Lines changed: 68 additions & 67 deletions

File tree

Doc/library/winreg.rst

Lines changed: 68 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ handles are closed correctly, even if the programmer neglects to explicitly
1313
close them.
1414

1515
This module exposes a very low-level interface to the Windows registry; it is
16-
expected that in the future a new ``winreg`` module will be created offering a
16+
expected that in the future a new ``winreg`` module will be created offering a
1717
higher-level interface to the registry API.
1818

1919
This module offers the following functions:
@@ -31,34 +31,35 @@ This module offers the following functions:
3131

3232
.. function:: ConnectRegistry(computer_name, key)
3333

34-
Establishes a connection to a predefined registry handle on another computer,
35-
and returns a :dfn:`handle object`
34+
Establishes a connection to a predefined registry handle on another computer,
35+
and returns a :ref:`handle object <handle-object>`.
3636

37-
*computer_name* is the name of the remote computer, of the form
37+
*computer_name* is the name of the remote computer, of the form
3838
``r"\\computername"``. If ``None``, the local computer is used.
3939

4040
*key* is the predefined handle to connect to.
4141

4242
The return value is the handle of the opened key. If the function fails, a
43-
:exc:`WindowsError` exception is raised.
43+
:exc:`WindowsError` exception is raised.
4444

4545

4646
.. function:: CreateKey(key, sub_key)
4747

48-
Creates or opens the specified key, returning a :dfn:`handle object`
48+
Creates or opens the specified key, returning a
49+
:ref:`handle object <handle-object>`.
4950

50-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
51+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
5152
constants.
5253

53-
*sub_key* is a string that names the key this method opens or creates.
54+
*sub_key* is a string that names the key this method opens or creates.
5455

55-
If *key* is one of the predefined keys, *sub_key* may be ``None``. In that
56-
case, the handle returned is the same key handle passed in to the function.
56+
If *key* is one of the predefined keys, *sub_key* may be ``None``. In that
57+
case, the handle returned is the same key handle passed in to the function.
5758

5859
If the key already exists, this function opens the existing key.
5960

6061
The return value is the handle of the opened key. If the function fails, a
61-
:exc:`WindowsError` exception is raised.
62+
:exc:`WindowsError` exception is raised.
6263

6364

6465
.. function:: DeleteKey(key, sub_key)
@@ -74,14 +75,14 @@ This module offers the following functions:
7475
*This method can not delete keys with subkeys.*
7576

7677
If the method succeeds, the entire key, including all of its values, is removed.
77-
If the method fails, a :exc:`WindowsError` exception is raised.
78+
If the method fails, a :exc:`WindowsError` exception is raised.
7879

7980

8081
.. function:: DeleteValue(key, value)
8182

8283
Removes a named value from a registry key.
8384

84-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
85+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
8586
constants.
8687

8788
*value* is a string that identifies the value to remove.
@@ -91,28 +92,28 @@ This module offers the following functions:
9192

9293
Enumerates subkeys of an open registry key, returning a string.
9394

94-
*key* is an already open key, or any one of the predefined :const:`HKEY_\*`
95+
*key* is an already open key, or any one of the predefined :const:`HKEY_\*`
9596
constants.
9697

97-
*index* is an integer that identifies the index of the key to retrieve.
98+
*index* is an integer that identifies the index of the key to retrieve.
9899

99-
The function retrieves the name of one subkey each time it is called. It is
100-
typically called repeatedly until a :exc:`WindowsError` exception is
100+
The function retrieves the name of one subkey each time it is called. It is
101+
typically called repeatedly until a :exc:`WindowsError` exception is
101102
raised, indicating, no more values are available.
102103

103104

104105
.. function:: EnumValue(key, index)
105106

106107
Enumerates values of an open registry key, returning a tuple.
107108

108-
*key* is an already open key, or any one of the predefined :const:`HKEY_\*`
109+
*key* is an already open key, or any one of the predefined :const:`HKEY_\*`
109110
constants.
110111

111-
*index* is an integer that identifies the index of the value to retrieve.
112+
*index* is an integer that identifies the index of the value to retrieve.
112113

113-
The function retrieves the name of one subkey each time it is called. It is
114-
typically called repeatedly, until a :exc:`WindowsError` exception is
115-
raised, indicating no more values.
114+
The function retrieves the name of one subkey each time it is called. It is
115+
typically called repeatedly, until a :exc:`WindowsError` exception is
116+
raised, indicating no more values.
116117

117118
The result is a tuple of 3 items:
118119

@@ -142,25 +143,25 @@ This module offers the following functions:
142143

143144
Writes all the attributes of a key to the registry.
144145

145-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
146+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
146147
constants.
147148

148149
It is not necessary to call :func:`FlushKey` to change a key. Registry changes are
149-
flushed to disk by the registry using its lazy flusher. Registry changes are
150-
also flushed to disk at system shutdown. Unlike :func:`CloseKey`, the
151-
:func:`FlushKey` method returns only when all the data has been written to the
150+
flushed to disk by the registry using its lazy flusher. Registry changes are
151+
also flushed to disk at system shutdown. Unlike :func:`CloseKey`, the
152+
:func:`FlushKey` method returns only when all the data has been written to the
152153
registry. An application should only call :func:`FlushKey` if it requires
153-
absolute certainty that registry changes are on disk.
154+
absolute certainty that registry changes are on disk.
154155

155156
.. note::
156157

157-
If you don't know whether a :func:`FlushKey` call is required, it probably
158+
If you don't know whether a :func:`FlushKey` call is required, it probably
158159
isn't.
159160

160161

161162
.. function:: LoadKey(key, sub_key, file_name)
162163

163-
Creates a subkey under the specified key and stores registration information
164+
Creates a subkey under the specified key and stores registration information
164165
from a specified file into that subkey.
165166

166167
*key* is an already open key, or any of the predefined :const:`HKEY_\*`
@@ -174,18 +175,18 @@ This module offers the following functions:
174175

175176
A call to LoadKey() fails if the calling process does not have the
176177
:const:`SE_RESTORE_PRIVILEGE` privilege. Note that privileges are different than
177-
permissions - see the Win32 documentation for more details.
178+
permissions -- see the Win32 documentation for more details.
178179

179-
If *key* is a handle returned by :func:`ConnectRegistry`, then the path
180-
specified in *fileName* is relative to the remote computer.
180+
If *key* is a handle returned by :func:`ConnectRegistry`, then the path
181+
specified in *fileName* is relative to the remote computer.
181182

182-
The Win32 documentation implies *key* must be in the :const:`HKEY_USER` or
183+
The Win32 documentation implies *key* must be in the :const:`HKEY_USER` or
183184
:const:`HKEY_LOCAL_MACHINE` tree. This may or may not be true.
184185

185186

186187
.. function:: OpenKey(key, sub_key[, res[, sam]])
187188

188-
Opens the specified key, returning a :dfn:`handle object`
189+
Opens the specified key, returning a :ref:`handle object <handle-object>`.
189190

190191
*key* is an already open key, or any one of the predefined :const:`HKEY_\*`
191192
constants.
@@ -194,7 +195,7 @@ This module offers the following functions:
194195

195196
*res* is a reserved integer, and must be zero. The default is zero.
196197

197-
*sam* is an integer that specifies an access mask that describes the desired
198+
*sam* is an integer that specifies an access mask that describes the desired
198199
security access for the key. Default is :const:`KEY_READ`.
199200

200201
The result is a new handle to the specified key.
@@ -204,15 +205,15 @@ This module offers the following functions:
204205

205206
.. function:: OpenKeyEx()
206207

207-
The functionality of :func:`OpenKeyEx` is provided via :func:`OpenKey`, by the
208-
use of default arguments.
208+
The functionality of :func:`OpenKeyEx` is provided via :func:`OpenKey`,
209+
by the use of default arguments.
209210

210211

211212
.. function:: QueryInfoKey(key)
212213

213214
Returns information about a key, as a tuple.
214215

215-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
216+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
216217
constants.
217218

218219
The result is a tuple of 3 items:
@@ -234,14 +235,14 @@ This module offers the following functions:
234235

235236
.. function:: QueryValue(key, sub_key)
236237

237-
Retrieves the unnamed value for a key, as a string
238+
Retrieves the unnamed value for a key, as a string.
238239

239-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
240+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
240241
constants.
241242

242-
*sub_key* is a string that holds the name of the subkey with which the value is
243-
associated. If this parameter is ``None`` or empty, the function retrieves the
244-
value set by the :func:`SetValue` method for the key identified by *key*.
243+
*sub_key* is a string that holds the name of the subkey with which the value is
244+
associated. If this parameter is ``None`` or empty, the function retrieves the
245+
value set by the :func:`SetValue` method for the key identified by *key*.
245246

246247
Values in the registry have name, type, and data components. This method
247248
retrieves the data for a key's first value that has a NULL name. But the
@@ -251,10 +252,10 @@ This module offers the following functions:
251252

252253
.. function:: QueryValueEx(key, value_name)
253254

254-
Retrieves the type and data for a specified value name associated with an open
255-
registry key.
255+
Retrieves the type and data for a specified value name associated with
256+
an open registry key.
256257

257-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
258+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
258259
constants.
259260

260261
*value_name* is a string indicating the value to query.
@@ -275,18 +276,18 @@ This module offers the following functions:
275276

276277
Saves the specified key, and all its subkeys to the specified file.
277278

278-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
279+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
279280
constants.
280281

281282
*file_name* is the name of the file to save registry data to. This file cannot
282283
already exist. If this filename includes an extension, it cannot be used on file
283284
allocation table (FAT) file systems by the :meth:`LoadKey`, :meth:`ReplaceKey`
284-
or :meth:`RestoreKey` methods.
285+
or :meth:`RestoreKey` methods.
285286

286-
If *key* represents a key on a remote computer, the path described by
287+
If *key* represents a key on a remote computer, the path described by
287288
*file_name* is relative to the remote computer. The caller of this method must
288-
possess the :const:`SeBackupPrivilege` security privilege. Note that
289-
privileges are different than permissions - see the Win32 documentation for
289+
possess the :const:`SeBackupPrivilege` security privilege. Note that
290+
privileges are different than permissions -- see the Win32 documentation for
290291
more details.
291292

292293
This function passes NULL for *security_attributes* to the API.
@@ -296,10 +297,10 @@ This module offers the following functions:
296297

297298
Associates a value with a specified key.
298299

299-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
300+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
300301
constants.
301302

302-
*sub_key* is a string that names the subkey with which the value is associated.
303+
*sub_key* is a string that names the subkey with which the value is associated.
303304

304305
*type* is an integer that specifies the type of the data. Currently this must be
305306
:const:`REG_SZ`, meaning only strings are supported. Use the :func:`SetValueEx`
@@ -314,21 +315,21 @@ This module offers the following functions:
314315
bytes) should be stored as files with the filenames stored in the configuration
315316
registry. This helps the registry perform efficiently.
316317

317-
The key identified by the *key* parameter must have been opened with
318+
The key identified by the *key* parameter must have been opened with
318319
:const:`KEY_SET_VALUE` access.
319320

320321

321322
.. function:: SetValueEx(key, value_name, reserved, type, value)
322323

323324
Stores data in the value field of an open registry key.
324325

325-
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
326+
*key* is an already open key, or one of the predefined :const:`HKEY_\*`
326327
constants.
327328

328-
*value_name* is a string that names the subkey with which the value is
329+
*value_name* is a string that names the subkey with which the value is
329330
associated.
330331

331-
*type* is an integer that specifies the type of the data. This should be one
332+
*type* is an integer that specifies the type of the data. This should be one
332333
of the following constants defined in this module:
333334

334335
+----------------------------------+---------------------------------------------+
@@ -350,7 +351,7 @@ This module offers the following functions:
350351
+----------------------------------+---------------------------------------------+
351352
| :const:`REG_MULTI_SZ` | A sequence of null-terminated strings, |
352353
| | terminated by two null characters. (Python |
353-
| | handles this termination automatically.) |
354+
| | handles this termination automatically.) |
354355
+----------------------------------+---------------------------------------------+
355356
| :const:`REG_NONE` | No defined value type. |
356357
+----------------------------------+---------------------------------------------+
@@ -359,15 +360,15 @@ This module offers the following functions:
359360
| :const:`REG_SZ` | A null-terminated string. |
360361
+----------------------------------+---------------------------------------------+
361362

362-
*reserved* can be anything - zero is always passed to the API.
363+
*reserved* can be anything -- zero is always passed to the API.
363364

364365
*value* is a string that specifies the new value.
365366

366367
This method can also set additional value and type information for the specified
367368
key. The key identified by the key parameter must have been opened with
368369
:const:`KEY_SET_VALUE` access.
369370

370-
To open the key, use the :func:`CreateKey` or :func:`OpenKey` methods.
371+
To open the key, use the :func:`CreateKey` or :func:`OpenKey` methods.
371372

372373
Value lengths are limited by available memory. Long values (more than 2048
373374
bytes) should be stored as files with the filenames stored in the configuration
@@ -381,14 +382,14 @@ Registry Handle Objects
381382

382383
This object wraps a Windows HKEY object, automatically closing it when the
383384
object is destroyed. To guarantee cleanup, you can call either the
384-
:meth:`Close` method on the object, or the :func:`CloseKey` function.
385+
:meth:`Close` method on the object, or the :func:`CloseKey` function.
385386

386387
All registry functions in this module return one of these objects.
387388

388-
All registry functions in this module which accept a handle object also accept
389-
an integer, however, use of the handle object is encouraged.
389+
All registry functions in this module which accept a handle object also accept
390+
an integer, however, use of the handle object is encouraged.
390391

391-
Handle objects provide semantics for :meth:`__bool__` - thus ::
392+
Handle objects provide semantics for :meth:`__bool__` -- thus ::
392393

393394
if handle:
394395
print("Yes")
@@ -401,7 +402,7 @@ true if they both reference the same underlying Windows handle value.
401402

402403
Handle objects can be converted to an integer (e.g., using the built-in
403404
:func:`int` function), in which case the underlying Windows handle value is
404-
returned. You can also use the :meth:`Detach` method to return the integer
405+
returned. You can also use the :meth:`Detach` method to return the integer
405406
handle, and also disconnect the Windows handle from the handle object.
406407

407408

@@ -421,8 +422,8 @@ handle, and also disconnect the Windows handle from the handle object.
421422
zero.
422423

423424
After calling this function, the handle is effectively invalidated, but the
424-
handle is not closed. You would call this function when you need the
425-
underlying Win32 handle to exist beyond the lifetime of the handle object.
425+
handle is not closed. You would call this function when you need the
426+
underlying Win32 handle to exist beyond the lifetime of the handle object.
426427

427428
.. method:: PyHKEY.__enter__()
428429
PyHKEY.__exit__(\*exc_info)

0 commit comments

Comments
 (0)