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