Debian Codegraph @

PC/clinic/winreg.c.h

raw
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6 # include "pycore_gc.h" // PyGC_Head
7 # include "pycore_runtime.h" // _Py_ID()
8 #endif
9 #include "pycore_long.h" // _PyLong_UnsignedLong_Converter()
10 #include "pycore_modsupport.h" // _PyArg_CheckPositional()
11
12 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
13
14 PyDoc_STRVAR(winreg_HKEYType_Close__doc__,
15 "Close($self, /)\n"
16 "--\n"
17 "\n"
18 "Closes the underlying Windows handle.\n"
19 "\n"
20 "If the handle is already closed, no error is raised.");
21
22 #define WINREG_HKEYTYPE_CLOSE_METHODDEF \
23 {"Close", (PyCFunction)winreg_HKEYType_Close, METH_NOARGS, winreg_HKEYType_Close__doc__},
24
25 static PyObject *
26 winreg_HKEYType_Close_impl(PyHKEYObject *self);
27
28 static PyObject *
29 winreg_HKEYType_Close(PyObject *self, PyObject *Py_UNUSED(ignored))
30 {
31 return winreg_HKEYType_Close_impl((PyHKEYObject *)self);
32 }
33
34 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
35
36 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
37
38 PyDoc_STRVAR(winreg_HKEYType_Detach__doc__,
39 "Detach($self, /)\n"
40 "--\n"
41 "\n"
42 "Detaches the Windows handle from the handle object.\n"
43 "\n"
44 "The result is the value of the handle before it is detached. If the\n"
45 "handle is already detached, this will return zero.\n"
46 "\n"
47 "After calling this function, the handle is effectively invalidated,\n"
48 "but the handle is not closed. You would call this function when you\n"
49 "need the underlying win32 handle to exist beyond the lifetime of the\n"
50 "handle object.");
51
52 #define WINREG_HKEYTYPE_DETACH_METHODDEF \
53 {"Detach", (PyCFunction)winreg_HKEYType_Detach, METH_NOARGS, winreg_HKEYType_Detach__doc__},
54
55 static PyObject *
56 winreg_HKEYType_Detach_impl(PyHKEYObject *self);
57
58 static PyObject *
59 winreg_HKEYType_Detach(PyObject *self, PyObject *Py_UNUSED(ignored))
60 {
61 return winreg_HKEYType_Detach_impl((PyHKEYObject *)self);
62 }
63
64 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
65
66 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
67
68 PyDoc_STRVAR(winreg_HKEYType___enter____doc__,
69 "__enter__($self, /)\n"
70 "--\n"
71 "\n");
72
73 #define WINREG_HKEYTYPE___ENTER___METHODDEF \
74 {"__enter__", (PyCFunction)winreg_HKEYType___enter__, METH_NOARGS, winreg_HKEYType___enter____doc__},
75
76 static PyHKEYObject *
77 winreg_HKEYType___enter___impl(PyHKEYObject *self);
78
79 static PyObject *
80 winreg_HKEYType___enter__(PyObject *self, PyObject *Py_UNUSED(ignored))
81 {
82 PyObject *return_value = NULL;
83 PyHKEYObject *_return_value;
84
85 _return_value = winreg_HKEYType___enter___impl((PyHKEYObject *)self);
86 return_value = (PyObject *)_return_value;
87
88 return return_value;
89 }
90
91 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
92
93 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
94
95 PyDoc_STRVAR(winreg_HKEYType___exit____doc__,
96 "__exit__($self, exc_type, exc_value, traceback, /)\n"
97 "--\n"
98 "\n");
99
100 #define WINREG_HKEYTYPE___EXIT___METHODDEF \
101 {"__exit__", _PyCFunction_CAST(winreg_HKEYType___exit__), METH_FASTCALL, winreg_HKEYType___exit____doc__},
102
103 static PyObject *
104 winreg_HKEYType___exit___impl(PyHKEYObject *self, PyObject *exc_type,
105 PyObject *exc_value, PyObject *traceback);
106
107 static PyObject *
108 winreg_HKEYType___exit__(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
109 {
110 PyObject *return_value = NULL;
111 PyObject *exc_type;
112 PyObject *exc_value;
113 PyObject *traceback;
114
115 if (!_PyArg_CheckPositional("__exit__", nargs, 3, 3)) {
116 goto exit;
117 }
118 exc_type = args[0];
119 exc_value = args[1];
120 traceback = args[2];
121 return_value = winreg_HKEYType___exit___impl((PyHKEYObject *)self, exc_type, exc_value, traceback);
122
123 exit:
124 return return_value;
125 }
126
127 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
128
129 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
130
131 PyDoc_STRVAR(winreg_CloseKey__doc__,
132 "CloseKey($module, hkey, /)\n"
133 "--\n"
134 "\n"
135 "Closes a previously opened registry key.\n"
136 "\n"
137 " hkey\n"
138 " A previously opened key.\n"
139 "\n"
140 "Note that if the key is not closed using this method, it will be\n"
141 "closed when the hkey object is destroyed by Python.");
142
143 #define WINREG_CLOSEKEY_METHODDEF \
144 {"CloseKey", (PyCFunction)winreg_CloseKey, METH_O, winreg_CloseKey__doc__},
145
146 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
147
148 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
149
150 PyDoc_STRVAR(winreg_ConnectRegistry__doc__,
151 "ConnectRegistry($module, computer_name, key, /)\n"
152 "--\n"
153 "\n"
154 "Establishes a connection to the registry on another computer.\n"
155 "\n"
156 " computer_name\n"
157 " The name of the remote computer, of the form r\"\\\\computername\". If\n"
158 " None, the local computer is used.\n"
159 " key\n"
160 " The predefined key to connect to.\n"
161 "\n"
162 "The return value is the handle of the opened key.\n"
163 "If the function fails, an OSError exception is raised.");
164
165 #define WINREG_CONNECTREGISTRY_METHODDEF \
166 {"ConnectRegistry", _PyCFunction_CAST(winreg_ConnectRegistry), METH_FASTCALL, winreg_ConnectRegistry__doc__},
167
168 static HKEY
169 winreg_ConnectRegistry_impl(PyObject *module, const wchar_t *computer_name,
170 HKEY key);
171
172 static PyObject *
173 winreg_ConnectRegistry(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
174 {
175 PyObject *return_value = NULL;
176 const wchar_t *computer_name = NULL;
177 HKEY key;
178 HKEY _return_value;
179
180 if (!_PyArg_CheckPositional("ConnectRegistry", nargs, 2, 2)) {
181 goto exit;
182 }
183 if (args[0] == Py_None) {
184 computer_name = NULL;
185 }
186 else if (PyUnicode_Check(args[0])) {
187 computer_name = PyUnicode_AsWideCharString(args[0], NULL);
188 if (computer_name == NULL) {
189 goto exit;
190 }
191 }
192 else {
193 _PyArg_BadArgument("ConnectRegistry", "argument 1", "str or None", args[0]);
194 goto exit;
195 }
196 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[1], &key)) {
197 goto exit;
198 }
199 _return_value = winreg_ConnectRegistry_impl(module, computer_name, key);
200 if (_return_value == NULL) {
201 goto exit;
202 }
203 return_value = PyHKEY_FromHKEY(_PyModule_GetState(module), _return_value);
204
205 exit:
206 /* Cleanup for computer_name */
207 PyMem_Free((void *)computer_name);
208
209 return return_value;
210 }
211
212 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
213
214 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
215
216 PyDoc_STRVAR(winreg_CreateKey__doc__,
217 "CreateKey($module, key, sub_key, /)\n"
218 "--\n"
219 "\n"
220 "Creates or opens the specified key.\n"
221 "\n"
222 " key\n"
223 " An already open key, or one of the predefined HKEY_* constants.\n"
224 " sub_key\n"
225 " The name of the key this method opens or creates.\n"
226 "\n"
227 "If key is one of the predefined keys, sub_key may be None. In that case,\n"
228 "the handle returned is the same key handle passed in to the function.\n"
229 "\n"
230 "If the key already exists, this function opens the existing key.\n"
231 "\n"
232 "The return value is the handle of the opened key.\n"
233 "If the function fails, an OSError exception is raised.");
234
235 #define WINREG_CREATEKEY_METHODDEF \
236 {"CreateKey", _PyCFunction_CAST(winreg_CreateKey), METH_FASTCALL, winreg_CreateKey__doc__},
237
238 static HKEY
239 winreg_CreateKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key);
240
241 static PyObject *
242 winreg_CreateKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
243 {
244 PyObject *return_value = NULL;
245 HKEY key;
246 const wchar_t *sub_key = NULL;
247 HKEY _return_value;
248
249 if (!_PyArg_CheckPositional("CreateKey", nargs, 2, 2)) {
250 goto exit;
251 }
252 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
253 goto exit;
254 }
255 if (args[1] == Py_None) {
256 sub_key = NULL;
257 }
258 else if (PyUnicode_Check(args[1])) {
259 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
260 if (sub_key == NULL) {
261 goto exit;
262 }
263 }
264 else {
265 _PyArg_BadArgument("CreateKey", "argument 2", "str or None", args[1]);
266 goto exit;
267 }
268 _return_value = winreg_CreateKey_impl(module, key, sub_key);
269 if (_return_value == NULL) {
270 goto exit;
271 }
272 return_value = PyHKEY_FromHKEY(_PyModule_GetState(module), _return_value);
273
274 exit:
275 /* Cleanup for sub_key */
276 PyMem_Free((void *)sub_key);
277
278 return return_value;
279 }
280
281 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
282
283 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
284
285 PyDoc_STRVAR(winreg_CreateKeyEx__doc__,
286 "CreateKeyEx($module, /, key, sub_key, reserved=0,\n"
287 " access=winreg.KEY_WRITE)\n"
288 "--\n"
289 "\n"
290 "Creates or opens the specified key.\n"
291 "\n"
292 " key\n"
293 " An already open key, or one of the predefined HKEY_* constants.\n"
294 " sub_key\n"
295 " The name of the key this method opens or creates.\n"
296 " reserved\n"
297 " A reserved integer, and must be zero. Default is zero.\n"
298 " access\n"
299 " An integer that specifies an access mask that describes the\n"
300 " desired security access for the key. Default is KEY_WRITE.\n"
301 "\n"
302 "If key is one of the predefined keys, sub_key may be None. In that case,\n"
303 "the handle returned is the same key handle passed in to the function.\n"
304 "\n"
305 "If the key already exists, this function opens the existing key\n"
306 "\n"
307 "The return value is the handle of the opened key.\n"
308 "If the function fails, an OSError exception is raised.");
309
310 #define WINREG_CREATEKEYEX_METHODDEF \
311 {"CreateKeyEx", _PyCFunction_CAST(winreg_CreateKeyEx), METH_FASTCALL|METH_KEYWORDS, winreg_CreateKeyEx__doc__},
312
313 static HKEY
314 winreg_CreateKeyEx_impl(PyObject *module, HKEY key, const wchar_t *sub_key,
315 int reserved, REGSAM access);
316
317 static PyObject *
318 winreg_CreateKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
319 {
320 PyObject *return_value = NULL;
321 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
322
323 #define NUM_KEYWORDS 4
324 static struct {
325 PyGC_Head _this_is_not_used;
326 PyObject_VAR_HEAD
327 Py_hash_t ob_hash;
328 PyObject *ob_item[NUM_KEYWORDS];
329 } _kwtuple = {
330 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
331 .ob_hash = -1,
332 .ob_item = { &_Py_ID(key), &_Py_ID(sub_key), &_Py_ID(reserved), &_Py_ID(access), },
333 };
334 #undef NUM_KEYWORDS
335 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
336
337 #else // !Py_BUILD_CORE
338 # define KWTUPLE NULL
339 #endif // !Py_BUILD_CORE
340
341 static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
342 static _PyArg_Parser _parser = {
343 .keywords = _keywords,
344 .fname = "CreateKeyEx",
345 .kwtuple = KWTUPLE,
346 };
347 #undef KWTUPLE
348 PyObject *argsbuf[4];
349 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
350 HKEY key;
351 const wchar_t *sub_key = NULL;
352 int reserved = 0;
353 REGSAM access = KEY_WRITE;
354 HKEY _return_value;
355
356 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
357 /*minpos*/ 2, /*maxpos*/ 4, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
358 if (!args) {
359 goto exit;
360 }
361 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
362 goto exit;
363 }
364 if (args[1] == Py_None) {
365 sub_key = NULL;
366 }
367 else if (PyUnicode_Check(args[1])) {
368 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
369 if (sub_key == NULL) {
370 goto exit;
371 }
372 }
373 else {
374 _PyArg_BadArgument("CreateKeyEx", "argument 'sub_key'", "str or None", args[1]);
375 goto exit;
376 }
377 if (!noptargs) {
378 goto skip_optional_pos;
379 }
380 if (args[2]) {
381 reserved = PyLong_AsInt(args[2]);
382 if (reserved == -1 && PyErr_Occurred()) {
383 goto exit;
384 }
385 if (!--noptargs) {
386 goto skip_optional_pos;
387 }
388 }
389 access = PyLong_AsInt(args[3]);
390 if (access == -1 && PyErr_Occurred()) {
391 goto exit;
392 }
393 skip_optional_pos:
394 _return_value = winreg_CreateKeyEx_impl(module, key, sub_key, reserved, access);
395 if (_return_value == NULL) {
396 goto exit;
397 }
398 return_value = PyHKEY_FromHKEY(_PyModule_GetState(module), _return_value);
399
400 exit:
401 /* Cleanup for sub_key */
402 PyMem_Free((void *)sub_key);
403
404 return return_value;
405 }
406
407 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
408
409 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
410
411 PyDoc_STRVAR(winreg_DeleteKey__doc__,
412 "DeleteKey($module, key, sub_key, /)\n"
413 "--\n"
414 "\n"
415 "Deletes the specified key.\n"
416 "\n"
417 " key\n"
418 " An already open key, or any one of the predefined HKEY_* constants.\n"
419 " sub_key\n"
420 " A string that must be the name of a subkey of the key identified by\n"
421 " the key parameter. This value must not be None, and the key may not\n"
422 " have subkeys.\n"
423 "\n"
424 "This method can not delete keys with subkeys.\n"
425 "\n"
426 "If the function succeeds, the entire key, including all of its values,\n"
427 "is removed. If the function fails, an OSError exception is raised.");
428
429 #define WINREG_DELETEKEY_METHODDEF \
430 {"DeleteKey", _PyCFunction_CAST(winreg_DeleteKey), METH_FASTCALL, winreg_DeleteKey__doc__},
431
432 static PyObject *
433 winreg_DeleteKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key);
434
435 static PyObject *
436 winreg_DeleteKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
437 {
438 PyObject *return_value = NULL;
439 HKEY key;
440 const wchar_t *sub_key = NULL;
441
442 if (!_PyArg_CheckPositional("DeleteKey", nargs, 2, 2)) {
443 goto exit;
444 }
445 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
446 goto exit;
447 }
448 if (!PyUnicode_Check(args[1])) {
449 _PyArg_BadArgument("DeleteKey", "argument 2", "str", args[1]);
450 goto exit;
451 }
452 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
453 if (sub_key == NULL) {
454 goto exit;
455 }
456 return_value = winreg_DeleteKey_impl(module, key, sub_key);
457
458 exit:
459 /* Cleanup for sub_key */
460 PyMem_Free((void *)sub_key);
461
462 return return_value;
463 }
464
465 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
466
467 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
468
469 PyDoc_STRVAR(winreg_DeleteKeyEx__doc__,
470 "DeleteKeyEx($module, /, key, sub_key, access=winreg.KEY_WOW64_64KEY,\n"
471 " reserved=0)\n"
472 "--\n"
473 "\n"
474 "Deletes the specified key (intended for 64-bit OS).\n"
475 "\n"
476 " key\n"
477 " An already open key, or any one of the predefined HKEY_* constants.\n"
478 " sub_key\n"
479 " A string that must be the name of a subkey of the key identified by\n"
480 " the key parameter. This value must not be None, and the key may not\n"
481 " have subkeys.\n"
482 " access\n"
483 " An integer that specifies an access mask that describes the\n"
484 " desired security access for the key. Default is KEY_WOW64_64KEY.\n"
485 " reserved\n"
486 " A reserved integer, and must be zero. Default is zero.\n"
487 "\n"
488 "While this function is intended to be used for 64-bit OS, it is also\n"
489 " available on 32-bit systems.\n"
490 "\n"
491 "This method can not delete keys with subkeys.\n"
492 "\n"
493 "If the function succeeds, the entire key, including all of its values,\n"
494 "is removed. If the function fails, an OSError exception is raised.\n"
495 "On unsupported Windows versions, NotImplementedError is raised.");
496
497 #define WINREG_DELETEKEYEX_METHODDEF \
498 {"DeleteKeyEx", _PyCFunction_CAST(winreg_DeleteKeyEx), METH_FASTCALL|METH_KEYWORDS, winreg_DeleteKeyEx__doc__},
499
500 static PyObject *
501 winreg_DeleteKeyEx_impl(PyObject *module, HKEY key, const wchar_t *sub_key,
502 REGSAM access, int reserved);
503
504 static PyObject *
505 winreg_DeleteKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
506 {
507 PyObject *return_value = NULL;
508 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
509
510 #define NUM_KEYWORDS 4
511 static struct {
512 PyGC_Head _this_is_not_used;
513 PyObject_VAR_HEAD
514 Py_hash_t ob_hash;
515 PyObject *ob_item[NUM_KEYWORDS];
516 } _kwtuple = {
517 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
518 .ob_hash = -1,
519 .ob_item = { &_Py_ID(key), &_Py_ID(sub_key), &_Py_ID(access), &_Py_ID(reserved), },
520 };
521 #undef NUM_KEYWORDS
522 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
523
524 #else // !Py_BUILD_CORE
525 # define KWTUPLE NULL
526 #endif // !Py_BUILD_CORE
527
528 static const char * const _keywords[] = {"key", "sub_key", "access", "reserved", NULL};
529 static _PyArg_Parser _parser = {
530 .keywords = _keywords,
531 .fname = "DeleteKeyEx",
532 .kwtuple = KWTUPLE,
533 };
534 #undef KWTUPLE
535 PyObject *argsbuf[4];
536 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
537 HKEY key;
538 const wchar_t *sub_key = NULL;
539 REGSAM access = KEY_WOW64_64KEY;
540 int reserved = 0;
541
542 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
543 /*minpos*/ 2, /*maxpos*/ 4, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
544 if (!args) {
545 goto exit;
546 }
547 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
548 goto exit;
549 }
550 if (!PyUnicode_Check(args[1])) {
551 _PyArg_BadArgument("DeleteKeyEx", "argument 'sub_key'", "str", args[1]);
552 goto exit;
553 }
554 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
555 if (sub_key == NULL) {
556 goto exit;
557 }
558 if (!noptargs) {
559 goto skip_optional_pos;
560 }
561 if (args[2]) {
562 access = PyLong_AsInt(args[2]);
563 if (access == -1 && PyErr_Occurred()) {
564 goto exit;
565 }
566 if (!--noptargs) {
567 goto skip_optional_pos;
568 }
569 }
570 reserved = PyLong_AsInt(args[3]);
571 if (reserved == -1 && PyErr_Occurred()) {
572 goto exit;
573 }
574 skip_optional_pos:
575 return_value = winreg_DeleteKeyEx_impl(module, key, sub_key, access, reserved);
576
577 exit:
578 /* Cleanup for sub_key */
579 PyMem_Free((void *)sub_key);
580
581 return return_value;
582 }
583
584 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
585
586 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
587
588 PyDoc_STRVAR(winreg_DeleteValue__doc__,
589 "DeleteValue($module, key, value, /)\n"
590 "--\n"
591 "\n"
592 "Removes a named value from a registry key.\n"
593 "\n"
594 " key\n"
595 " An already open key, or any one of the predefined HKEY_* constants.\n"
596 " value\n"
597 " A string that identifies the value to remove.");
598
599 #define WINREG_DELETEVALUE_METHODDEF \
600 {"DeleteValue", _PyCFunction_CAST(winreg_DeleteValue), METH_FASTCALL, winreg_DeleteValue__doc__},
601
602 static PyObject *
603 winreg_DeleteValue_impl(PyObject *module, HKEY key, const wchar_t *value);
604
605 static PyObject *
606 winreg_DeleteValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
607 {
608 PyObject *return_value = NULL;
609 HKEY key;
610 const wchar_t *value = NULL;
611
612 if (!_PyArg_CheckPositional("DeleteValue", nargs, 2, 2)) {
613 goto exit;
614 }
615 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
616 goto exit;
617 }
618 if (args[1] == Py_None) {
619 value = NULL;
620 }
621 else if (PyUnicode_Check(args[1])) {
622 value = PyUnicode_AsWideCharString(args[1], NULL);
623 if (value == NULL) {
624 goto exit;
625 }
626 }
627 else {
628 _PyArg_BadArgument("DeleteValue", "argument 2", "str or None", args[1]);
629 goto exit;
630 }
631 return_value = winreg_DeleteValue_impl(module, key, value);
632
633 exit:
634 /* Cleanup for value */
635 PyMem_Free((void *)value);
636
637 return return_value;
638 }
639
640 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
641
642 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
643
644 PyDoc_STRVAR(winreg_EnumKey__doc__,
645 "EnumKey($module, key, index, /)\n"
646 "--\n"
647 "\n"
648 "Enumerates subkeys of an open registry key.\n"
649 "\n"
650 " key\n"
651 " An already open key, or any one of the predefined HKEY_* constants.\n"
652 " index\n"
653 " An integer that identifies the index of the key to retrieve.\n"
654 "\n"
655 "The function retrieves the name of one subkey each time it is called.\n"
656 "It is typically called repeatedly until an OSError exception is\n"
657 "raised, indicating no more values are available.");
658
659 #define WINREG_ENUMKEY_METHODDEF \
660 {"EnumKey", _PyCFunction_CAST(winreg_EnumKey), METH_FASTCALL, winreg_EnumKey__doc__},
661
662 static PyObject *
663 winreg_EnumKey_impl(PyObject *module, HKEY key, int index);
664
665 static PyObject *
666 winreg_EnumKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
667 {
668 PyObject *return_value = NULL;
669 HKEY key;
670 int index;
671
672 if (!_PyArg_CheckPositional("EnumKey", nargs, 2, 2)) {
673 goto exit;
674 }
675 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
676 goto exit;
677 }
678 index = PyLong_AsInt(args[1]);
679 if (index == -1 && PyErr_Occurred()) {
680 goto exit;
681 }
682 return_value = winreg_EnumKey_impl(module, key, index);
683
684 exit:
685 return return_value;
686 }
687
688 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
689
690 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
691
692 PyDoc_STRVAR(winreg_EnumValue__doc__,
693 "EnumValue($module, key, index, /)\n"
694 "--\n"
695 "\n"
696 "Enumerates values of an open registry key.\n"
697 "\n"
698 " key\n"
699 " An already open key, or any one of the predefined HKEY_* constants.\n"
700 " index\n"
701 " An integer that identifies the index of the value to retrieve.\n"
702 "\n"
703 "The function retrieves the name of one subkey each time it is called.\n"
704 "It is typically called repeatedly, until an OSError exception\n"
705 "is raised, indicating no more values.\n"
706 "\n"
707 "The result is a tuple of 3 items:\n"
708 " value_name\n"
709 " A string that identifies the value.\n"
710 " value_data\n"
711 " An object that holds the value data, and whose type depends\n"
712 " on the underlying registry type.\n"
713 " data_type\n"
714 " An integer that identifies the type of the value data.");
715
716 #define WINREG_ENUMVALUE_METHODDEF \
717 {"EnumValue", _PyCFunction_CAST(winreg_EnumValue), METH_FASTCALL, winreg_EnumValue__doc__},
718
719 static PyObject *
720 winreg_EnumValue_impl(PyObject *module, HKEY key, int index);
721
722 static PyObject *
723 winreg_EnumValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
724 {
725 PyObject *return_value = NULL;
726 HKEY key;
727 int index;
728
729 if (!_PyArg_CheckPositional("EnumValue", nargs, 2, 2)) {
730 goto exit;
731 }
732 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
733 goto exit;
734 }
735 index = PyLong_AsInt(args[1]);
736 if (index == -1 && PyErr_Occurred()) {
737 goto exit;
738 }
739 return_value = winreg_EnumValue_impl(module, key, index);
740
741 exit:
742 return return_value;
743 }
744
745 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
746
747 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
748
749 PyDoc_STRVAR(winreg_ExpandEnvironmentStrings__doc__,
750 "ExpandEnvironmentStrings($module, string, /)\n"
751 "--\n"
752 "\n"
753 "Expand environment vars.");
754
755 #define WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF \
756 {"ExpandEnvironmentStrings", (PyCFunction)winreg_ExpandEnvironmentStrings, METH_O, winreg_ExpandEnvironmentStrings__doc__},
757
758 static PyObject *
759 winreg_ExpandEnvironmentStrings_impl(PyObject *module, const wchar_t *string);
760
761 static PyObject *
762 winreg_ExpandEnvironmentStrings(PyObject *module, PyObject *arg)
763 {
764 PyObject *return_value = NULL;
765 const wchar_t *string = NULL;
766
767 if (!PyUnicode_Check(arg)) {
768 _PyArg_BadArgument("ExpandEnvironmentStrings", "argument", "str", arg);
769 goto exit;
770 }
771 string = PyUnicode_AsWideCharString(arg, NULL);
772 if (string == NULL) {
773 goto exit;
774 }
775 return_value = winreg_ExpandEnvironmentStrings_impl(module, string);
776
777 exit:
778 /* Cleanup for string */
779 PyMem_Free((void *)string);
780
781 return return_value;
782 }
783
784 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
785
786 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
787
788 PyDoc_STRVAR(winreg_FlushKey__doc__,
789 "FlushKey($module, key, /)\n"
790 "--\n"
791 "\n"
792 "Writes all the attributes of a key to the registry.\n"
793 "\n"
794 " key\n"
795 " An already open key, or any one of the predefined HKEY_* constants.\n"
796 "\n"
797 "It is not necessary to call FlushKey to change a key. Registry changes\n"
798 "are flushed to disk by the registry using its lazy flusher. Registry\n"
799 "changes are also flushed to disk at system shutdown. Unlike\n"
800 "CloseKey(), the FlushKey() method returns only when all the data has\n"
801 "been written to the registry.\n"
802 "\n"
803 "An application should only call FlushKey() if it requires absolute\n"
804 "certainty that registry changes are on disk. If you don\'t know whether\n"
805 "a FlushKey() call is required, it probably isn\'t.");
806
807 #define WINREG_FLUSHKEY_METHODDEF \
808 {"FlushKey", (PyCFunction)winreg_FlushKey, METH_O, winreg_FlushKey__doc__},
809
810 static PyObject *
811 winreg_FlushKey_impl(PyObject *module, HKEY key);
812
813 static PyObject *
814 winreg_FlushKey(PyObject *module, PyObject *arg)
815 {
816 PyObject *return_value = NULL;
817 HKEY key;
818
819 if (!clinic_HKEY_converter(_PyModule_GetState(module), arg, &key)) {
820 goto exit;
821 }
822 return_value = winreg_FlushKey_impl(module, key);
823
824 exit:
825 return return_value;
826 }
827
828 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
829
830 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
831
832 PyDoc_STRVAR(winreg_LoadKey__doc__,
833 "LoadKey($module, key, sub_key, file_name, /)\n"
834 "--\n"
835 "\n"
836 "Insert data into the registry from a file.\n"
837 "\n"
838 " key\n"
839 " An already open key, or any one of the predefined HKEY_* constants.\n"
840 " sub_key\n"
841 " A string that identifies the sub-key to load.\n"
842 " file_name\n"
843 " The name of the file to load registry data from. This file must\n"
844 " have been created with the SaveKey() function. Under the file\n"
845 " allocation table (FAT) file system, the filename may not have an\n"
846 " extension.\n"
847 "\n"
848 "Creates a subkey under the specified key and stores registration\n"
849 "information from a specified file into that subkey.\n"
850 "\n"
851 "A call to LoadKey() fails if the calling process does not have the\n"
852 "SE_RESTORE_PRIVILEGE privilege.\n"
853 "\n"
854 "If key is a handle returned by ConnectRegistry(), then the path\n"
855 "specified in fileName is relative to the remote computer.\n"
856 "\n"
857 "The MSDN docs imply key must be in the HKEY_USER or HKEY_LOCAL_MACHINE\n"
858 "tree.");
859
860 #define WINREG_LOADKEY_METHODDEF \
861 {"LoadKey", _PyCFunction_CAST(winreg_LoadKey), METH_FASTCALL, winreg_LoadKey__doc__},
862
863 static PyObject *
864 winreg_LoadKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key,
865 const wchar_t *file_name);
866
867 static PyObject *
868 winreg_LoadKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
869 {
870 PyObject *return_value = NULL;
871 HKEY key;
872 const wchar_t *sub_key = NULL;
873 const wchar_t *file_name = NULL;
874
875 if (!_PyArg_CheckPositional("LoadKey", nargs, 3, 3)) {
876 goto exit;
877 }
878 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
879 goto exit;
880 }
881 if (!PyUnicode_Check(args[1])) {
882 _PyArg_BadArgument("LoadKey", "argument 2", "str", args[1]);
883 goto exit;
884 }
885 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
886 if (sub_key == NULL) {
887 goto exit;
888 }
889 if (!PyUnicode_Check(args[2])) {
890 _PyArg_BadArgument("LoadKey", "argument 3", "str", args[2]);
891 goto exit;
892 }
893 file_name = PyUnicode_AsWideCharString(args[2], NULL);
894 if (file_name == NULL) {
895 goto exit;
896 }
897 return_value = winreg_LoadKey_impl(module, key, sub_key, file_name);
898
899 exit:
900 /* Cleanup for sub_key */
901 PyMem_Free((void *)sub_key);
902 /* Cleanup for file_name */
903 PyMem_Free((void *)file_name);
904
905 return return_value;
906 }
907
908 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
909
910 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
911
912 PyDoc_STRVAR(winreg_OpenKey__doc__,
913 "OpenKey($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n"
914 "--\n"
915 "\n"
916 "Opens the specified key.\n"
917 "\n"
918 " key\n"
919 " An already open key, or any one of the predefined HKEY_* constants.\n"
920 " sub_key\n"
921 " A string that identifies the sub_key to open.\n"
922 " reserved\n"
923 " A reserved integer that must be zero. Default is zero.\n"
924 " access\n"
925 " An integer that specifies an access mask that describes the desired\n"
926 " security access for the key. Default is KEY_READ.\n"
927 "\n"
928 "The result is a new handle to the specified key.\n"
929 "If the function fails, an OSError exception is raised.");
930
931 #define WINREG_OPENKEY_METHODDEF \
932 {"OpenKey", _PyCFunction_CAST(winreg_OpenKey), METH_FASTCALL|METH_KEYWORDS, winreg_OpenKey__doc__},
933
934 static HKEY
935 winreg_OpenKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key,
936 int reserved, REGSAM access);
937
938 static PyObject *
939 winreg_OpenKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
940 {
941 PyObject *return_value = NULL;
942 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
943
944 #define NUM_KEYWORDS 4
945 static struct {
946 PyGC_Head _this_is_not_used;
947 PyObject_VAR_HEAD
948 Py_hash_t ob_hash;
949 PyObject *ob_item[NUM_KEYWORDS];
950 } _kwtuple = {
951 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
952 .ob_hash = -1,
953 .ob_item = { &_Py_ID(key), &_Py_ID(sub_key), &_Py_ID(reserved), &_Py_ID(access), },
954 };
955 #undef NUM_KEYWORDS
956 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
957
958 #else // !Py_BUILD_CORE
959 # define KWTUPLE NULL
960 #endif // !Py_BUILD_CORE
961
962 static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
963 static _PyArg_Parser _parser = {
964 .keywords = _keywords,
965 .fname = "OpenKey",
966 .kwtuple = KWTUPLE,
967 };
968 #undef KWTUPLE
969 PyObject *argsbuf[4];
970 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
971 HKEY key;
972 const wchar_t *sub_key = NULL;
973 int reserved = 0;
974 REGSAM access = KEY_READ;
975 HKEY _return_value;
976
977 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
978 /*minpos*/ 2, /*maxpos*/ 4, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
979 if (!args) {
980 goto exit;
981 }
982 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
983 goto exit;
984 }
985 if (args[1] == Py_None) {
986 sub_key = NULL;
987 }
988 else if (PyUnicode_Check(args[1])) {
989 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
990 if (sub_key == NULL) {
991 goto exit;
992 }
993 }
994 else {
995 _PyArg_BadArgument("OpenKey", "argument 'sub_key'", "str or None", args[1]);
996 goto exit;
997 }
998 if (!noptargs) {
999 goto skip_optional_pos;
1000 }
1001 if (args[2]) {
1002 reserved = PyLong_AsInt(args[2]);
1003 if (reserved == -1 && PyErr_Occurred()) {
1004 goto exit;
1005 }
1006 if (!--noptargs) {
1007 goto skip_optional_pos;
1008 }
1009 }
1010 access = PyLong_AsInt(args[3]);
1011 if (access == -1 && PyErr_Occurred()) {
1012 goto exit;
1013 }
1014 skip_optional_pos:
1015 _return_value = winreg_OpenKey_impl(module, key, sub_key, reserved, access);
1016 if (_return_value == NULL) {
1017 goto exit;
1018 }
1019 return_value = PyHKEY_FromHKEY(_PyModule_GetState(module), _return_value);
1020
1021 exit:
1022 /* Cleanup for sub_key */
1023 PyMem_Free((void *)sub_key);
1024
1025 return return_value;
1026 }
1027
1028 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
1029
1030 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
1031
1032 PyDoc_STRVAR(winreg_OpenKeyEx__doc__,
1033 "OpenKeyEx($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n"
1034 "--\n"
1035 "\n"
1036 "Opens the specified key.\n"
1037 "\n"
1038 " key\n"
1039 " An already open key, or any one of the predefined HKEY_* constants.\n"
1040 " sub_key\n"
1041 " A string that identifies the sub_key to open.\n"
1042 " reserved\n"
1043 " A reserved integer that must be zero. Default is zero.\n"
1044 " access\n"
1045 " An integer that specifies an access mask that describes the desired\n"
1046 " security access for the key. Default is KEY_READ.\n"
1047 "\n"
1048 "The result is a new handle to the specified key.\n"
1049 "If the function fails, an OSError exception is raised.");
1050
1051 #define WINREG_OPENKEYEX_METHODDEF \
1052 {"OpenKeyEx", _PyCFunction_CAST(winreg_OpenKeyEx), METH_FASTCALL|METH_KEYWORDS, winreg_OpenKeyEx__doc__},
1053
1054 static HKEY
1055 winreg_OpenKeyEx_impl(PyObject *module, HKEY key, const wchar_t *sub_key,
1056 int reserved, REGSAM access);
1057
1058 static PyObject *
1059 winreg_OpenKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
1060 {
1061 PyObject *return_value = NULL;
1062 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
1063
1064 #define NUM_KEYWORDS 4
1065 static struct {
1066 PyGC_Head _this_is_not_used;
1067 PyObject_VAR_HEAD
1068 Py_hash_t ob_hash;
1069 PyObject *ob_item[NUM_KEYWORDS];
1070 } _kwtuple = {
1071 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
1072 .ob_hash = -1,
1073 .ob_item = { &_Py_ID(key), &_Py_ID(sub_key), &_Py_ID(reserved), &_Py_ID(access), },
1074 };
1075 #undef NUM_KEYWORDS
1076 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
1077
1078 #else // !Py_BUILD_CORE
1079 # define KWTUPLE NULL
1080 #endif // !Py_BUILD_CORE
1081
1082 static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
1083 static _PyArg_Parser _parser = {
1084 .keywords = _keywords,
1085 .fname = "OpenKeyEx",
1086 .kwtuple = KWTUPLE,
1087 };
1088 #undef KWTUPLE
1089 PyObject *argsbuf[4];
1090 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
1091 HKEY key;
1092 const wchar_t *sub_key = NULL;
1093 int reserved = 0;
1094 REGSAM access = KEY_READ;
1095 HKEY _return_value;
1096
1097 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
1098 /*minpos*/ 2, /*maxpos*/ 4, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
1099 if (!args) {
1100 goto exit;
1101 }
1102 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
1103 goto exit;
1104 }
1105 if (args[1] == Py_None) {
1106 sub_key = NULL;
1107 }
1108 else if (PyUnicode_Check(args[1])) {
1109 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
1110 if (sub_key == NULL) {
1111 goto exit;
1112 }
1113 }
1114 else {
1115 _PyArg_BadArgument("OpenKeyEx", "argument 'sub_key'", "str or None", args[1]);
1116 goto exit;
1117 }
1118 if (!noptargs) {
1119 goto skip_optional_pos;
1120 }
1121 if (args[2]) {
1122 reserved = PyLong_AsInt(args[2]);
1123 if (reserved == -1 && PyErr_Occurred()) {
1124 goto exit;
1125 }
1126 if (!--noptargs) {
1127 goto skip_optional_pos;
1128 }
1129 }
1130 access = PyLong_AsInt(args[3]);
1131 if (access == -1 && PyErr_Occurred()) {
1132 goto exit;
1133 }
1134 skip_optional_pos:
1135 _return_value = winreg_OpenKeyEx_impl(module, key, sub_key, reserved, access);
1136 if (_return_value == NULL) {
1137 goto exit;
1138 }
1139 return_value = PyHKEY_FromHKEY(_PyModule_GetState(module), _return_value);
1140
1141 exit:
1142 /* Cleanup for sub_key */
1143 PyMem_Free((void *)sub_key);
1144
1145 return return_value;
1146 }
1147
1148 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
1149
1150 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
1151
1152 PyDoc_STRVAR(winreg_QueryInfoKey__doc__,
1153 "QueryInfoKey($module, key, /)\n"
1154 "--\n"
1155 "\n"
1156 "Returns information about a key.\n"
1157 "\n"
1158 " key\n"
1159 " An already open key, or any one of the predefined HKEY_* constants.\n"
1160 "\n"
1161 "The result is a tuple of 3 items:\n"
1162 "An integer that identifies the number of sub keys this key has.\n"
1163 "An integer that identifies the number of values this key has.\n"
1164 "An integer that identifies when the key was last modified (if available)\n"
1165 "as 100\'s of nanoseconds since Jan 1, 1600.");
1166
1167 #define WINREG_QUERYINFOKEY_METHODDEF \
1168 {"QueryInfoKey", (PyCFunction)winreg_QueryInfoKey, METH_O, winreg_QueryInfoKey__doc__},
1169
1170 static PyObject *
1171 winreg_QueryInfoKey_impl(PyObject *module, HKEY key);
1172
1173 static PyObject *
1174 winreg_QueryInfoKey(PyObject *module, PyObject *arg)
1175 {
1176 PyObject *return_value = NULL;
1177 HKEY key;
1178
1179 if (!clinic_HKEY_converter(_PyModule_GetState(module), arg, &key)) {
1180 goto exit;
1181 }
1182 return_value = winreg_QueryInfoKey_impl(module, key);
1183
1184 exit:
1185 return return_value;
1186 }
1187
1188 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
1189
1190 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
1191
1192 PyDoc_STRVAR(winreg_QueryValue__doc__,
1193 "QueryValue($module, key, sub_key, /)\n"
1194 "--\n"
1195 "\n"
1196 "Retrieves the unnamed value for a key.\n"
1197 "\n"
1198 " key\n"
1199 " An already open key, or any one of the predefined HKEY_* constants.\n"
1200 " sub_key\n"
1201 " A string that holds the name of the subkey with which the value\n"
1202 " is associated. If this parameter is None or empty, the function\n"
1203 " retrieves the value set by the SetValue() method for the key\n"
1204 " identified by key.\n"
1205 "\n"
1206 "Values in the registry have name, type, and data components. This method\n"
1207 "retrieves the data for a key\'s first value that has a NULL name.\n"
1208 "But since the underlying API call doesn\'t return the type, you\'ll\n"
1209 "probably be happier using QueryValueEx; this function is just here for\n"
1210 "completeness.");
1211
1212 #define WINREG_QUERYVALUE_METHODDEF \
1213 {"QueryValue", _PyCFunction_CAST(winreg_QueryValue), METH_FASTCALL, winreg_QueryValue__doc__},
1214
1215 static PyObject *
1216 winreg_QueryValue_impl(PyObject *module, HKEY key, const wchar_t *sub_key);
1217
1218 static PyObject *
1219 winreg_QueryValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1220 {
1221 PyObject *return_value = NULL;
1222 HKEY key;
1223 const wchar_t *sub_key = NULL;
1224
1225 if (!_PyArg_CheckPositional("QueryValue", nargs, 2, 2)) {
1226 goto exit;
1227 }
1228 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
1229 goto exit;
1230 }
1231 if (args[1] == Py_None) {
1232 sub_key = NULL;
1233 }
1234 else if (PyUnicode_Check(args[1])) {
1235 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
1236 if (sub_key == NULL) {
1237 goto exit;
1238 }
1239 }
1240 else {
1241 _PyArg_BadArgument("QueryValue", "argument 2", "str or None", args[1]);
1242 goto exit;
1243 }
1244 return_value = winreg_QueryValue_impl(module, key, sub_key);
1245
1246 exit:
1247 /* Cleanup for sub_key */
1248 PyMem_Free((void *)sub_key);
1249
1250 return return_value;
1251 }
1252
1253 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
1254
1255 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
1256
1257 PyDoc_STRVAR(winreg_QueryValueEx__doc__,
1258 "QueryValueEx($module, key, name, /)\n"
1259 "--\n"
1260 "\n"
1261 "Retrieves the type and value of a specified sub-key.\n"
1262 "\n"
1263 " key\n"
1264 " An already open key, or any one of the predefined HKEY_* constants.\n"
1265 " name\n"
1266 " A string indicating the value to query.\n"
1267 "\n"
1268 "Behaves mostly like QueryValue(), but also returns the type of the\n"
1269 "specified value name associated with the given open registry key.\n"
1270 "\n"
1271 "The return value is a tuple of the value and the type_id.");
1272
1273 #define WINREG_QUERYVALUEEX_METHODDEF \
1274 {"QueryValueEx", _PyCFunction_CAST(winreg_QueryValueEx), METH_FASTCALL, winreg_QueryValueEx__doc__},
1275
1276 static PyObject *
1277 winreg_QueryValueEx_impl(PyObject *module, HKEY key, const wchar_t *name);
1278
1279 static PyObject *
1280 winreg_QueryValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1281 {
1282 PyObject *return_value = NULL;
1283 HKEY key;
1284 const wchar_t *name = NULL;
1285
1286 if (!_PyArg_CheckPositional("QueryValueEx", nargs, 2, 2)) {
1287 goto exit;
1288 }
1289 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
1290 goto exit;
1291 }
1292 if (args[1] == Py_None) {
1293 name = NULL;
1294 }
1295 else if (PyUnicode_Check(args[1])) {
1296 name = PyUnicode_AsWideCharString(args[1], NULL);
1297 if (name == NULL) {
1298 goto exit;
1299 }
1300 }
1301 else {
1302 _PyArg_BadArgument("QueryValueEx", "argument 2", "str or None", args[1]);
1303 goto exit;
1304 }
1305 return_value = winreg_QueryValueEx_impl(module, key, name);
1306
1307 exit:
1308 /* Cleanup for name */
1309 PyMem_Free((void *)name);
1310
1311 return return_value;
1312 }
1313
1314 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
1315
1316 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
1317
1318 PyDoc_STRVAR(winreg_SaveKey__doc__,
1319 "SaveKey($module, key, file_name, /)\n"
1320 "--\n"
1321 "\n"
1322 "Saves the specified key, and all its subkeys to the specified file.\n"
1323 "\n"
1324 " key\n"
1325 " An already open key, or any one of the predefined HKEY_* constants.\n"
1326 " file_name\n"
1327 " The name of the file to save registry data to. This file cannot\n"
1328 " already exist. If this filename includes an extension, it cannot be\n"
1329 " used on file allocation table (FAT) file systems by the LoadKey(),\n"
1330 " ReplaceKey() or RestoreKey() methods.\n"
1331 "\n"
1332 "If key represents a key on a remote computer, the path described by\n"
1333 "file_name is relative to the remote computer.\n"
1334 "\n"
1335 "The caller of this method must possess the SeBackupPrivilege\n"
1336 "security privilege. This function passes NULL for security_attributes\n"
1337 "to the API.");
1338
1339 #define WINREG_SAVEKEY_METHODDEF \
1340 {"SaveKey", _PyCFunction_CAST(winreg_SaveKey), METH_FASTCALL, winreg_SaveKey__doc__},
1341
1342 static PyObject *
1343 winreg_SaveKey_impl(PyObject *module, HKEY key, const wchar_t *file_name);
1344
1345 static PyObject *
1346 winreg_SaveKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1347 {
1348 PyObject *return_value = NULL;
1349 HKEY key;
1350 const wchar_t *file_name = NULL;
1351
1352 if (!_PyArg_CheckPositional("SaveKey", nargs, 2, 2)) {
1353 goto exit;
1354 }
1355 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
1356 goto exit;
1357 }
1358 if (!PyUnicode_Check(args[1])) {
1359 _PyArg_BadArgument("SaveKey", "argument 2", "str", args[1]);
1360 goto exit;
1361 }
1362 file_name = PyUnicode_AsWideCharString(args[1], NULL);
1363 if (file_name == NULL) {
1364 goto exit;
1365 }
1366 return_value = winreg_SaveKey_impl(module, key, file_name);
1367
1368 exit:
1369 /* Cleanup for file_name */
1370 PyMem_Free((void *)file_name);
1371
1372 return return_value;
1373 }
1374
1375 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
1376
1377 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
1378
1379 PyDoc_STRVAR(winreg_SetValue__doc__,
1380 "SetValue($module, key, sub_key, type, value, /)\n"
1381 "--\n"
1382 "\n"
1383 "Associates a value with a specified key.\n"
1384 "\n"
1385 " key\n"
1386 " An already open key, or any one of the predefined HKEY_* constants.\n"
1387 " sub_key\n"
1388 " A string that names the subkey with which the value is associated.\n"
1389 " type\n"
1390 " An integer that specifies the type of the data. Currently this must\n"
1391 " be REG_SZ, meaning only strings are supported.\n"
1392 " value\n"
1393 " A string that specifies the new value.\n"
1394 "\n"
1395 "If the key specified by the sub_key parameter does not exist, the\n"
1396 "SetValue function creates it.\n"
1397 "\n"
1398 "Value lengths are limited by available memory. Long values (more than\n"
1399 "2048 bytes) should be stored as files with the filenames stored in\n"
1400 "the configuration registry to help the registry perform efficiently.\n"
1401 "\n"
1402 "The key identified by the key parameter must have been opened with\n"
1403 "KEY_SET_VALUE access.");
1404
1405 #define WINREG_SETVALUE_METHODDEF \
1406 {"SetValue", _PyCFunction_CAST(winreg_SetValue), METH_FASTCALL, winreg_SetValue__doc__},
1407
1408 static PyObject *
1409 winreg_SetValue_impl(PyObject *module, HKEY key, const wchar_t *sub_key,
1410 DWORD type, PyObject *value_obj);
1411
1412 static PyObject *
1413 winreg_SetValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1414 {
1415 PyObject *return_value = NULL;
1416 HKEY key;
1417 const wchar_t *sub_key = NULL;
1418 DWORD type;
1419 PyObject *value_obj;
1420
1421 if (!_PyArg_CheckPositional("SetValue", nargs, 4, 4)) {
1422 goto exit;
1423 }
1424 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
1425 goto exit;
1426 }
1427 if (args[1] == Py_None) {
1428 sub_key = NULL;
1429 }
1430 else if (PyUnicode_Check(args[1])) {
1431 sub_key = PyUnicode_AsWideCharString(args[1], NULL);
1432 if (sub_key == NULL) {
1433 goto exit;
1434 }
1435 }
1436 else {
1437 _PyArg_BadArgument("SetValue", "argument 2", "str or None", args[1]);
1438 goto exit;
1439 }
1440 if (!_PyLong_UnsignedLong_Converter(args[2], &type)) {
1441 goto exit;
1442 }
1443 if (!PyUnicode_Check(args[3])) {
1444 _PyArg_BadArgument("SetValue", "argument 4", "str", args[3]);
1445 goto exit;
1446 }
1447 value_obj = args[3];
1448 return_value = winreg_SetValue_impl(module, key, sub_key, type, value_obj);
1449
1450 exit:
1451 /* Cleanup for sub_key */
1452 PyMem_Free((void *)sub_key);
1453
1454 return return_value;
1455 }
1456
1457 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
1458
1459 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
1460
1461 PyDoc_STRVAR(winreg_SetValueEx__doc__,
1462 "SetValueEx($module, key, value_name, reserved, type, value, /)\n"
1463 "--\n"
1464 "\n"
1465 "Stores data in the value field of an open registry key.\n"
1466 "\n"
1467 " key\n"
1468 " An already open key, or any one of the predefined HKEY_* constants.\n"
1469 " value_name\n"
1470 " A string containing the name of the value to set, or None.\n"
1471 " reserved\n"
1472 " Can be anything - zero is always passed to the API.\n"
1473 " type\n"
1474 " An integer that specifies the type of the data, one of:\n"
1475 " REG_BINARY -- Binary data in any form.\n"
1476 " REG_DWORD -- A 32-bit number.\n"
1477 " REG_DWORD_LITTLE_ENDIAN -- A 32-bit number in little-endian format. Equivalent to REG_DWORD\n"
1478 " REG_DWORD_BIG_ENDIAN -- A 32-bit number in big-endian format.\n"
1479 " REG_EXPAND_SZ -- A null-terminated string that contains unexpanded\n"
1480 " references to environment variables (for example,\n"
1481 " %PATH%).\n"
1482 " REG_LINK -- A Unicode symbolic link.\n"
1483 " REG_MULTI_SZ -- A sequence of null-terminated strings, terminated\n"
1484 " by two null characters. Note that Python handles\n"
1485 " this termination automatically.\n"
1486 " REG_NONE -- No defined value type.\n"
1487 " REG_QWORD -- A 64-bit number.\n"
1488 " REG_QWORD_LITTLE_ENDIAN -- A 64-bit number in little-endian format. Equivalent to REG_QWORD.\n"
1489 " REG_RESOURCE_LIST -- A device-driver resource list.\n"
1490 " REG_SZ -- A null-terminated string.\n"
1491 " value\n"
1492 " A string that specifies the new value.\n"
1493 "\n"
1494 "This method can also set additional value and type information for the\n"
1495 "specified key. The key identified by the key parameter must have been\n"
1496 "opened with KEY_SET_VALUE access.\n"
1497 "\n"
1498 "To open the key, use the CreateKeyEx() or OpenKeyEx() methods.\n"
1499 "\n"
1500 "Value lengths are limited by available memory. Long values (more than\n"
1501 "2048 bytes) should be stored as files with the filenames stored in\n"
1502 "the configuration registry to help the registry perform efficiently.");
1503
1504 #define WINREG_SETVALUEEX_METHODDEF \
1505 {"SetValueEx", _PyCFunction_CAST(winreg_SetValueEx), METH_FASTCALL, winreg_SetValueEx__doc__},
1506
1507 static PyObject *
1508 winreg_SetValueEx_impl(PyObject *module, HKEY key, const wchar_t *value_name,
1509 PyObject *reserved, DWORD type, PyObject *value);
1510
1511 static PyObject *
1512 winreg_SetValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1513 {
1514 PyObject *return_value = NULL;
1515 HKEY key;
1516 const wchar_t *value_name = NULL;
1517 PyObject *reserved;
1518 DWORD type;
1519 PyObject *value;
1520
1521 if (!_PyArg_CheckPositional("SetValueEx", nargs, 5, 5)) {
1522 goto exit;
1523 }
1524 if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) {
1525 goto exit;
1526 }
1527 if (args[1] == Py_None) {
1528 value_name = NULL;
1529 }
1530 else if (PyUnicode_Check(args[1])) {
1531 value_name = PyUnicode_AsWideCharString(args[1], NULL);
1532 if (value_name == NULL) {
1533 goto exit;
1534 }
1535 }
1536 else {
1537 _PyArg_BadArgument("SetValueEx", "argument 2", "str or None", args[1]);
1538 goto exit;
1539 }
1540 reserved = args[2];
1541 if (!_PyLong_UnsignedLong_Converter(args[3], &type)) {
1542 goto exit;
1543 }
1544 value = args[4];
1545 return_value = winreg_SetValueEx_impl(module, key, value_name, reserved, type, value);
1546
1547 exit:
1548 /* Cleanup for value_name */
1549 PyMem_Free((void *)value_name);
1550
1551 return return_value;
1552 }
1553
1554 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
1555
1556 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
1557
1558 PyDoc_STRVAR(winreg_DisableReflectionKey__doc__,
1559 "DisableReflectionKey($module, key, /)\n"
1560 "--\n"
1561 "\n"
1562 "Disables registry reflection for 32bit processes running on a 64bit OS.\n"
1563 "\n"
1564 " key\n"
1565 " An already open key, or any one of the predefined HKEY_* constants.\n"
1566 "\n"
1567 "Will generally raise NotImplementedError if executed on a 32bit OS.\n"
1568 "\n"
1569 "If the key is not on the reflection list, the function succeeds but has\n"
1570 "no effect. Disabling reflection for a key does not affect reflection\n"
1571 "of any subkeys.");
1572
1573 #define WINREG_DISABLEREFLECTIONKEY_METHODDEF \
1574 {"DisableReflectionKey", (PyCFunction)winreg_DisableReflectionKey, METH_O, winreg_DisableReflectionKey__doc__},
1575
1576 static PyObject *
1577 winreg_DisableReflectionKey_impl(PyObject *module, HKEY key);
1578
1579 static PyObject *
1580 winreg_DisableReflectionKey(PyObject *module, PyObject *arg)
1581 {
1582 PyObject *return_value = NULL;
1583 HKEY key;
1584
1585 if (!clinic_HKEY_converter(_PyModule_GetState(module), arg, &key)) {
1586 goto exit;
1587 }
1588 return_value = winreg_DisableReflectionKey_impl(module, key);
1589
1590 exit:
1591 return return_value;
1592 }
1593
1594 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
1595
1596 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
1597
1598 PyDoc_STRVAR(winreg_EnableReflectionKey__doc__,
1599 "EnableReflectionKey($module, key, /)\n"
1600 "--\n"
1601 "\n"
1602 "Restores registry reflection for the specified disabled key.\n"
1603 "\n"
1604 " key\n"
1605 " An already open key, or any one of the predefined HKEY_* constants.\n"
1606 "\n"
1607 "Will generally raise NotImplementedError if executed on a 32bit OS.\n"
1608 "Restoring reflection for a key does not affect reflection of any\n"
1609 "subkeys.");
1610
1611 #define WINREG_ENABLEREFLECTIONKEY_METHODDEF \
1612 {"EnableReflectionKey", (PyCFunction)winreg_EnableReflectionKey, METH_O, winreg_EnableReflectionKey__doc__},
1613
1614 static PyObject *
1615 winreg_EnableReflectionKey_impl(PyObject *module, HKEY key);
1616
1617 static PyObject *
1618 winreg_EnableReflectionKey(PyObject *module, PyObject *arg)
1619 {
1620 PyObject *return_value = NULL;
1621 HKEY key;
1622
1623 if (!clinic_HKEY_converter(_PyModule_GetState(module), arg, &key)) {
1624 goto exit;
1625 }
1626 return_value = winreg_EnableReflectionKey_impl(module, key);
1627
1628 exit:
1629 return return_value;
1630 }
1631
1632 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
1633
1634 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
1635
1636 PyDoc_STRVAR(winreg_QueryReflectionKey__doc__,
1637 "QueryReflectionKey($module, key, /)\n"
1638 "--\n"
1639 "\n"
1640 "Returns the reflection state for the specified key as a bool.\n"
1641 "\n"
1642 " key\n"
1643 " An already open key, or any one of the predefined HKEY_* constants.\n"
1644 "\n"
1645 "Will generally raise NotImplementedError if executed on a 32bit OS.");
1646
1647 #define WINREG_QUERYREFLECTIONKEY_METHODDEF \
1648 {"QueryReflectionKey", (PyCFunction)winreg_QueryReflectionKey, METH_O, winreg_QueryReflectionKey__doc__},
1649
1650 static PyObject *
1651 winreg_QueryReflectionKey_impl(PyObject *module, HKEY key);
1652
1653 static PyObject *
1654 winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
1655 {
1656 PyObject *return_value = NULL;
1657 HKEY key;
1658
1659 if (!clinic_HKEY_converter(_PyModule_GetState(module), arg, &key)) {
1660 goto exit;
1661 }
1662 return_value = winreg_QueryReflectionKey_impl(module, key);
1663
1664 exit:
1665 return return_value;
1666 }
1667
1668 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
1669
1670 #ifndef WINREG_HKEYTYPE_CLOSE_METHODDEF
1671 #define WINREG_HKEYTYPE_CLOSE_METHODDEF
1672 #endif /* !defined(WINREG_HKEYTYPE_CLOSE_METHODDEF) */
1673
1674 #ifndef WINREG_HKEYTYPE_DETACH_METHODDEF
1675 #define WINREG_HKEYTYPE_DETACH_METHODDEF
1676 #endif /* !defined(WINREG_HKEYTYPE_DETACH_METHODDEF) */
1677
1678 #ifndef WINREG_HKEYTYPE___ENTER___METHODDEF
1679 #define WINREG_HKEYTYPE___ENTER___METHODDEF
1680 #endif /* !defined(WINREG_HKEYTYPE___ENTER___METHODDEF) */
1681
1682 #ifndef WINREG_HKEYTYPE___EXIT___METHODDEF
1683 #define WINREG_HKEYTYPE___EXIT___METHODDEF
1684 #endif /* !defined(WINREG_HKEYTYPE___EXIT___METHODDEF) */
1685
1686 #ifndef WINREG_CLOSEKEY_METHODDEF
1687 #define WINREG_CLOSEKEY_METHODDEF
1688 #endif /* !defined(WINREG_CLOSEKEY_METHODDEF) */
1689
1690 #ifndef WINREG_CONNECTREGISTRY_METHODDEF
1691 #define WINREG_CONNECTREGISTRY_METHODDEF
1692 #endif /* !defined(WINREG_CONNECTREGISTRY_METHODDEF) */
1693
1694 #ifndef WINREG_CREATEKEY_METHODDEF
1695 #define WINREG_CREATEKEY_METHODDEF
1696 #endif /* !defined(WINREG_CREATEKEY_METHODDEF) */
1697
1698 #ifndef WINREG_CREATEKEYEX_METHODDEF
1699 #define WINREG_CREATEKEYEX_METHODDEF
1700 #endif /* !defined(WINREG_CREATEKEYEX_METHODDEF) */
1701
1702 #ifndef WINREG_DELETEKEY_METHODDEF
1703 #define WINREG_DELETEKEY_METHODDEF
1704 #endif /* !defined(WINREG_DELETEKEY_METHODDEF) */
1705
1706 #ifndef WINREG_DELETEKEYEX_METHODDEF
1707 #define WINREG_DELETEKEYEX_METHODDEF
1708 #endif /* !defined(WINREG_DELETEKEYEX_METHODDEF) */
1709
1710 #ifndef WINREG_DELETEVALUE_METHODDEF
1711 #define WINREG_DELETEVALUE_METHODDEF
1712 #endif /* !defined(WINREG_DELETEVALUE_METHODDEF) */
1713
1714 #ifndef WINREG_ENUMKEY_METHODDEF
1715 #define WINREG_ENUMKEY_METHODDEF
1716 #endif /* !defined(WINREG_ENUMKEY_METHODDEF) */
1717
1718 #ifndef WINREG_ENUMVALUE_METHODDEF
1719 #define WINREG_ENUMVALUE_METHODDEF
1720 #endif /* !defined(WINREG_ENUMVALUE_METHODDEF) */
1721
1722 #ifndef WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF
1723 #define WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF
1724 #endif /* !defined(WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF) */
1725
1726 #ifndef WINREG_FLUSHKEY_METHODDEF
1727 #define WINREG_FLUSHKEY_METHODDEF
1728 #endif /* !defined(WINREG_FLUSHKEY_METHODDEF) */
1729
1730 #ifndef WINREG_LOADKEY_METHODDEF
1731 #define WINREG_LOADKEY_METHODDEF
1732 #endif /* !defined(WINREG_LOADKEY_METHODDEF) */
1733
1734 #ifndef WINREG_OPENKEY_METHODDEF
1735 #define WINREG_OPENKEY_METHODDEF
1736 #endif /* !defined(WINREG_OPENKEY_METHODDEF) */
1737
1738 #ifndef WINREG_OPENKEYEX_METHODDEF
1739 #define WINREG_OPENKEYEX_METHODDEF
1740 #endif /* !defined(WINREG_OPENKEYEX_METHODDEF) */
1741
1742 #ifndef WINREG_QUERYINFOKEY_METHODDEF
1743 #define WINREG_QUERYINFOKEY_METHODDEF
1744 #endif /* !defined(WINREG_QUERYINFOKEY_METHODDEF) */
1745
1746 #ifndef WINREG_QUERYVALUE_METHODDEF
1747 #define WINREG_QUERYVALUE_METHODDEF
1748 #endif /* !defined(WINREG_QUERYVALUE_METHODDEF) */
1749
1750 #ifndef WINREG_QUERYVALUEEX_METHODDEF
1751 #define WINREG_QUERYVALUEEX_METHODDEF
1752 #endif /* !defined(WINREG_QUERYVALUEEX_METHODDEF) */
1753
1754 #ifndef WINREG_SAVEKEY_METHODDEF
1755 #define WINREG_SAVEKEY_METHODDEF
1756 #endif /* !defined(WINREG_SAVEKEY_METHODDEF) */
1757
1758 #ifndef WINREG_SETVALUE_METHODDEF
1759 #define WINREG_SETVALUE_METHODDEF
1760 #endif /* !defined(WINREG_SETVALUE_METHODDEF) */
1761
1762 #ifndef WINREG_SETVALUEEX_METHODDEF
1763 #define WINREG_SETVALUEEX_METHODDEF
1764 #endif /* !defined(WINREG_SETVALUEEX_METHODDEF) */
1765
1766 #ifndef WINREG_DISABLEREFLECTIONKEY_METHODDEF
1767 #define WINREG_DISABLEREFLECTIONKEY_METHODDEF
1768 #endif /* !defined(WINREG_DISABLEREFLECTIONKEY_METHODDEF) */
1769
1770 #ifndef WINREG_ENABLEREFLECTIONKEY_METHODDEF
1771 #define WINREG_ENABLEREFLECTIONKEY_METHODDEF
1772 #endif /* !defined(WINREG_ENABLEREFLECTIONKEY_METHODDEF) */
1773
1774 #ifndef WINREG_QUERYREFLECTIONKEY_METHODDEF
1775 #define WINREG_QUERYREFLECTIONKEY_METHODDEF
1776 #endif /* !defined(WINREG_QUERYREFLECTIONKEY_METHODDEF) */
1777 /*[clinic end generated code: output=be4b6857b95558b5 input=a9049054013a1b77]*/