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