1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 | Samba utility functions
|
---|
4 | Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
|
---|
5 | Copyright (C) Wilco Baan Hofman <wilco@baanhofman.nl> 2010
|
---|
6 |
|
---|
7 | This program is free software; you can redistribute it and/or modify
|
---|
8 | it under the terms of the GNU General Public License as published by
|
---|
9 | the Free Software Foundation; either version 3 of the License, or
|
---|
10 | (at your option) any later version.
|
---|
11 |
|
---|
12 | This program is distributed in the hope that it will be useful,
|
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | GNU General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU General Public License
|
---|
18 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include <Python.h>
|
---|
22 | #include "includes.h"
|
---|
23 | #include "libcli/util/pyerrors.h"
|
---|
24 | #include "lib/registry/registry.h"
|
---|
25 | #include <pytalloc.h>
|
---|
26 | #include "lib/events/events.h"
|
---|
27 | #include "auth/credentials/pycredentials.h"
|
---|
28 | #include "param/pyparam.h"
|
---|
29 |
|
---|
30 | extern PyTypeObject PyRegistryKey;
|
---|
31 | extern PyTypeObject PyRegistry;
|
---|
32 | extern PyTypeObject PyHiveKey;
|
---|
33 |
|
---|
34 | void initregistry(void);
|
---|
35 |
|
---|
36 | /*#define PyRegistryKey_AsRegistryKey(obj) pytalloc_get_type(obj, struct registry_key)*/
|
---|
37 | #define PyRegistry_AsRegistryContext(obj) ((struct registry_context *)pytalloc_get_ptr(obj))
|
---|
38 | #define PyHiveKey_AsHiveKey(obj) ((struct hive_key*)pytalloc_get_ptr(obj))
|
---|
39 |
|
---|
40 |
|
---|
41 | static PyObject *py_get_predefined_key_by_name(PyObject *self, PyObject *args)
|
---|
42 | {
|
---|
43 | char *name;
|
---|
44 | WERROR result;
|
---|
45 | struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
|
---|
46 | struct registry_key *key;
|
---|
47 |
|
---|
48 | if (!PyArg_ParseTuple(args, "s", &name))
|
---|
49 | return NULL;
|
---|
50 |
|
---|
51 | result = reg_get_predefined_key_by_name(ctx, name, &key);
|
---|
52 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
53 |
|
---|
54 | return pytalloc_steal(&PyRegistryKey, key);
|
---|
55 | }
|
---|
56 |
|
---|
57 | static PyObject *py_key_del_abs(PyObject *self, PyObject *args)
|
---|
58 | {
|
---|
59 | char *path;
|
---|
60 | WERROR result;
|
---|
61 | struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
|
---|
62 |
|
---|
63 | if (!PyArg_ParseTuple(args, "s", &path))
|
---|
64 | return NULL;
|
---|
65 |
|
---|
66 | result = reg_key_del_abs(ctx, path);
|
---|
67 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
68 |
|
---|
69 | Py_RETURN_NONE;
|
---|
70 | }
|
---|
71 |
|
---|
72 | static PyObject *py_get_predefined_key(PyObject *self, PyObject *args)
|
---|
73 | {
|
---|
74 | uint32_t hkey;
|
---|
75 | struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
|
---|
76 | WERROR result;
|
---|
77 | struct registry_key *key;
|
---|
78 |
|
---|
79 | if (!PyArg_ParseTuple(args, "I", &hkey))
|
---|
80 | return NULL;
|
---|
81 |
|
---|
82 | result = reg_get_predefined_key(ctx, hkey, &key);
|
---|
83 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
84 |
|
---|
85 | return pytalloc_steal(&PyRegistryKey, key);
|
---|
86 | }
|
---|
87 |
|
---|
88 | static PyObject *py_diff_apply(PyObject *self, PyObject *args)
|
---|
89 | {
|
---|
90 | char *filename;
|
---|
91 | WERROR result;
|
---|
92 | struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
|
---|
93 | if (!PyArg_ParseTuple(args, "s", &filename))
|
---|
94 | return NULL;
|
---|
95 |
|
---|
96 | result = reg_diff_apply(ctx, filename);
|
---|
97 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
98 |
|
---|
99 | Py_RETURN_NONE;
|
---|
100 | }
|
---|
101 |
|
---|
102 | static PyObject *py_mount_hive(PyObject *self, PyObject *args)
|
---|
103 | {
|
---|
104 | struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
|
---|
105 | uint32_t hkey;
|
---|
106 | PyObject *py_hivekey, *py_elements = Py_None;
|
---|
107 | const char **elements;
|
---|
108 | WERROR result;
|
---|
109 |
|
---|
110 | if (!PyArg_ParseTuple(args, "OI|O", &py_hivekey, &hkey, &py_elements))
|
---|
111 | return NULL;
|
---|
112 |
|
---|
113 | if (!PyList_Check(py_elements) && py_elements != Py_None) {
|
---|
114 | PyErr_SetString(PyExc_TypeError, "Expected list of elements");
|
---|
115 | return NULL;
|
---|
116 | }
|
---|
117 |
|
---|
118 | if (py_elements == Py_None) {
|
---|
119 | elements = NULL;
|
---|
120 | } else {
|
---|
121 | int i;
|
---|
122 | elements = talloc_array(NULL, const char *, PyList_Size(py_elements));
|
---|
123 | for (i = 0; i < PyList_Size(py_elements); i++)
|
---|
124 | elements[i] = PyString_AsString(PyList_GetItem(py_elements, i));
|
---|
125 | }
|
---|
126 |
|
---|
127 | SMB_ASSERT(ctx != NULL);
|
---|
128 |
|
---|
129 | result = reg_mount_hive(ctx, PyHiveKey_AsHiveKey(py_hivekey), hkey, elements);
|
---|
130 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
131 |
|
---|
132 | Py_RETURN_NONE;
|
---|
133 | }
|
---|
134 |
|
---|
135 | static PyObject *registry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
---|
136 | {
|
---|
137 | WERROR result;
|
---|
138 | struct registry_context *ctx;
|
---|
139 | result = reg_open_local(NULL, &ctx);
|
---|
140 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
141 | return pytalloc_steal(&PyRegistry, ctx);
|
---|
142 | }
|
---|
143 |
|
---|
144 | static PyMethodDef registry_methods[] = {
|
---|
145 | { "get_predefined_key_by_name", py_get_predefined_key_by_name, METH_VARARGS,
|
---|
146 | "S.get_predefined_key_by_name(name) -> key\n"
|
---|
147 | "Find a predefined key by name" },
|
---|
148 | { "key_del_abs", py_key_del_abs, METH_VARARGS, "S.key_del_abs(name) -> None\n"
|
---|
149 | "Delete a key by absolute path." },
|
---|
150 | { "get_predefined_key", py_get_predefined_key, METH_VARARGS, "S.get_predefined_key(hkey_id) -> key\n"
|
---|
151 | "Find a predefined key by id" },
|
---|
152 | { "diff_apply", py_diff_apply, METH_VARARGS, "S.diff_apply(filename) -> None\n"
|
---|
153 | "Apply the diff from the specified file" },
|
---|
154 | { "mount_hive", py_mount_hive, METH_VARARGS, "S.mount_hive(key, key_id, elements=None) -> None\n"
|
---|
155 | "Mount the specified key at the specified path." },
|
---|
156 | { NULL }
|
---|
157 | };
|
---|
158 |
|
---|
159 | PyTypeObject PyRegistry = {
|
---|
160 | .tp_name = "Registry",
|
---|
161 | .tp_methods = registry_methods,
|
---|
162 | .tp_new = registry_new,
|
---|
163 | .tp_flags = Py_TPFLAGS_DEFAULT,
|
---|
164 | };
|
---|
165 |
|
---|
166 | static PyObject *py_hive_key_del(PyObject *self, PyObject *args)
|
---|
167 | {
|
---|
168 | char *name;
|
---|
169 | struct hive_key *key = PyHiveKey_AsHiveKey(self);
|
---|
170 | WERROR result;
|
---|
171 |
|
---|
172 | if (!PyArg_ParseTuple(args, "s", &name))
|
---|
173 | return NULL;
|
---|
174 |
|
---|
175 | result = hive_key_del(NULL, key, name);
|
---|
176 |
|
---|
177 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
178 |
|
---|
179 | Py_RETURN_NONE;
|
---|
180 | }
|
---|
181 |
|
---|
182 | static PyObject *py_hive_key_flush(PyObject *self)
|
---|
183 | {
|
---|
184 | WERROR result;
|
---|
185 | struct hive_key *key = PyHiveKey_AsHiveKey(self);
|
---|
186 |
|
---|
187 | result = hive_key_flush(key);
|
---|
188 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
189 |
|
---|
190 | Py_RETURN_NONE;
|
---|
191 | }
|
---|
192 |
|
---|
193 | static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args)
|
---|
194 | {
|
---|
195 | char *name;
|
---|
196 | WERROR result;
|
---|
197 | struct hive_key *key = PyHiveKey_AsHiveKey(self);
|
---|
198 |
|
---|
199 | if (!PyArg_ParseTuple(args, "s", &name))
|
---|
200 | return NULL;
|
---|
201 |
|
---|
202 | result = hive_key_del_value(NULL, key, name);
|
---|
203 |
|
---|
204 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
205 |
|
---|
206 | Py_RETURN_NONE;
|
---|
207 | }
|
---|
208 |
|
---|
209 | static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args)
|
---|
210 | {
|
---|
211 | char *name;
|
---|
212 | uint32_t type;
|
---|
213 | DATA_BLOB value;
|
---|
214 | Py_ssize_t value_length = 0;
|
---|
215 | WERROR result;
|
---|
216 | struct hive_key *key = PyHiveKey_AsHiveKey(self);
|
---|
217 |
|
---|
218 | if (!PyArg_ParseTuple(args, "siz#", &name, &type, &value.data, &value_length)) {
|
---|
219 | return NULL;
|
---|
220 | }
|
---|
221 | value.length = value_length;
|
---|
222 |
|
---|
223 | if (value.data != NULL)
|
---|
224 | result = hive_key_set_value(key, name, type, value);
|
---|
225 | else
|
---|
226 | result = hive_key_del_value(NULL, key, name);
|
---|
227 |
|
---|
228 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
229 |
|
---|
230 | Py_RETURN_NONE;
|
---|
231 | }
|
---|
232 |
|
---|
233 | static PyMethodDef hive_key_methods[] = {
|
---|
234 | { "del", py_hive_key_del, METH_VARARGS, "S.del(name) -> None\n"
|
---|
235 | "Delete a subkey" },
|
---|
236 | { "flush", (PyCFunction)py_hive_key_flush, METH_NOARGS, "S.flush() -> None\n"
|
---|
237 | "Flush this key to disk" },
|
---|
238 | { "del_value", py_hive_key_del_value, METH_VARARGS, "S.del_value(name) -> None\n"
|
---|
239 | "Delete a value" },
|
---|
240 | { "set_value", py_hive_key_set_value, METH_VARARGS, "S.set_value(name, type, data) -> None\n"
|
---|
241 | "Set a value" },
|
---|
242 | { NULL }
|
---|
243 | };
|
---|
244 |
|
---|
245 | static PyObject *hive_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) {
|
---|
246 | Py_RETURN_NONE;
|
---|
247 | }
|
---|
248 |
|
---|
249 | static PyObject *py_open_hive(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
---|
250 | {
|
---|
251 | const char *kwnames[] = { "location", "lp_ctx", "session_info", "credentials", NULL };
|
---|
252 | WERROR result;
|
---|
253 | struct loadparm_context *lp_ctx;
|
---|
254 | PyObject *py_lp_ctx, *py_session_info, *py_credentials;
|
---|
255 | struct auth_session_info *session_info;
|
---|
256 | struct cli_credentials *credentials;
|
---|
257 | char *location;
|
---|
258 | struct hive_key *hive_key;
|
---|
259 | TALLOC_CTX *mem_ctx;
|
---|
260 |
|
---|
261 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|OOO",
|
---|
262 | discard_const_p(char *, kwnames),
|
---|
263 | &location,
|
---|
264 | &py_lp_ctx, &py_session_info,
|
---|
265 | &py_credentials))
|
---|
266 | return NULL;
|
---|
267 |
|
---|
268 | mem_ctx = talloc_new(NULL);
|
---|
269 | if (mem_ctx == NULL) {
|
---|
270 | PyErr_NoMemory();
|
---|
271 | return NULL;
|
---|
272 | }
|
---|
273 |
|
---|
274 | lp_ctx = lpcfg_from_py_object(mem_ctx, py_lp_ctx);
|
---|
275 | if (lp_ctx == NULL) {
|
---|
276 | PyErr_SetString(PyExc_TypeError, "Expected loadparm context");
|
---|
277 | talloc_free(mem_ctx);
|
---|
278 | return NULL;
|
---|
279 | }
|
---|
280 |
|
---|
281 | credentials = cli_credentials_from_py_object(py_credentials);
|
---|
282 | if (credentials == NULL) {
|
---|
283 | PyErr_SetString(PyExc_TypeError, "Expected credentials");
|
---|
284 | talloc_free(mem_ctx);
|
---|
285 | return NULL;
|
---|
286 | }
|
---|
287 | session_info = NULL;
|
---|
288 |
|
---|
289 | result = reg_open_hive(NULL, location, session_info, credentials,
|
---|
290 | samba_tevent_context_init(NULL),
|
---|
291 | lp_ctx, &hive_key);
|
---|
292 | talloc_free(mem_ctx);
|
---|
293 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
294 |
|
---|
295 | return pytalloc_steal(&PyHiveKey, hive_key);
|
---|
296 | }
|
---|
297 |
|
---|
298 | PyTypeObject PyHiveKey = {
|
---|
299 | .tp_name = "HiveKey",
|
---|
300 | .tp_methods = hive_key_methods,
|
---|
301 | .tp_new = hive_new,
|
---|
302 | .tp_flags = Py_TPFLAGS_DEFAULT,
|
---|
303 | };
|
---|
304 |
|
---|
305 | PyTypeObject PyRegistryKey = {
|
---|
306 | .tp_name = "RegistryKey",
|
---|
307 | .tp_flags = Py_TPFLAGS_DEFAULT,
|
---|
308 | };
|
---|
309 |
|
---|
310 | static PyObject *py_open_samba(PyObject *self, PyObject *args, PyObject *kwargs)
|
---|
311 | {
|
---|
312 | const char *kwnames[] = { "lp_ctx", "session_info", NULL };
|
---|
313 | struct registry_context *reg_ctx;
|
---|
314 | WERROR result;
|
---|
315 | struct loadparm_context *lp_ctx;
|
---|
316 | PyObject *py_lp_ctx, *py_session_info, *py_credentials;
|
---|
317 | struct auth_session_info *session_info;
|
---|
318 | struct cli_credentials *credentials;
|
---|
319 | TALLOC_CTX *mem_ctx;
|
---|
320 |
|
---|
321 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO",
|
---|
322 | discard_const_p(char *, kwnames),
|
---|
323 | &py_lp_ctx, &py_session_info,
|
---|
324 | &py_credentials))
|
---|
325 | return NULL;
|
---|
326 |
|
---|
327 | mem_ctx = talloc_new(NULL);
|
---|
328 | if (mem_ctx == NULL) {
|
---|
329 | PyErr_NoMemory();
|
---|
330 | return NULL;
|
---|
331 | }
|
---|
332 |
|
---|
333 | lp_ctx = lpcfg_from_py_object(mem_ctx, py_lp_ctx);
|
---|
334 | if (lp_ctx == NULL) {
|
---|
335 | PyErr_SetString(PyExc_TypeError, "Expected loadparm context");
|
---|
336 | talloc_free(mem_ctx);
|
---|
337 | return NULL;
|
---|
338 | }
|
---|
339 |
|
---|
340 | credentials = cli_credentials_from_py_object(py_credentials);
|
---|
341 | if (credentials == NULL) {
|
---|
342 | PyErr_SetString(PyExc_TypeError, "Expected credentials");
|
---|
343 | talloc_free(mem_ctx);
|
---|
344 | return NULL;
|
---|
345 | }
|
---|
346 |
|
---|
347 | session_info = NULL; /* FIXME */
|
---|
348 |
|
---|
349 | result = reg_open_samba(NULL, ®_ctx, NULL,
|
---|
350 | lp_ctx, session_info, credentials);
|
---|
351 | talloc_free(mem_ctx);
|
---|
352 | if (!W_ERROR_IS_OK(result)) {
|
---|
353 | PyErr_SetWERROR(result);
|
---|
354 | return NULL;
|
---|
355 | }
|
---|
356 |
|
---|
357 | return pytalloc_steal(&PyRegistry, reg_ctx);
|
---|
358 | }
|
---|
359 |
|
---|
360 | static PyObject *py_open_ldb_file(PyObject *self, PyObject *args, PyObject *kwargs)
|
---|
361 | {
|
---|
362 | const char *kwnames[] = { "location", "session_info", "credentials", "lp_ctx", NULL };
|
---|
363 | PyObject *py_session_info = Py_None, *py_credentials = Py_None, *py_lp_ctx = Py_None;
|
---|
364 | WERROR result;
|
---|
365 | char *location;
|
---|
366 | struct loadparm_context *lp_ctx;
|
---|
367 | struct cli_credentials *credentials;
|
---|
368 | struct hive_key *key;
|
---|
369 | struct auth_session_info *session_info;
|
---|
370 | TALLOC_CTX *mem_ctx;
|
---|
371 |
|
---|
372 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|OOO",
|
---|
373 | discard_const_p(char *, kwnames),
|
---|
374 | &location, &py_session_info,
|
---|
375 | &py_credentials, &py_lp_ctx))
|
---|
376 | return NULL;
|
---|
377 |
|
---|
378 | mem_ctx = talloc_new(NULL);
|
---|
379 | if (mem_ctx == NULL) {
|
---|
380 | PyErr_NoMemory();
|
---|
381 | return NULL;
|
---|
382 | }
|
---|
383 |
|
---|
384 | lp_ctx = lpcfg_from_py_object(mem_ctx, py_lp_ctx);
|
---|
385 | if (lp_ctx == NULL) {
|
---|
386 | PyErr_SetString(PyExc_TypeError, "Expected loadparm context");
|
---|
387 | talloc_free(mem_ctx);
|
---|
388 | return NULL;
|
---|
389 | }
|
---|
390 |
|
---|
391 | credentials = cli_credentials_from_py_object(py_credentials);
|
---|
392 | if (credentials == NULL) {
|
---|
393 | PyErr_SetString(PyExc_TypeError, "Expected credentials");
|
---|
394 | talloc_free(mem_ctx);
|
---|
395 | return NULL;
|
---|
396 | }
|
---|
397 |
|
---|
398 | session_info = NULL; /* FIXME */
|
---|
399 |
|
---|
400 | result = reg_open_ldb_file(NULL, location, session_info, credentials,
|
---|
401 | s4_event_context_init(NULL), lp_ctx, &key);
|
---|
402 | talloc_free(mem_ctx);
|
---|
403 | PyErr_WERROR_NOT_OK_RAISE(result);
|
---|
404 |
|
---|
405 | return pytalloc_steal(&PyHiveKey, key);
|
---|
406 | }
|
---|
407 |
|
---|
408 | static PyObject *py_str_regtype(PyObject *self, PyObject *args)
|
---|
409 | {
|
---|
410 | int regtype;
|
---|
411 |
|
---|
412 | if (!PyArg_ParseTuple(args, "i", ®type))
|
---|
413 | return NULL;
|
---|
414 |
|
---|
415 | return PyString_FromString(str_regtype(regtype));
|
---|
416 | }
|
---|
417 |
|
---|
418 | static PyObject *py_get_predef_name(PyObject *self, PyObject *args)
|
---|
419 | {
|
---|
420 | uint32_t hkey;
|
---|
421 | const char *str;
|
---|
422 |
|
---|
423 | if (!PyArg_ParseTuple(args, "I", &hkey))
|
---|
424 | return NULL;
|
---|
425 |
|
---|
426 | str = reg_get_predef_name(hkey);
|
---|
427 | if (str == NULL)
|
---|
428 | Py_RETURN_NONE;
|
---|
429 | return PyString_FromString(str);
|
---|
430 | }
|
---|
431 |
|
---|
432 | static PyMethodDef py_registry_methods[] = {
|
---|
433 | { "open_samba", (PyCFunction)py_open_samba, METH_VARARGS|METH_KEYWORDS, "open_samba() -> reg" },
|
---|
434 | { "open_ldb", (PyCFunction)py_open_ldb_file, METH_VARARGS|METH_KEYWORDS, "open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key" },
|
---|
435 | { "open_hive", (PyCFunction)py_open_hive, METH_VARARGS|METH_KEYWORDS, "open_hive(location, session_info=None, credentials=None, loadparm_context=None) -> key" },
|
---|
436 | { "str_regtype", py_str_regtype, METH_VARARGS, "str_regtype(int) -> str" },
|
---|
437 | { "get_predef_name", py_get_predef_name, METH_VARARGS, "get_predef_name(hkey) -> str" },
|
---|
438 | { NULL }
|
---|
439 | };
|
---|
440 |
|
---|
441 | void initregistry(void)
|
---|
442 | {
|
---|
443 | PyObject *m;
|
---|
444 |
|
---|
445 | if (pytalloc_BaseObject_PyType_Ready(&PyHiveKey) < 0)
|
---|
446 | return;
|
---|
447 |
|
---|
448 | if (pytalloc_BaseObject_PyType_Ready(&PyRegistry) < 0)
|
---|
449 | return;
|
---|
450 |
|
---|
451 | if (pytalloc_BaseObject_PyType_Ready(&PyRegistryKey) < 0)
|
---|
452 | return;
|
---|
453 |
|
---|
454 | m = Py_InitModule3("registry", py_registry_methods, "Registry");
|
---|
455 | if (m == NULL)
|
---|
456 | return;
|
---|
457 |
|
---|
458 | PyModule_AddObject(m, "HKEY_CLASSES_ROOT", PyInt_FromLong(HKEY_CLASSES_ROOT));
|
---|
459 | PyModule_AddObject(m, "HKEY_CURRENT_USER", PyInt_FromLong(HKEY_CURRENT_USER));
|
---|
460 | PyModule_AddObject(m, "HKEY_LOCAL_MACHINE", PyInt_FromLong(HKEY_LOCAL_MACHINE));
|
---|
461 | PyModule_AddObject(m, "HKEY_USERS", PyInt_FromLong(HKEY_USERS));
|
---|
462 | PyModule_AddObject(m, "HKEY_PERFORMANCE_DATA", PyInt_FromLong(HKEY_PERFORMANCE_DATA));
|
---|
463 | PyModule_AddObject(m, "HKEY_CURRENT_CONFIG", PyInt_FromLong(HKEY_CURRENT_CONFIG));
|
---|
464 | PyModule_AddObject(m, "HKEY_DYN_DATA", PyInt_FromLong(HKEY_DYN_DATA));
|
---|
465 | PyModule_AddObject(m, "HKEY_PERFORMANCE_TEXT", PyInt_FromLong(HKEY_PERFORMANCE_TEXT));
|
---|
466 | PyModule_AddObject(m, "HKEY_PERFORMANCE_NLSTEXT", PyInt_FromLong(HKEY_PERFORMANCE_NLSTEXT));
|
---|
467 |
|
---|
468 | Py_INCREF(&PyRegistry);
|
---|
469 | PyModule_AddObject(m, "Registry", (PyObject *)&PyRegistry);
|
---|
470 |
|
---|
471 | Py_INCREF(&PyHiveKey);
|
---|
472 | PyModule_AddObject(m, "HiveKey", (PyObject *)&PyHiveKey);
|
---|
473 |
|
---|
474 | Py_INCREF(&PyRegistryKey);
|
---|
475 | PyModule_AddObject(m, "RegistryKey", (PyObject *)&PyRegistryKey);
|
---|
476 | }
|
---|