source: trunk/server/source3/librpc/gen_ndr/py_winreg.c@ 873

Last change on this file since 873 was 873, checked in by Silvan Scherrer, 11 years ago

samba server 3.6: change EOL style of a lot files. This hurts on every patch

File size: 107.1 KB
Line 
1
2/* Python wrapper functions auto-generated by pidl */
3#include <Python.h>
4#include "includes.h"
5#include <pytalloc.h>
6#include "librpc/rpc/pyrpc.h"
7#include "librpc/rpc/pyrpc_util.h"
8#include "librpc/gen_ndr/ndr_winreg.h"
9#include "librpc/gen_ndr/ndr_winreg_c.h"
10
11#include "librpc/gen_ndr/lsa.h"
12#include "librpc/gen_ndr/security.h"
13#include "librpc/gen_ndr/misc.h"
14staticforward PyTypeObject winreg_String_Type;
15staticforward PyTypeObject KeySecurityData_Type;
16staticforward PyTypeObject winreg_SecBuf_Type;
17staticforward PyTypeObject winreg_StringBuf_Type;
18staticforward PyTypeObject winreg_ValNameBuf_Type;
19staticforward PyTypeObject KeySecurityAttribute_Type;
20staticforward PyTypeObject QueryMultipleValue_Type;
21staticforward PyTypeObject winreg_InterfaceType;
22
23void initwinreg(void);static PyTypeObject *lsa_StringLarge_Type;
24static PyTypeObject *policy_handle_Type;
25static PyTypeObject *Object_Type;
26static PyTypeObject *ClientConnection_Type;
27
28static PyObject *py_winreg_String_get_name_len(PyObject *obj, void *closure)
29{
30 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(obj);
31 PyObject *py_name_len;
32 py_name_len = PyInt_FromLong(object->name_len);
33 return py_name_len;
34}
35
36static int py_winreg_String_set_name_len(PyObject *py_obj, PyObject *value, void *closure)
37{
38 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(py_obj);
39 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
40 object->name_len = PyInt_AsLong(value);
41 return 0;
42}
43
44static PyObject *py_winreg_String_get_name_size(PyObject *obj, void *closure)
45{
46 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(obj);
47 PyObject *py_name_size;
48 py_name_size = PyInt_FromLong(object->name_size);
49 return py_name_size;
50}
51
52static int py_winreg_String_set_name_size(PyObject *py_obj, PyObject *value, void *closure)
53{
54 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(py_obj);
55 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
56 object->name_size = PyInt_AsLong(value);
57 return 0;
58}
59
60static PyObject *py_winreg_String_get_name(PyObject *obj, void *closure)
61{
62 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(obj);
63 PyObject *py_name;
64 if (object->name == NULL) {
65 py_name = Py_None;
66 Py_INCREF(py_name);
67 } else {
68 if (object->name == NULL) {
69 py_name = Py_None;
70 Py_INCREF(py_name);
71 } else {
72 py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
73 }
74 }
75 return py_name;
76}
77
78static int py_winreg_String_set_name(PyObject *py_obj, PyObject *value, void *closure)
79{
80 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(py_obj);
81 if (value == Py_None) {
82 object->name = NULL;
83 } else {
84 object->name = NULL;
85 if (PyUnicode_Check(value)) {
86 object->name = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
87 } else if (PyString_Check(value)) {
88 object->name = PyString_AS_STRING(value);
89 } else {
90 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
91 return -1;
92 }
93 }
94 return 0;
95}
96
97static PyGetSetDef py_winreg_String_getsetters[] = {
98 { discard_const_p(char, "name_len"), py_winreg_String_get_name_len, py_winreg_String_set_name_len },
99 { discard_const_p(char, "name_size"), py_winreg_String_get_name_size, py_winreg_String_set_name_size },
100 { discard_const_p(char, "name"), py_winreg_String_get_name, py_winreg_String_set_name },
101 { NULL }
102};
103
104static PyObject *py_winreg_String_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
105{
106 return py_talloc_new(struct winreg_String, type);
107}
108
109static PyObject *py_winreg_String_ndr_pack(PyObject *py_obj)
110{
111 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(py_obj);
112 DATA_BLOB blob;
113 enum ndr_err_code err;
114 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_winreg_String);
115 if (err != NDR_ERR_SUCCESS) {
116 PyErr_SetNdrError(err);
117 return NULL;
118 }
119
120 return PyString_FromStringAndSize((char *)blob.data, blob.length);
121}
122
123static PyObject *py_winreg_String_ndr_unpack(PyObject *py_obj, PyObject *args)
124{
125 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(py_obj);
126 DATA_BLOB blob;
127 enum ndr_err_code err;
128 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
129 return NULL;
130
131 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_winreg_String);
132 if (err != NDR_ERR_SUCCESS) {
133 PyErr_SetNdrError(err);
134 return NULL;
135 }
136
137 Py_RETURN_NONE;
138}
139
140static PyObject *py_winreg_String_ndr_print(PyObject *py_obj)
141{
142 struct winreg_String *object = (struct winreg_String *)py_talloc_get_ptr(py_obj);
143 PyObject *ret;
144 char *retstr;
145
146 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_winreg_String, "winreg_String", object);
147 ret = PyString_FromString(retstr);
148 talloc_free(retstr);
149
150 return ret;
151}
152
153static PyMethodDef py_winreg_String_methods[] = {
154 { "__ndr_pack__", (PyCFunction)py_winreg_String_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
155 { "__ndr_unpack__", (PyCFunction)py_winreg_String_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
156 { "__ndr_print__", (PyCFunction)py_winreg_String_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
157 { NULL, NULL, 0, NULL }
158};
159
160
161static PyTypeObject winreg_String_Type = {
162 PyObject_HEAD_INIT(NULL) 0,
163 .tp_name = "winreg.String",
164 .tp_getset = py_winreg_String_getsetters,
165 .tp_methods = py_winreg_String_methods,
166 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
167 .tp_basicsize = sizeof(py_talloc_Object),
168 .tp_new = py_winreg_String_new,
169};
170
171
172static PyObject *py_KeySecurityData_get_data(PyObject *obj, void *closure)
173{
174 struct KeySecurityData *object = (struct KeySecurityData *)py_talloc_get_ptr(obj);
175 PyObject *py_data;
176 if (object->data == NULL) {
177 py_data = Py_None;
178 Py_INCREF(py_data);
179 } else {
180 py_data = PyList_New(object->len);
181 if (py_data == NULL) {
182 return NULL;
183 }
184 {
185 int data_cntr_1;
186 for (data_cntr_1 = 0; data_cntr_1 < object->len; data_cntr_1++) {
187 PyObject *py_data_1;
188 py_data_1 = PyInt_FromLong(object->data[data_cntr_1]);
189 PyList_SetItem(py_data, data_cntr_1, py_data_1);
190 }
191 }
192 }
193 return py_data;
194}
195
196static int py_KeySecurityData_set_data(PyObject *py_obj, PyObject *value, void *closure)
197{
198 struct KeySecurityData *object = (struct KeySecurityData *)py_talloc_get_ptr(py_obj);
199 talloc_unlink(py_talloc_get_mem_ctx(py_obj), object->data);
200 if (value == Py_None) {
201 object->data = NULL;
202 } else {
203 object->data = NULL;
204 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
205 {
206 int data_cntr_1;
207 object->data = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
208 if (!object->data) { return -1;; }
209 talloc_set_name_const(object->data, "ARRAY: object->data");
210 for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
211 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, data_cntr_1), return -1;);
212 object->data[data_cntr_1] = PyInt_AsLong(PyList_GET_ITEM(value, data_cntr_1));
213 }
214 }
215 }
216 return 0;
217}
218
219static PyObject *py_KeySecurityData_get_size(PyObject *obj, void *closure)
220{
221 struct KeySecurityData *object = (struct KeySecurityData *)py_talloc_get_ptr(obj);
222 PyObject *py_size;
223 py_size = PyInt_FromLong(object->size);
224 return py_size;
225}
226
227static int py_KeySecurityData_set_size(PyObject *py_obj, PyObject *value, void *closure)
228{
229 struct KeySecurityData *object = (struct KeySecurityData *)py_talloc_get_ptr(py_obj);
230 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
231 object->size = PyInt_AsLong(value);
232 return 0;
233}
234
235static PyObject *py_KeySecurityData_get_len(PyObject *obj, void *closure)
236{
237 struct KeySecurityData *object = (struct KeySecurityData *)py_talloc_get_ptr(obj);
238 PyObject *py_len;
239 py_len = PyInt_FromLong(object->len);
240 return py_len;
241}
242
243static int py_KeySecurityData_set_len(PyObject *py_obj, PyObject *value, void *closure)
244{
245 struct KeySecurityData *object = (struct KeySecurityData *)py_talloc_get_ptr(py_obj);
246 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
247 object->len = PyInt_AsLong(value);
248 return 0;
249}
250
251static PyGetSetDef py_KeySecurityData_getsetters[] = {
252 { discard_const_p(char, "data"), py_KeySecurityData_get_data, py_KeySecurityData_set_data },
253 { discard_const_p(char, "size"), py_KeySecurityData_get_size, py_KeySecurityData_set_size },
254 { discard_const_p(char, "len"), py_KeySecurityData_get_len, py_KeySecurityData_set_len },
255 { NULL }
256};
257
258static PyObject *py_KeySecurityData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
259{
260 return py_talloc_new(struct KeySecurityData, type);
261}
262
263
264static PyTypeObject KeySecurityData_Type = {
265 PyObject_HEAD_INIT(NULL) 0,
266 .tp_name = "winreg.KeySecurityData",
267 .tp_getset = py_KeySecurityData_getsetters,
268 .tp_methods = NULL,
269 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
270 .tp_basicsize = sizeof(py_talloc_Object),
271 .tp_new = py_KeySecurityData_new,
272};
273
274
275static PyObject *py_winreg_SecBuf_get_length(PyObject *obj, void *closure)
276{
277 struct winreg_SecBuf *object = (struct winreg_SecBuf *)py_talloc_get_ptr(obj);
278 PyObject *py_length;
279 py_length = PyInt_FromLong(object->length);
280 return py_length;
281}
282
283static int py_winreg_SecBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
284{
285 struct winreg_SecBuf *object = (struct winreg_SecBuf *)py_talloc_get_ptr(py_obj);
286 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
287 object->length = PyInt_AsLong(value);
288 return 0;
289}
290
291static PyObject *py_winreg_SecBuf_get_sd(PyObject *obj, void *closure)
292{
293 struct winreg_SecBuf *object = (struct winreg_SecBuf *)py_talloc_get_ptr(obj);
294 PyObject *py_sd;
295 py_sd = py_talloc_reference_ex(&KeySecurityData_Type, py_talloc_get_mem_ctx(obj), &object->sd);
296 return py_sd;
297}
298
299static int py_winreg_SecBuf_set_sd(PyObject *py_obj, PyObject *value, void *closure)
300{
301 struct winreg_SecBuf *object = (struct winreg_SecBuf *)py_talloc_get_ptr(py_obj);
302 PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
303 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
304 PyErr_NoMemory();
305 return -1;
306 }
307 object->sd = *(struct KeySecurityData *)py_talloc_get_ptr(value);
308 return 0;
309}
310
311static PyObject *py_winreg_SecBuf_get_inherit(PyObject *obj, void *closure)
312{
313 struct winreg_SecBuf *object = (struct winreg_SecBuf *)py_talloc_get_ptr(obj);
314 PyObject *py_inherit;
315 py_inherit = PyInt_FromLong(object->inherit);
316 return py_inherit;
317}
318
319static int py_winreg_SecBuf_set_inherit(PyObject *py_obj, PyObject *value, void *closure)
320{
321 struct winreg_SecBuf *object = (struct winreg_SecBuf *)py_talloc_get_ptr(py_obj);
322 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
323 object->inherit = PyInt_AsLong(value);
324 return 0;
325}
326
327static PyGetSetDef py_winreg_SecBuf_getsetters[] = {
328 { discard_const_p(char, "length"), py_winreg_SecBuf_get_length, py_winreg_SecBuf_set_length },
329 { discard_const_p(char, "sd"), py_winreg_SecBuf_get_sd, py_winreg_SecBuf_set_sd },
330 { discard_const_p(char, "inherit"), py_winreg_SecBuf_get_inherit, py_winreg_SecBuf_set_inherit },
331 { NULL }
332};
333
334static PyObject *py_winreg_SecBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
335{
336 return py_talloc_new(struct winreg_SecBuf, type);
337}
338
339
340static PyTypeObject winreg_SecBuf_Type = {
341 PyObject_HEAD_INIT(NULL) 0,
342 .tp_name = "winreg.SecBuf",
343 .tp_getset = py_winreg_SecBuf_getsetters,
344 .tp_methods = NULL,
345 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
346 .tp_basicsize = sizeof(py_talloc_Object),
347 .tp_new = py_winreg_SecBuf_new,
348};
349
350
351static PyObject *py_winreg_StringBuf_get_length(PyObject *obj, void *closure)
352{
353 struct winreg_StringBuf *object = (struct winreg_StringBuf *)py_talloc_get_ptr(obj);
354 PyObject *py_length;
355 py_length = PyInt_FromLong(object->length);
356 return py_length;
357}
358
359static int py_winreg_StringBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
360{
361 struct winreg_StringBuf *object = (struct winreg_StringBuf *)py_talloc_get_ptr(py_obj);
362 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
363 object->length = PyInt_AsLong(value);
364 return 0;
365}
366
367static PyObject *py_winreg_StringBuf_get_size(PyObject *obj, void *closure)
368{
369 struct winreg_StringBuf *object = (struct winreg_StringBuf *)py_talloc_get_ptr(obj);
370 PyObject *py_size;
371 py_size = PyInt_FromLong(object->size);
372 return py_size;
373}
374
375static int py_winreg_StringBuf_set_size(PyObject *py_obj, PyObject *value, void *closure)
376{
377 struct winreg_StringBuf *object = (struct winreg_StringBuf *)py_talloc_get_ptr(py_obj);
378 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
379 object->size = PyInt_AsLong(value);
380 return 0;
381}
382
383static PyObject *py_winreg_StringBuf_get_name(PyObject *obj, void *closure)
384{
385 struct winreg_StringBuf *object = (struct winreg_StringBuf *)py_talloc_get_ptr(obj);
386 PyObject *py_name;
387 if (object->name == NULL) {
388 py_name = Py_None;
389 Py_INCREF(py_name);
390 } else {
391 if (object->name == NULL) {
392 py_name = Py_None;
393 Py_INCREF(py_name);
394 } else {
395 py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
396 }
397 }
398 return py_name;
399}
400
401static int py_winreg_StringBuf_set_name(PyObject *py_obj, PyObject *value, void *closure)
402{
403 struct winreg_StringBuf *object = (struct winreg_StringBuf *)py_talloc_get_ptr(py_obj);
404 if (value == Py_None) {
405 object->name = NULL;
406 } else {
407 object->name = NULL;
408 if (PyUnicode_Check(value)) {
409 object->name = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
410 } else if (PyString_Check(value)) {
411 object->name = PyString_AS_STRING(value);
412 } else {
413 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
414 return -1;
415 }
416 }
417 return 0;
418}
419
420static PyGetSetDef py_winreg_StringBuf_getsetters[] = {
421 { discard_const_p(char, "length"), py_winreg_StringBuf_get_length, py_winreg_StringBuf_set_length },
422 { discard_const_p(char, "size"), py_winreg_StringBuf_get_size, py_winreg_StringBuf_set_size },
423 { discard_const_p(char, "name"), py_winreg_StringBuf_get_name, py_winreg_StringBuf_set_name },
424 { NULL }
425};
426
427static PyObject *py_winreg_StringBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
428{
429 return py_talloc_new(struct winreg_StringBuf, type);
430}
431
432
433static PyTypeObject winreg_StringBuf_Type = {
434 PyObject_HEAD_INIT(NULL) 0,
435 .tp_name = "winreg.StringBuf",
436 .tp_getset = py_winreg_StringBuf_getsetters,
437 .tp_methods = NULL,
438 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
439 .tp_basicsize = sizeof(py_talloc_Object),
440 .tp_new = py_winreg_StringBuf_new,
441};
442
443
444static PyObject *py_winreg_ValNameBuf_get_length(PyObject *obj, void *closure)
445{
446 struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)py_talloc_get_ptr(obj);
447 PyObject *py_length;
448 py_length = PyInt_FromLong(object->length);
449 return py_length;
450}
451
452static int py_winreg_ValNameBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
453{
454 struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)py_talloc_get_ptr(py_obj);
455 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
456 object->length = PyInt_AsLong(value);
457 return 0;
458}
459
460static PyObject *py_winreg_ValNameBuf_get_size(PyObject *obj, void *closure)
461{
462 struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)py_talloc_get_ptr(obj);
463 PyObject *py_size;
464 py_size = PyInt_FromLong(object->size);
465 return py_size;
466}
467
468static int py_winreg_ValNameBuf_set_size(PyObject *py_obj, PyObject *value, void *closure)
469{
470 struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)py_talloc_get_ptr(py_obj);
471 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
472 object->size = PyInt_AsLong(value);
473 return 0;
474}
475
476static PyObject *py_winreg_ValNameBuf_get_name(PyObject *obj, void *closure)
477{
478 struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)py_talloc_get_ptr(obj);
479 PyObject *py_name;
480 if (object->name == NULL) {
481 py_name = Py_None;
482 Py_INCREF(py_name);
483 } else {
484 if (object->name == NULL) {
485 py_name = Py_None;
486 Py_INCREF(py_name);
487 } else {
488 py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
489 }
490 }
491 return py_name;
492}
493
494static int py_winreg_ValNameBuf_set_name(PyObject *py_obj, PyObject *value, void *closure)
495{
496 struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)py_talloc_get_ptr(py_obj);
497 if (value == Py_None) {
498 object->name = NULL;
499 } else {
500 object->name = NULL;
501 if (PyUnicode_Check(value)) {
502 object->name = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
503 } else if (PyString_Check(value)) {
504 object->name = PyString_AS_STRING(value);
505 } else {
506 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
507 return -1;
508 }
509 }
510 return 0;
511}
512
513static PyGetSetDef py_winreg_ValNameBuf_getsetters[] = {
514 { discard_const_p(char, "length"), py_winreg_ValNameBuf_get_length, py_winreg_ValNameBuf_set_length },
515 { discard_const_p(char, "size"), py_winreg_ValNameBuf_get_size, py_winreg_ValNameBuf_set_size },
516 { discard_const_p(char, "name"), py_winreg_ValNameBuf_get_name, py_winreg_ValNameBuf_set_name },
517 { NULL }
518};
519
520static PyObject *py_winreg_ValNameBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
521{
522 return py_talloc_new(struct winreg_ValNameBuf, type);
523}
524
525
526static PyTypeObject winreg_ValNameBuf_Type = {
527 PyObject_HEAD_INIT(NULL) 0,
528 .tp_name = "winreg.ValNameBuf",
529 .tp_getset = py_winreg_ValNameBuf_getsetters,
530 .tp_methods = NULL,
531 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
532 .tp_basicsize = sizeof(py_talloc_Object),
533 .tp_new = py_winreg_ValNameBuf_new,
534};
535
536
537static PyObject *py_KeySecurityAttribute_get_data_size(PyObject *obj, void *closure)
538{
539 struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)py_talloc_get_ptr(obj);
540 PyObject *py_data_size;
541 py_data_size = PyInt_FromLong(object->data_size);
542 return py_data_size;
543}
544
545static int py_KeySecurityAttribute_set_data_size(PyObject *py_obj, PyObject *value, void *closure)
546{
547 struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)py_talloc_get_ptr(py_obj);
548 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
549 object->data_size = PyInt_AsLong(value);
550 return 0;
551}
552
553static PyObject *py_KeySecurityAttribute_get_sec_data(PyObject *obj, void *closure)
554{
555 struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)py_talloc_get_ptr(obj);
556 PyObject *py_sec_data;
557 py_sec_data = py_talloc_reference_ex(&KeySecurityData_Type, py_talloc_get_mem_ctx(obj), &object->sec_data);
558 return py_sec_data;
559}
560
561static int py_KeySecurityAttribute_set_sec_data(PyObject *py_obj, PyObject *value, void *closure)
562{
563 struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)py_talloc_get_ptr(py_obj);
564 PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
565 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
566 PyErr_NoMemory();
567 return -1;
568 }
569 object->sec_data = *(struct KeySecurityData *)py_talloc_get_ptr(value);
570 return 0;
571}
572
573static PyObject *py_KeySecurityAttribute_get_inherit(PyObject *obj, void *closure)
574{
575 struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)py_talloc_get_ptr(obj);
576 PyObject *py_inherit;
577 py_inherit = PyInt_FromLong(object->inherit);
578 return py_inherit;
579}
580
581static int py_KeySecurityAttribute_set_inherit(PyObject *py_obj, PyObject *value, void *closure)
582{
583 struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)py_talloc_get_ptr(py_obj);
584 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
585 object->inherit = PyInt_AsLong(value);
586 return 0;
587}
588
589static PyGetSetDef py_KeySecurityAttribute_getsetters[] = {
590 { discard_const_p(char, "data_size"), py_KeySecurityAttribute_get_data_size, py_KeySecurityAttribute_set_data_size },
591 { discard_const_p(char, "sec_data"), py_KeySecurityAttribute_get_sec_data, py_KeySecurityAttribute_set_sec_data },
592 { discard_const_p(char, "inherit"), py_KeySecurityAttribute_get_inherit, py_KeySecurityAttribute_set_inherit },
593 { NULL }
594};
595
596static PyObject *py_KeySecurityAttribute_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
597{
598 return py_talloc_new(struct KeySecurityAttribute, type);
599}
600
601
602static PyTypeObject KeySecurityAttribute_Type = {
603 PyObject_HEAD_INIT(NULL) 0,
604 .tp_name = "winreg.KeySecurityAttribute",
605 .tp_getset = py_KeySecurityAttribute_getsetters,
606 .tp_methods = NULL,
607 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
608 .tp_basicsize = sizeof(py_talloc_Object),
609 .tp_new = py_KeySecurityAttribute_new,
610};
611
612
613static PyObject *py_QueryMultipleValue_get_ve_valuename(PyObject *obj, void *closure)
614{
615 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(obj);
616 PyObject *py_ve_valuename;
617 if (object->ve_valuename == NULL) {
618 py_ve_valuename = Py_None;
619 Py_INCREF(py_ve_valuename);
620 } else {
621 py_ve_valuename = py_talloc_reference_ex(&winreg_ValNameBuf_Type, object->ve_valuename, object->ve_valuename);
622 }
623 return py_ve_valuename;
624}
625
626static int py_QueryMultipleValue_set_ve_valuename(PyObject *py_obj, PyObject *value, void *closure)
627{
628 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(py_obj);
629 talloc_unlink(py_talloc_get_mem_ctx(py_obj), object->ve_valuename);
630 if (value == Py_None) {
631 object->ve_valuename = NULL;
632 } else {
633 object->ve_valuename = NULL;
634 PY_CHECK_TYPE(&winreg_ValNameBuf_Type, value, return -1;);
635 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
636 PyErr_NoMemory();
637 return -1;
638 }
639 object->ve_valuename = (struct winreg_ValNameBuf *)py_talloc_get_ptr(value);
640 }
641 return 0;
642}
643
644static PyObject *py_QueryMultipleValue_get_ve_valuelen(PyObject *obj, void *closure)
645{
646 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(obj);
647 PyObject *py_ve_valuelen;
648 py_ve_valuelen = PyInt_FromLong(object->ve_valuelen);
649 return py_ve_valuelen;
650}
651
652static int py_QueryMultipleValue_set_ve_valuelen(PyObject *py_obj, PyObject *value, void *closure)
653{
654 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(py_obj);
655 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
656 object->ve_valuelen = PyInt_AsLong(value);
657 return 0;
658}
659
660static PyObject *py_QueryMultipleValue_get_ve_valueptr(PyObject *obj, void *closure)
661{
662 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(obj);
663 PyObject *py_ve_valueptr;
664 py_ve_valueptr = PyInt_FromLong(object->ve_valueptr);
665 return py_ve_valueptr;
666}
667
668static int py_QueryMultipleValue_set_ve_valueptr(PyObject *py_obj, PyObject *value, void *closure)
669{
670 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(py_obj);
671 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
672 object->ve_valueptr = PyInt_AsLong(value);
673 return 0;
674}
675
676static PyObject *py_QueryMultipleValue_get_ve_type(PyObject *obj, void *closure)
677{
678 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(obj);
679 PyObject *py_ve_type;
680 py_ve_type = PyInt_FromLong(object->ve_type);
681 return py_ve_type;
682}
683
684static int py_QueryMultipleValue_set_ve_type(PyObject *py_obj, PyObject *value, void *closure)
685{
686 struct QueryMultipleValue *object = (struct QueryMultipleValue *)py_talloc_get_ptr(py_obj);
687 if (PyLong_Check(value)) {
688 object->ve_type = PyLong_AsLongLong(value);
689 } else if (PyInt_Check(value)) {
690 object->ve_type = PyInt_AsLong(value);
691 } else {
692 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
693 PyInt_Type.tp_name, PyLong_Type.tp_name);
694 return -1;
695 }
696 return 0;
697}
698
699static PyGetSetDef py_QueryMultipleValue_getsetters[] = {
700 { discard_const_p(char, "ve_valuename"), py_QueryMultipleValue_get_ve_valuename, py_QueryMultipleValue_set_ve_valuename },
701 { discard_const_p(char, "ve_valuelen"), py_QueryMultipleValue_get_ve_valuelen, py_QueryMultipleValue_set_ve_valuelen },
702 { discard_const_p(char, "ve_valueptr"), py_QueryMultipleValue_get_ve_valueptr, py_QueryMultipleValue_set_ve_valueptr },
703 { discard_const_p(char, "ve_type"), py_QueryMultipleValue_get_ve_type, py_QueryMultipleValue_set_ve_type },
704 { NULL }
705};
706
707static PyObject *py_QueryMultipleValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
708{
709 return py_talloc_new(struct QueryMultipleValue, type);
710}
711
712
713static PyTypeObject QueryMultipleValue_Type = {
714 PyObject_HEAD_INIT(NULL) 0,
715 .tp_name = "winreg.QueryMultipleValue",
716 .tp_getset = py_QueryMultipleValue_getsetters,
717 .tp_methods = NULL,
718 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
719 .tp_basicsize = sizeof(py_talloc_Object),
720 .tp_new = py_QueryMultipleValue_new,
721};
722
723
724static bool pack_py_winreg_OpenHKCR_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCR *r)
725{
726 PyObject *py_system_name;
727 PyObject *py_access_mask;
728 const char *kwnames[] = {
729 "system_name", "access_mask", NULL
730 };
731
732 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCR", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
733 return false;
734 }
735
736 if (py_system_name == Py_None) {
737 r->in.system_name = NULL;
738 } else {
739 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
740 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
741 *r->in.system_name = PyInt_AsLong(py_system_name);
742 }
743 if (PyLong_Check(py_access_mask)) {
744 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
745 } else if (PyInt_Check(py_access_mask)) {
746 r->in.access_mask = PyInt_AsLong(py_access_mask);
747 } else {
748 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
749 PyInt_Type.tp_name, PyLong_Type.tp_name);
750 return false;
751 }
752 return true;
753}
754
755static PyObject *unpack_py_winreg_OpenHKCR_args_out(struct winreg_OpenHKCR *r)
756{
757 PyObject *result;
758 PyObject *py_handle;
759 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
760 result = py_handle;
761 if (!W_ERROR_IS_OK(r->out.result)) {
762 PyErr_SetWERROR(r->out.result);
763 return NULL;
764 }
765
766 return result;
767}
768
769static bool pack_py_winreg_OpenHKCU_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCU *r)
770{
771 PyObject *py_system_name;
772 PyObject *py_access_mask;
773 const char *kwnames[] = {
774 "system_name", "access_mask", NULL
775 };
776
777 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCU", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
778 return false;
779 }
780
781 if (py_system_name == Py_None) {
782 r->in.system_name = NULL;
783 } else {
784 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
785 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
786 *r->in.system_name = PyInt_AsLong(py_system_name);
787 }
788 if (PyLong_Check(py_access_mask)) {
789 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
790 } else if (PyInt_Check(py_access_mask)) {
791 r->in.access_mask = PyInt_AsLong(py_access_mask);
792 } else {
793 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
794 PyInt_Type.tp_name, PyLong_Type.tp_name);
795 return false;
796 }
797 return true;
798}
799
800static PyObject *unpack_py_winreg_OpenHKCU_args_out(struct winreg_OpenHKCU *r)
801{
802 PyObject *result;
803 PyObject *py_handle;
804 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
805 result = py_handle;
806 if (!W_ERROR_IS_OK(r->out.result)) {
807 PyErr_SetWERROR(r->out.result);
808 return NULL;
809 }
810
811 return result;
812}
813
814static bool pack_py_winreg_OpenHKLM_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKLM *r)
815{
816 PyObject *py_system_name;
817 PyObject *py_access_mask;
818 const char *kwnames[] = {
819 "system_name", "access_mask", NULL
820 };
821
822 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKLM", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
823 return false;
824 }
825
826 if (py_system_name == Py_None) {
827 r->in.system_name = NULL;
828 } else {
829 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
830 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
831 *r->in.system_name = PyInt_AsLong(py_system_name);
832 }
833 if (PyLong_Check(py_access_mask)) {
834 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
835 } else if (PyInt_Check(py_access_mask)) {
836 r->in.access_mask = PyInt_AsLong(py_access_mask);
837 } else {
838 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
839 PyInt_Type.tp_name, PyLong_Type.tp_name);
840 return false;
841 }
842 return true;
843}
844
845static PyObject *unpack_py_winreg_OpenHKLM_args_out(struct winreg_OpenHKLM *r)
846{
847 PyObject *result;
848 PyObject *py_handle;
849 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
850 result = py_handle;
851 if (!W_ERROR_IS_OK(r->out.result)) {
852 PyErr_SetWERROR(r->out.result);
853 return NULL;
854 }
855
856 return result;
857}
858
859static bool pack_py_winreg_OpenHKPD_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPD *r)
860{
861 PyObject *py_system_name;
862 PyObject *py_access_mask;
863 const char *kwnames[] = {
864 "system_name", "access_mask", NULL
865 };
866
867 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPD", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
868 return false;
869 }
870
871 if (py_system_name == Py_None) {
872 r->in.system_name = NULL;
873 } else {
874 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
875 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
876 *r->in.system_name = PyInt_AsLong(py_system_name);
877 }
878 if (PyLong_Check(py_access_mask)) {
879 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
880 } else if (PyInt_Check(py_access_mask)) {
881 r->in.access_mask = PyInt_AsLong(py_access_mask);
882 } else {
883 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
884 PyInt_Type.tp_name, PyLong_Type.tp_name);
885 return false;
886 }
887 return true;
888}
889
890static PyObject *unpack_py_winreg_OpenHKPD_args_out(struct winreg_OpenHKPD *r)
891{
892 PyObject *result;
893 PyObject *py_handle;
894 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
895 result = py_handle;
896 if (!W_ERROR_IS_OK(r->out.result)) {
897 PyErr_SetWERROR(r->out.result);
898 return NULL;
899 }
900
901 return result;
902}
903
904static bool pack_py_winreg_OpenHKU_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKU *r)
905{
906 PyObject *py_system_name;
907 PyObject *py_access_mask;
908 const char *kwnames[] = {
909 "system_name", "access_mask", NULL
910 };
911
912 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKU", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
913 return false;
914 }
915
916 if (py_system_name == Py_None) {
917 r->in.system_name = NULL;
918 } else {
919 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
920 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
921 *r->in.system_name = PyInt_AsLong(py_system_name);
922 }
923 if (PyLong_Check(py_access_mask)) {
924 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
925 } else if (PyInt_Check(py_access_mask)) {
926 r->in.access_mask = PyInt_AsLong(py_access_mask);
927 } else {
928 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
929 PyInt_Type.tp_name, PyLong_Type.tp_name);
930 return false;
931 }
932 return true;
933}
934
935static PyObject *unpack_py_winreg_OpenHKU_args_out(struct winreg_OpenHKU *r)
936{
937 PyObject *result;
938 PyObject *py_handle;
939 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
940 result = py_handle;
941 if (!W_ERROR_IS_OK(r->out.result)) {
942 PyErr_SetWERROR(r->out.result);
943 return NULL;
944 }
945
946 return result;
947}
948
949static bool pack_py_winreg_CloseKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_CloseKey *r)
950{
951 PyObject *py_handle;
952 const char *kwnames[] = {
953 "handle", NULL
954 };
955
956 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_CloseKey", discard_const_p(char *, kwnames), &py_handle)) {
957 return false;
958 }
959
960 r->in.handle = talloc_ptrtype(r, r->in.handle);
961 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
962 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
963 PyErr_NoMemory();
964 return false;
965 }
966 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
967 return true;
968}
969
970static PyObject *unpack_py_winreg_CloseKey_args_out(struct winreg_CloseKey *r)
971{
972 PyObject *result;
973 PyObject *py_handle;
974 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
975 result = py_handle;
976 if (!W_ERROR_IS_OK(r->out.result)) {
977 PyErr_SetWERROR(r->out.result);
978 return NULL;
979 }
980
981 return result;
982}
983
984static bool pack_py_winreg_CreateKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_CreateKey *r)
985{
986 PyObject *py_handle;
987 PyObject *py_name;
988 PyObject *py_keyclass;
989 PyObject *py_options;
990 PyObject *py_access_mask;
991 PyObject *py_secdesc;
992 PyObject *py_action_taken;
993 const char *kwnames[] = {
994 "handle", "name", "keyclass", "options", "access_mask", "secdesc", "action_taken", NULL
995 };
996
997 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOO:winreg_CreateKey", discard_const_p(char *, kwnames), &py_handle, &py_name, &py_keyclass, &py_options, &py_access_mask, &py_secdesc, &py_action_taken)) {
998 return false;
999 }
1000
1001 r->in.handle = talloc_ptrtype(r, r->in.handle);
1002 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1003 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1004 PyErr_NoMemory();
1005 return false;
1006 }
1007 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1008 PY_CHECK_TYPE(&winreg_String_Type, py_name, return false;);
1009 if (talloc_reference(r, py_talloc_get_mem_ctx(py_name)) == NULL) {
1010 PyErr_NoMemory();
1011 return false;
1012 }
1013 r->in.name = *(struct winreg_String *)py_talloc_get_ptr(py_name);
1014 PY_CHECK_TYPE(&winreg_String_Type, py_keyclass, return false;);
1015 if (talloc_reference(r, py_talloc_get_mem_ctx(py_keyclass)) == NULL) {
1016 PyErr_NoMemory();
1017 return false;
1018 }
1019 r->in.keyclass = *(struct winreg_String *)py_talloc_get_ptr(py_keyclass);
1020 if (PyLong_Check(py_options)) {
1021 r->in.options = PyLong_AsLongLong(py_options);
1022 } else if (PyInt_Check(py_options)) {
1023 r->in.options = PyInt_AsLong(py_options);
1024 } else {
1025 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1026 PyInt_Type.tp_name, PyLong_Type.tp_name);
1027 return false;
1028 }
1029 if (PyLong_Check(py_access_mask)) {
1030 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
1031 } else if (PyInt_Check(py_access_mask)) {
1032 r->in.access_mask = PyInt_AsLong(py_access_mask);
1033 } else {
1034 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1035 PyInt_Type.tp_name, PyLong_Type.tp_name);
1036 return false;
1037 }
1038 if (py_secdesc == Py_None) {
1039 r->in.secdesc = NULL;
1040 } else {
1041 r->in.secdesc = NULL;
1042 PY_CHECK_TYPE(&winreg_SecBuf_Type, py_secdesc, return false;);
1043 if (talloc_reference(r, py_talloc_get_mem_ctx(py_secdesc)) == NULL) {
1044 PyErr_NoMemory();
1045 return false;
1046 }
1047 r->in.secdesc = (struct winreg_SecBuf *)py_talloc_get_ptr(py_secdesc);
1048 }
1049 if (py_action_taken == Py_None) {
1050 r->in.action_taken = NULL;
1051 } else {
1052 r->in.action_taken = talloc_ptrtype(r, r->in.action_taken);
1053 if (PyLong_Check(py_action_taken)) {
1054 *r->in.action_taken = PyLong_AsLongLong(py_action_taken);
1055 } else if (PyInt_Check(py_action_taken)) {
1056 *r->in.action_taken = PyInt_AsLong(py_action_taken);
1057 } else {
1058 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1059 PyInt_Type.tp_name, PyLong_Type.tp_name);
1060 return false;
1061 }
1062 }
1063 return true;
1064}
1065
1066static PyObject *unpack_py_winreg_CreateKey_args_out(struct winreg_CreateKey *r)
1067{
1068 PyObject *result;
1069 PyObject *py_new_handle;
1070 PyObject *py_action_taken;
1071 result = PyTuple_New(2);
1072 py_new_handle = py_talloc_reference_ex(policy_handle_Type, r->out.new_handle, r->out.new_handle);
1073 PyTuple_SetItem(result, 0, py_new_handle);
1074 if (r->out.action_taken == NULL) {
1075 py_action_taken = Py_None;
1076 Py_INCREF(py_action_taken);
1077 } else {
1078 py_action_taken = PyInt_FromLong(*r->out.action_taken);
1079 }
1080 PyTuple_SetItem(result, 1, py_action_taken);
1081 if (!W_ERROR_IS_OK(r->out.result)) {
1082 PyErr_SetWERROR(r->out.result);
1083 return NULL;
1084 }
1085
1086 return result;
1087}
1088
1089static bool pack_py_winreg_DeleteKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteKey *r)
1090{
1091 PyObject *py_handle;
1092 PyObject *py_key;
1093 const char *kwnames[] = {
1094 "handle", "key", NULL
1095 };
1096
1097 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_DeleteKey", discard_const_p(char *, kwnames), &py_handle, &py_key)) {
1098 return false;
1099 }
1100
1101 r->in.handle = talloc_ptrtype(r, r->in.handle);
1102 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1103 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1104 PyErr_NoMemory();
1105 return false;
1106 }
1107 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1108 PY_CHECK_TYPE(&winreg_String_Type, py_key, return false;);
1109 if (talloc_reference(r, py_talloc_get_mem_ctx(py_key)) == NULL) {
1110 PyErr_NoMemory();
1111 return false;
1112 }
1113 r->in.key = *(struct winreg_String *)py_talloc_get_ptr(py_key);
1114 return true;
1115}
1116
1117static PyObject *unpack_py_winreg_DeleteKey_args_out(struct winreg_DeleteKey *r)
1118{
1119 PyObject *result;
1120 result = Py_None;
1121 Py_INCREF(result);
1122 if (!W_ERROR_IS_OK(r->out.result)) {
1123 PyErr_SetWERROR(r->out.result);
1124 return NULL;
1125 }
1126
1127 return result;
1128}
1129
1130static bool pack_py_winreg_DeleteValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteValue *r)
1131{
1132 PyObject *py_handle;
1133 PyObject *py_value;
1134 const char *kwnames[] = {
1135 "handle", "value", NULL
1136 };
1137
1138 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_DeleteValue", discard_const_p(char *, kwnames), &py_handle, &py_value)) {
1139 return false;
1140 }
1141
1142 r->in.handle = talloc_ptrtype(r, r->in.handle);
1143 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1144 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1145 PyErr_NoMemory();
1146 return false;
1147 }
1148 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1149 PY_CHECK_TYPE(&winreg_String_Type, py_value, return false;);
1150 if (talloc_reference(r, py_talloc_get_mem_ctx(py_value)) == NULL) {
1151 PyErr_NoMemory();
1152 return false;
1153 }
1154 r->in.value = *(struct winreg_String *)py_talloc_get_ptr(py_value);
1155 return true;
1156}
1157
1158static PyObject *unpack_py_winreg_DeleteValue_args_out(struct winreg_DeleteValue *r)
1159{
1160 PyObject *result;
1161 result = Py_None;
1162 Py_INCREF(result);
1163 if (!W_ERROR_IS_OK(r->out.result)) {
1164 PyErr_SetWERROR(r->out.result);
1165 return NULL;
1166 }
1167
1168 return result;
1169}
1170
1171static bool pack_py_winreg_EnumKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_EnumKey *r)
1172{
1173 PyObject *py_handle;
1174 PyObject *py_enum_index;
1175 PyObject *py_name;
1176 PyObject *py_keyclass;
1177 PyObject *py_last_changed_time;
1178 const char *kwnames[] = {
1179 "handle", "enum_index", "name", "keyclass", "last_changed_time", NULL
1180 };
1181
1182 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winreg_EnumKey", discard_const_p(char *, kwnames), &py_handle, &py_enum_index, &py_name, &py_keyclass, &py_last_changed_time)) {
1183 return false;
1184 }
1185
1186 r->in.handle = talloc_ptrtype(r, r->in.handle);
1187 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1188 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1189 PyErr_NoMemory();
1190 return false;
1191 }
1192 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1193 PY_CHECK_TYPE(&PyInt_Type, py_enum_index, return false;);
1194 r->in.enum_index = PyInt_AsLong(py_enum_index);
1195 r->in.name = talloc_ptrtype(r, r->in.name);
1196 PY_CHECK_TYPE(&winreg_StringBuf_Type, py_name, return false;);
1197 if (talloc_reference(r, py_talloc_get_mem_ctx(py_name)) == NULL) {
1198 PyErr_NoMemory();
1199 return false;
1200 }
1201 r->in.name = (struct winreg_StringBuf *)py_talloc_get_ptr(py_name);
1202 if (py_keyclass == Py_None) {
1203 r->in.keyclass = NULL;
1204 } else {
1205 r->in.keyclass = NULL;
1206 PY_CHECK_TYPE(&winreg_StringBuf_Type, py_keyclass, return false;);
1207 if (talloc_reference(r, py_talloc_get_mem_ctx(py_keyclass)) == NULL) {
1208 PyErr_NoMemory();
1209 return false;
1210 }
1211 r->in.keyclass = (struct winreg_StringBuf *)py_talloc_get_ptr(py_keyclass);
1212 }
1213 if (py_last_changed_time == Py_None) {
1214 r->in.last_changed_time = NULL;
1215 } else {
1216 r->in.last_changed_time = talloc_ptrtype(r, r->in.last_changed_time);
1217 if (PyLong_Check(py_last_changed_time)) {
1218 *r->in.last_changed_time = PyLong_AsLongLong(py_last_changed_time);
1219 } else if (PyInt_Check(py_last_changed_time)) {
1220 *r->in.last_changed_time = PyInt_AsLong(py_last_changed_time);
1221 } else {
1222 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1223 PyInt_Type.tp_name, PyLong_Type.tp_name);
1224 return false;
1225 }
1226 }
1227 return true;
1228}
1229
1230static PyObject *unpack_py_winreg_EnumKey_args_out(struct winreg_EnumKey *r)
1231{
1232 PyObject *result;
1233 PyObject *py_name;
1234 PyObject *py_keyclass;
1235 PyObject *py_last_changed_time;
1236 result = PyTuple_New(3);
1237 py_name = py_talloc_reference_ex(&winreg_StringBuf_Type, r->out.name, r->out.name);
1238 PyTuple_SetItem(result, 0, py_name);
1239 if (r->out.keyclass == NULL) {
1240 py_keyclass = Py_None;
1241 Py_INCREF(py_keyclass);
1242 } else {
1243 py_keyclass = py_talloc_reference_ex(&winreg_StringBuf_Type, r->out.keyclass, r->out.keyclass);
1244 }
1245 PyTuple_SetItem(result, 1, py_keyclass);
1246 if (r->out.last_changed_time == NULL) {
1247 py_last_changed_time = Py_None;
1248 Py_INCREF(py_last_changed_time);
1249 } else {
1250 py_last_changed_time = PyLong_FromLongLong(*r->out.last_changed_time);
1251 }
1252 PyTuple_SetItem(result, 2, py_last_changed_time);
1253 if (!W_ERROR_IS_OK(r->out.result)) {
1254 PyErr_SetWERROR(r->out.result);
1255 return NULL;
1256 }
1257
1258 return result;
1259}
1260
1261static bool pack_py_winreg_EnumValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_EnumValue *r)
1262{
1263 PyObject *py_handle;
1264 PyObject *py_enum_index;
1265 PyObject *py_name;
1266 PyObject *py_type;
1267 PyObject *py_value;
1268 PyObject *py_size;
1269 PyObject *py_length;
1270 const char *kwnames[] = {
1271 "handle", "enum_index", "name", "type", "value", "size", "length", NULL
1272 };
1273
1274 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOO:winreg_EnumValue", discard_const_p(char *, kwnames), &py_handle, &py_enum_index, &py_name, &py_type, &py_value, &py_size, &py_length)) {
1275 return false;
1276 }
1277
1278 r->in.handle = talloc_ptrtype(r, r->in.handle);
1279 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1280 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1281 PyErr_NoMemory();
1282 return false;
1283 }
1284 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1285 PY_CHECK_TYPE(&PyInt_Type, py_enum_index, return false;);
1286 r->in.enum_index = PyInt_AsLong(py_enum_index);
1287 r->in.name = talloc_ptrtype(r, r->in.name);
1288 PY_CHECK_TYPE(&winreg_ValNameBuf_Type, py_name, return false;);
1289 if (talloc_reference(r, py_talloc_get_mem_ctx(py_name)) == NULL) {
1290 PyErr_NoMemory();
1291 return false;
1292 }
1293 r->in.name = (struct winreg_ValNameBuf *)py_talloc_get_ptr(py_name);
1294 if (py_type == Py_None) {
1295 r->in.type = NULL;
1296 } else {
1297 r->in.type = talloc_ptrtype(r, r->in.type);
1298 if (PyLong_Check(py_type)) {
1299 *r->in.type = PyLong_AsLongLong(py_type);
1300 } else if (PyInt_Check(py_type)) {
1301 *r->in.type = PyInt_AsLong(py_type);
1302 } else {
1303 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1304 PyInt_Type.tp_name, PyLong_Type.tp_name);
1305 return false;
1306 }
1307 }
1308 if (py_value == Py_None) {
1309 r->in.value = NULL;
1310 } else {
1311 r->in.value = NULL;
1312 PY_CHECK_TYPE(&PyList_Type, py_value, return false;);
1313 {
1314 int value_cntr_1;
1315 r->in.value = talloc_array_ptrtype(r, r->in.value, PyList_GET_SIZE(py_value));
1316 if (!r->in.value) { return false;; }
1317 talloc_set_name_const(r->in.value, "ARRAY: r->in.value");
1318 for (value_cntr_1 = 0; value_cntr_1 < PyList_GET_SIZE(py_value); value_cntr_1++) {
1319 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(py_value, value_cntr_1), return false;);
1320 r->in.value[value_cntr_1] = PyInt_AsLong(PyList_GET_ITEM(py_value, value_cntr_1));
1321 }
1322 }
1323 }
1324 if (py_size == Py_None) {
1325 r->in.size = NULL;
1326 } else {
1327 r->in.size = talloc_ptrtype(r, r->in.size);
1328 PY_CHECK_TYPE(&PyInt_Type, py_size, return false;);
1329 *r->in.size = PyInt_AsLong(py_size);
1330 }
1331 if (py_length == Py_None) {
1332 r->in.length = NULL;
1333 } else {
1334 r->in.length = talloc_ptrtype(r, r->in.length);
1335 PY_CHECK_TYPE(&PyInt_Type, py_length, return false;);
1336 *r->in.length = PyInt_AsLong(py_length);
1337 }
1338 return true;
1339}
1340
1341static PyObject *unpack_py_winreg_EnumValue_args_out(struct winreg_EnumValue *r)
1342{
1343 PyObject *result;
1344 PyObject *py_name;
1345 PyObject *py_type;
1346 PyObject *py_value;
1347 PyObject *py_size;
1348 PyObject *py_length;
1349 result = PyTuple_New(5);
1350 py_name = py_talloc_reference_ex(&winreg_ValNameBuf_Type, r->out.name, r->out.name);
1351 PyTuple_SetItem(result, 0, py_name);
1352 if (r->out.type == NULL) {
1353 py_type = Py_None;
1354 Py_INCREF(py_type);
1355 } else {
1356 py_type = PyInt_FromLong(*r->out.type);
1357 }
1358 PyTuple_SetItem(result, 1, py_type);
1359 if (r->out.value == NULL) {
1360 py_value = Py_None;
1361 Py_INCREF(py_value);
1362 } else {
1363 py_value = PyList_New(r->out.length?*r->out.length:0);
1364 if (py_value == NULL) {
1365 return NULL;
1366 }
1367 {
1368 int value_cntr_1;
1369 for (value_cntr_1 = 0; value_cntr_1 < r->out.length?*r->out.length:0; value_cntr_1++) {
1370 PyObject *py_value_1;
1371 py_value_1 = PyInt_FromLong(r->out.value[value_cntr_1]);
1372 PyList_SetItem(py_value, value_cntr_1, py_value_1);
1373 }
1374 }
1375 }
1376 PyTuple_SetItem(result, 2, py_value);
1377 if (r->out.size == NULL) {
1378 py_size = Py_None;
1379 Py_INCREF(py_size);
1380 } else {
1381 py_size = PyInt_FromLong(*r->out.size);
1382 }
1383 PyTuple_SetItem(result, 3, py_size);
1384 if (r->out.length == NULL) {
1385 py_length = Py_None;
1386 Py_INCREF(py_length);
1387 } else {
1388 py_length = PyInt_FromLong(*r->out.length);
1389 }
1390 PyTuple_SetItem(result, 4, py_length);
1391 if (!W_ERROR_IS_OK(r->out.result)) {
1392 PyErr_SetWERROR(r->out.result);
1393 return NULL;
1394 }
1395
1396 return result;
1397}
1398
1399static bool pack_py_winreg_FlushKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_FlushKey *r)
1400{
1401 PyObject *py_handle;
1402 const char *kwnames[] = {
1403 "handle", NULL
1404 };
1405
1406 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_FlushKey", discard_const_p(char *, kwnames), &py_handle)) {
1407 return false;
1408 }
1409
1410 r->in.handle = talloc_ptrtype(r, r->in.handle);
1411 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1412 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1413 PyErr_NoMemory();
1414 return false;
1415 }
1416 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1417 return true;
1418}
1419
1420static PyObject *unpack_py_winreg_FlushKey_args_out(struct winreg_FlushKey *r)
1421{
1422 PyObject *result;
1423 result = Py_None;
1424 Py_INCREF(result);
1425 if (!W_ERROR_IS_OK(r->out.result)) {
1426 PyErr_SetWERROR(r->out.result);
1427 return NULL;
1428 }
1429
1430 return result;
1431}
1432
1433static bool pack_py_winreg_GetKeySecurity_args_in(PyObject *args, PyObject *kwargs, struct winreg_GetKeySecurity *r)
1434{
1435 PyObject *py_handle;
1436 PyObject *py_sec_info;
1437 PyObject *py_sd;
1438 const char *kwnames[] = {
1439 "handle", "sec_info", "sd", NULL
1440 };
1441
1442 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_GetKeySecurity", discard_const_p(char *, kwnames), &py_handle, &py_sec_info, &py_sd)) {
1443 return false;
1444 }
1445
1446 r->in.handle = talloc_ptrtype(r, r->in.handle);
1447 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1448 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1449 PyErr_NoMemory();
1450 return false;
1451 }
1452 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1453 if (PyLong_Check(py_sec_info)) {
1454 r->in.sec_info = PyLong_AsLongLong(py_sec_info);
1455 } else if (PyInt_Check(py_sec_info)) {
1456 r->in.sec_info = PyInt_AsLong(py_sec_info);
1457 } else {
1458 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1459 PyInt_Type.tp_name, PyLong_Type.tp_name);
1460 return false;
1461 }
1462 r->in.sd = talloc_ptrtype(r, r->in.sd);
1463 PY_CHECK_TYPE(&KeySecurityData_Type, py_sd, return false;);
1464 if (talloc_reference(r, py_talloc_get_mem_ctx(py_sd)) == NULL) {
1465 PyErr_NoMemory();
1466 return false;
1467 }
1468 r->in.sd = (struct KeySecurityData *)py_talloc_get_ptr(py_sd);
1469 return true;
1470}
1471
1472static PyObject *unpack_py_winreg_GetKeySecurity_args_out(struct winreg_GetKeySecurity *r)
1473{
1474 PyObject *result;
1475 PyObject *py_sd;
1476 py_sd = py_talloc_reference_ex(&KeySecurityData_Type, r->out.sd, r->out.sd);
1477 result = py_sd;
1478 if (!W_ERROR_IS_OK(r->out.result)) {
1479 PyErr_SetWERROR(r->out.result);
1480 return NULL;
1481 }
1482
1483 return result;
1484}
1485
1486static bool pack_py_winreg_LoadKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_LoadKey *r)
1487{
1488 PyObject *py_handle;
1489 PyObject *py_keyname;
1490 PyObject *py_filename;
1491 const char *kwnames[] = {
1492 "handle", "keyname", "filename", NULL
1493 };
1494
1495 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_LoadKey", discard_const_p(char *, kwnames), &py_handle, &py_keyname, &py_filename)) {
1496 return false;
1497 }
1498
1499 r->in.handle = talloc_ptrtype(r, r->in.handle);
1500 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1501 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1502 PyErr_NoMemory();
1503 return false;
1504 }
1505 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1506 if (py_keyname == Py_None) {
1507 r->in.keyname = NULL;
1508 } else {
1509 r->in.keyname = NULL;
1510 PY_CHECK_TYPE(&winreg_String_Type, py_keyname, return false;);
1511 if (talloc_reference(r, py_talloc_get_mem_ctx(py_keyname)) == NULL) {
1512 PyErr_NoMemory();
1513 return false;
1514 }
1515 r->in.keyname = (struct winreg_String *)py_talloc_get_ptr(py_keyname);
1516 }
1517 if (py_filename == Py_None) {
1518 r->in.filename = NULL;
1519 } else {
1520 r->in.filename = NULL;
1521 PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
1522 if (talloc_reference(r, py_talloc_get_mem_ctx(py_filename)) == NULL) {
1523 PyErr_NoMemory();
1524 return false;
1525 }
1526 r->in.filename = (struct winreg_String *)py_talloc_get_ptr(py_filename);
1527 }
1528 return true;
1529}
1530
1531static PyObject *unpack_py_winreg_LoadKey_args_out(struct winreg_LoadKey *r)
1532{
1533 PyObject *result;
1534 result = Py_None;
1535 Py_INCREF(result);
1536 if (!W_ERROR_IS_OK(r->out.result)) {
1537 PyErr_SetWERROR(r->out.result);
1538 return NULL;
1539 }
1540
1541 return result;
1542}
1543
1544static bool pack_py_winreg_NotifyChangeKeyValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_NotifyChangeKeyValue *r)
1545{
1546 PyObject *py_handle;
1547 PyObject *py_watch_subtree;
1548 PyObject *py_notify_filter;
1549 PyObject *py_unknown;
1550 PyObject *py_string1;
1551 PyObject *py_string2;
1552 PyObject *py_unknown2;
1553 const char *kwnames[] = {
1554 "handle", "watch_subtree", "notify_filter", "unknown", "string1", "string2", "unknown2", NULL
1555 };
1556
1557 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOO:winreg_NotifyChangeKeyValue", discard_const_p(char *, kwnames), &py_handle, &py_watch_subtree, &py_notify_filter, &py_unknown, &py_string1, &py_string2, &py_unknown2)) {
1558 return false;
1559 }
1560
1561 r->in.handle = talloc_ptrtype(r, r->in.handle);
1562 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1563 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1564 PyErr_NoMemory();
1565 return false;
1566 }
1567 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1568 PY_CHECK_TYPE(&PyInt_Type, py_watch_subtree, return false;);
1569 r->in.watch_subtree = PyInt_AsLong(py_watch_subtree);
1570 if (PyLong_Check(py_notify_filter)) {
1571 r->in.notify_filter = PyLong_AsLongLong(py_notify_filter);
1572 } else if (PyInt_Check(py_notify_filter)) {
1573 r->in.notify_filter = PyInt_AsLong(py_notify_filter);
1574 } else {
1575 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1576 PyInt_Type.tp_name, PyLong_Type.tp_name);
1577 return false;
1578 }
1579 PY_CHECK_TYPE(&PyInt_Type, py_unknown, return false;);
1580 r->in.unknown = PyInt_AsLong(py_unknown);
1581 PY_CHECK_TYPE(&winreg_String_Type, py_string1, return false;);
1582 if (talloc_reference(r, py_talloc_get_mem_ctx(py_string1)) == NULL) {
1583 PyErr_NoMemory();
1584 return false;
1585 }
1586 r->in.string1 = *(struct winreg_String *)py_talloc_get_ptr(py_string1);
1587 PY_CHECK_TYPE(&winreg_String_Type, py_string2, return false;);
1588 if (talloc_reference(r, py_talloc_get_mem_ctx(py_string2)) == NULL) {
1589 PyErr_NoMemory();
1590 return false;
1591 }
1592 r->in.string2 = *(struct winreg_String *)py_talloc_get_ptr(py_string2);
1593 PY_CHECK_TYPE(&PyInt_Type, py_unknown2, return false;);
1594 r->in.unknown2 = PyInt_AsLong(py_unknown2);
1595 return true;
1596}
1597
1598static PyObject *unpack_py_winreg_NotifyChangeKeyValue_args_out(struct winreg_NotifyChangeKeyValue *r)
1599{
1600 PyObject *result;
1601 result = Py_None;
1602 Py_INCREF(result);
1603 if (!W_ERROR_IS_OK(r->out.result)) {
1604 PyErr_SetWERROR(r->out.result);
1605 return NULL;
1606 }
1607
1608 return result;
1609}
1610
1611static bool pack_py_winreg_OpenKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenKey *r)
1612{
1613 PyObject *py_parent_handle;
1614 PyObject *py_keyname;
1615 PyObject *py_options;
1616 PyObject *py_access_mask;
1617 const char *kwnames[] = {
1618 "parent_handle", "keyname", "options", "access_mask", NULL
1619 };
1620
1621 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_OpenKey", discard_const_p(char *, kwnames), &py_parent_handle, &py_keyname, &py_options, &py_access_mask)) {
1622 return false;
1623 }
1624
1625 r->in.parent_handle = talloc_ptrtype(r, r->in.parent_handle);
1626 PY_CHECK_TYPE(policy_handle_Type, py_parent_handle, return false;);
1627 if (talloc_reference(r, py_talloc_get_mem_ctx(py_parent_handle)) == NULL) {
1628 PyErr_NoMemory();
1629 return false;
1630 }
1631 r->in.parent_handle = (struct policy_handle *)py_talloc_get_ptr(py_parent_handle);
1632 PY_CHECK_TYPE(&winreg_String_Type, py_keyname, return false;);
1633 if (talloc_reference(r, py_talloc_get_mem_ctx(py_keyname)) == NULL) {
1634 PyErr_NoMemory();
1635 return false;
1636 }
1637 r->in.keyname = *(struct winreg_String *)py_talloc_get_ptr(py_keyname);
1638 if (PyLong_Check(py_options)) {
1639 r->in.options = PyLong_AsLongLong(py_options);
1640 } else if (PyInt_Check(py_options)) {
1641 r->in.options = PyInt_AsLong(py_options);
1642 } else {
1643 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1644 PyInt_Type.tp_name, PyLong_Type.tp_name);
1645 return false;
1646 }
1647 if (PyLong_Check(py_access_mask)) {
1648 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
1649 } else if (PyInt_Check(py_access_mask)) {
1650 r->in.access_mask = PyInt_AsLong(py_access_mask);
1651 } else {
1652 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1653 PyInt_Type.tp_name, PyLong_Type.tp_name);
1654 return false;
1655 }
1656 return true;
1657}
1658
1659static PyObject *unpack_py_winreg_OpenKey_args_out(struct winreg_OpenKey *r)
1660{
1661 PyObject *result;
1662 PyObject *py_handle;
1663 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
1664 result = py_handle;
1665 if (!W_ERROR_IS_OK(r->out.result)) {
1666 PyErr_SetWERROR(r->out.result);
1667 return NULL;
1668 }
1669
1670 return result;
1671}
1672
1673static bool pack_py_winreg_QueryInfoKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryInfoKey *r)
1674{
1675 PyObject *py_handle;
1676 PyObject *py_classname;
1677 const char *kwnames[] = {
1678 "handle", "classname", NULL
1679 };
1680
1681 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_QueryInfoKey", discard_const_p(char *, kwnames), &py_handle, &py_classname)) {
1682 return false;
1683 }
1684
1685 r->in.handle = talloc_ptrtype(r, r->in.handle);
1686 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1687 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1688 PyErr_NoMemory();
1689 return false;
1690 }
1691 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1692 r->in.classname = talloc_ptrtype(r, r->in.classname);
1693 PY_CHECK_TYPE(&winreg_String_Type, py_classname, return false;);
1694 if (talloc_reference(r, py_talloc_get_mem_ctx(py_classname)) == NULL) {
1695 PyErr_NoMemory();
1696 return false;
1697 }
1698 r->in.classname = (struct winreg_String *)py_talloc_get_ptr(py_classname);
1699 return true;
1700}
1701
1702static PyObject *unpack_py_winreg_QueryInfoKey_args_out(struct winreg_QueryInfoKey *r)
1703{
1704 PyObject *result;
1705 PyObject *py_classname;
1706 PyObject *py_num_subkeys;
1707 PyObject *py_max_subkeylen;
1708 PyObject *py_max_classlen;
1709 PyObject *py_num_values;
1710 PyObject *py_max_valnamelen;
1711 PyObject *py_max_valbufsize;
1712 PyObject *py_secdescsize;
1713 PyObject *py_last_changed_time;
1714 result = PyTuple_New(9);
1715 py_classname = py_talloc_reference_ex(&winreg_String_Type, r->out.classname, r->out.classname);
1716 PyTuple_SetItem(result, 0, py_classname);
1717 py_num_subkeys = PyInt_FromLong(*r->out.num_subkeys);
1718 PyTuple_SetItem(result, 1, py_num_subkeys);
1719 py_max_subkeylen = PyInt_FromLong(*r->out.max_subkeylen);
1720 PyTuple_SetItem(result, 2, py_max_subkeylen);
1721 py_max_classlen = PyInt_FromLong(*r->out.max_classlen);
1722 PyTuple_SetItem(result, 3, py_max_classlen);
1723 py_num_values = PyInt_FromLong(*r->out.num_values);
1724 PyTuple_SetItem(result, 4, py_num_values);
1725 py_max_valnamelen = PyInt_FromLong(*r->out.max_valnamelen);
1726 PyTuple_SetItem(result, 5, py_max_valnamelen);
1727 py_max_valbufsize = PyInt_FromLong(*r->out.max_valbufsize);
1728 PyTuple_SetItem(result, 6, py_max_valbufsize);
1729 py_secdescsize = PyInt_FromLong(*r->out.secdescsize);
1730 PyTuple_SetItem(result, 7, py_secdescsize);
1731 py_last_changed_time = PyLong_FromLongLong(*r->out.last_changed_time);
1732 PyTuple_SetItem(result, 8, py_last_changed_time);
1733 if (!W_ERROR_IS_OK(r->out.result)) {
1734 PyErr_SetWERROR(r->out.result);
1735 return NULL;
1736 }
1737
1738 return result;
1739}
1740
1741static bool pack_py_winreg_QueryValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryValue *r)
1742{
1743 PyObject *py_handle;
1744 PyObject *py_value_name;
1745 PyObject *py_type;
1746 PyObject *py_data;
1747 PyObject *py_data_size;
1748 PyObject *py_data_length;
1749 const char *kwnames[] = {
1750 "handle", "value_name", "type", "data", "data_size", "data_length", NULL
1751 };
1752
1753 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOO:winreg_QueryValue", discard_const_p(char *, kwnames), &py_handle, &py_value_name, &py_type, &py_data, &py_data_size, &py_data_length)) {
1754 return false;
1755 }
1756
1757 r->in.handle = talloc_ptrtype(r, r->in.handle);
1758 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1759 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1760 PyErr_NoMemory();
1761 return false;
1762 }
1763 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1764 r->in.value_name = talloc_ptrtype(r, r->in.value_name);
1765 PY_CHECK_TYPE(&winreg_String_Type, py_value_name, return false;);
1766 if (talloc_reference(r, py_talloc_get_mem_ctx(py_value_name)) == NULL) {
1767 PyErr_NoMemory();
1768 return false;
1769 }
1770 r->in.value_name = (struct winreg_String *)py_talloc_get_ptr(py_value_name);
1771 if (py_type == Py_None) {
1772 r->in.type = NULL;
1773 } else {
1774 r->in.type = talloc_ptrtype(r, r->in.type);
1775 if (PyLong_Check(py_type)) {
1776 *r->in.type = PyLong_AsLongLong(py_type);
1777 } else if (PyInt_Check(py_type)) {
1778 *r->in.type = PyInt_AsLong(py_type);
1779 } else {
1780 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1781 PyInt_Type.tp_name, PyLong_Type.tp_name);
1782 return false;
1783 }
1784 }
1785 if (py_data == Py_None) {
1786 r->in.data = NULL;
1787 } else {
1788 r->in.data = NULL;
1789 PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
1790 {
1791 int data_cntr_1;
1792 r->in.data = talloc_array_ptrtype(r, r->in.data, PyList_GET_SIZE(py_data));
1793 if (!r->in.data) { return false;; }
1794 talloc_set_name_const(r->in.data, "ARRAY: r->in.data");
1795 for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(py_data); data_cntr_1++) {
1796 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(py_data, data_cntr_1), return false;);
1797 r->in.data[data_cntr_1] = PyInt_AsLong(PyList_GET_ITEM(py_data, data_cntr_1));
1798 }
1799 }
1800 }
1801 if (py_data_size == Py_None) {
1802 r->in.data_size = NULL;
1803 } else {
1804 r->in.data_size = talloc_ptrtype(r, r->in.data_size);
1805 PY_CHECK_TYPE(&PyInt_Type, py_data_size, return false;);
1806 *r->in.data_size = PyInt_AsLong(py_data_size);
1807 }
1808 if (py_data_length == Py_None) {
1809 r->in.data_length = NULL;
1810 } else {
1811 r->in.data_length = talloc_ptrtype(r, r->in.data_length);
1812 PY_CHECK_TYPE(&PyInt_Type, py_data_length, return false;);
1813 *r->in.data_length = PyInt_AsLong(py_data_length);
1814 }
1815 return true;
1816}
1817
1818static PyObject *unpack_py_winreg_QueryValue_args_out(struct winreg_QueryValue *r)
1819{
1820 PyObject *result;
1821 PyObject *py_type;
1822 PyObject *py_data;
1823 PyObject *py_data_size;
1824 PyObject *py_data_length;
1825 result = PyTuple_New(4);
1826 if (r->out.type == NULL) {
1827 py_type = Py_None;
1828 Py_INCREF(py_type);
1829 } else {
1830 py_type = PyInt_FromLong(*r->out.type);
1831 }
1832 PyTuple_SetItem(result, 0, py_type);
1833 if (r->out.data == NULL) {
1834 py_data = Py_None;
1835 Py_INCREF(py_data);
1836 } else {
1837 py_data = PyList_New(r->out.data_length?*r->out.data_length:0);
1838 if (py_data == NULL) {
1839 return NULL;
1840 }
1841 {
1842 int data_cntr_1;
1843 for (data_cntr_1 = 0; data_cntr_1 < r->out.data_length?*r->out.data_length:0; data_cntr_1++) {
1844 PyObject *py_data_1;
1845 py_data_1 = PyInt_FromLong(r->out.data[data_cntr_1]);
1846 PyList_SetItem(py_data, data_cntr_1, py_data_1);
1847 }
1848 }
1849 }
1850 PyTuple_SetItem(result, 1, py_data);
1851 if (r->out.data_size == NULL) {
1852 py_data_size = Py_None;
1853 Py_INCREF(py_data_size);
1854 } else {
1855 py_data_size = PyInt_FromLong(*r->out.data_size);
1856 }
1857 PyTuple_SetItem(result, 2, py_data_size);
1858 if (r->out.data_length == NULL) {
1859 py_data_length = Py_None;
1860 Py_INCREF(py_data_length);
1861 } else {
1862 py_data_length = PyInt_FromLong(*r->out.data_length);
1863 }
1864 PyTuple_SetItem(result, 3, py_data_length);
1865 if (!W_ERROR_IS_OK(r->out.result)) {
1866 PyErr_SetWERROR(r->out.result);
1867 return NULL;
1868 }
1869
1870 return result;
1871}
1872
1873static bool pack_py_winreg_ReplaceKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_ReplaceKey *r)
1874{
1875 PyObject *py_handle;
1876 PyObject *py_subkey;
1877 PyObject *py_new_file;
1878 PyObject *py_old_file;
1879 const char *kwnames[] = {
1880 "handle", "subkey", "new_file", "old_file", NULL
1881 };
1882
1883 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_ReplaceKey", discard_const_p(char *, kwnames), &py_handle, &py_subkey, &py_new_file, &py_old_file)) {
1884 return false;
1885 }
1886
1887 r->in.handle = talloc_ptrtype(r, r->in.handle);
1888 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1889 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1890 PyErr_NoMemory();
1891 return false;
1892 }
1893 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1894 r->in.subkey = talloc_ptrtype(r, r->in.subkey);
1895 PY_CHECK_TYPE(&winreg_String_Type, py_subkey, return false;);
1896 if (talloc_reference(r, py_talloc_get_mem_ctx(py_subkey)) == NULL) {
1897 PyErr_NoMemory();
1898 return false;
1899 }
1900 r->in.subkey = (struct winreg_String *)py_talloc_get_ptr(py_subkey);
1901 r->in.new_file = talloc_ptrtype(r, r->in.new_file);
1902 PY_CHECK_TYPE(&winreg_String_Type, py_new_file, return false;);
1903 if (talloc_reference(r, py_talloc_get_mem_ctx(py_new_file)) == NULL) {
1904 PyErr_NoMemory();
1905 return false;
1906 }
1907 r->in.new_file = (struct winreg_String *)py_talloc_get_ptr(py_new_file);
1908 r->in.old_file = talloc_ptrtype(r, r->in.old_file);
1909 PY_CHECK_TYPE(&winreg_String_Type, py_old_file, return false;);
1910 if (talloc_reference(r, py_talloc_get_mem_ctx(py_old_file)) == NULL) {
1911 PyErr_NoMemory();
1912 return false;
1913 }
1914 r->in.old_file = (struct winreg_String *)py_talloc_get_ptr(py_old_file);
1915 return true;
1916}
1917
1918static PyObject *unpack_py_winreg_ReplaceKey_args_out(struct winreg_ReplaceKey *r)
1919{
1920 PyObject *result;
1921 result = Py_None;
1922 Py_INCREF(result);
1923 if (!W_ERROR_IS_OK(r->out.result)) {
1924 PyErr_SetWERROR(r->out.result);
1925 return NULL;
1926 }
1927
1928 return result;
1929}
1930
1931static bool pack_py_winreg_RestoreKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_RestoreKey *r)
1932{
1933 PyObject *py_handle;
1934 PyObject *py_filename;
1935 PyObject *py_flags;
1936 const char *kwnames[] = {
1937 "handle", "filename", "flags", NULL
1938 };
1939
1940 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_RestoreKey", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_flags)) {
1941 return false;
1942 }
1943
1944 r->in.handle = talloc_ptrtype(r, r->in.handle);
1945 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1946 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1947 PyErr_NoMemory();
1948 return false;
1949 }
1950 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
1951 r->in.filename = talloc_ptrtype(r, r->in.filename);
1952 PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
1953 if (talloc_reference(r, py_talloc_get_mem_ctx(py_filename)) == NULL) {
1954 PyErr_NoMemory();
1955 return false;
1956 }
1957 r->in.filename = (struct winreg_String *)py_talloc_get_ptr(py_filename);
1958 if (PyLong_Check(py_flags)) {
1959 r->in.flags = PyLong_AsLongLong(py_flags);
1960 } else if (PyInt_Check(py_flags)) {
1961 r->in.flags = PyInt_AsLong(py_flags);
1962 } else {
1963 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1964 PyInt_Type.tp_name, PyLong_Type.tp_name);
1965 return false;
1966 }
1967 return true;
1968}
1969
1970static PyObject *unpack_py_winreg_RestoreKey_args_out(struct winreg_RestoreKey *r)
1971{
1972 PyObject *result;
1973 result = Py_None;
1974 Py_INCREF(result);
1975 if (!W_ERROR_IS_OK(r->out.result)) {
1976 PyErr_SetWERROR(r->out.result);
1977 return NULL;
1978 }
1979
1980 return result;
1981}
1982
1983static bool pack_py_winreg_SaveKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_SaveKey *r)
1984{
1985 PyObject *py_handle;
1986 PyObject *py_filename;
1987 PyObject *py_sec_attrib;
1988 const char *kwnames[] = {
1989 "handle", "filename", "sec_attrib", NULL
1990 };
1991
1992 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_SaveKey", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_sec_attrib)) {
1993 return false;
1994 }
1995
1996 r->in.handle = talloc_ptrtype(r, r->in.handle);
1997 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
1998 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
1999 PyErr_NoMemory();
2000 return false;
2001 }
2002 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
2003 r->in.filename = talloc_ptrtype(r, r->in.filename);
2004 PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
2005 if (talloc_reference(r, py_talloc_get_mem_ctx(py_filename)) == NULL) {
2006 PyErr_NoMemory();
2007 return false;
2008 }
2009 r->in.filename = (struct winreg_String *)py_talloc_get_ptr(py_filename);
2010 if (py_sec_attrib == Py_None) {
2011 r->in.sec_attrib = NULL;
2012 } else {
2013 r->in.sec_attrib = NULL;
2014 PY_CHECK_TYPE(&KeySecurityAttribute_Type, py_sec_attrib, return false;);
2015 if (talloc_reference(r, py_talloc_get_mem_ctx(py_sec_attrib)) == NULL) {
2016 PyErr_NoMemory();
2017 return false;
2018 }
2019 r->in.sec_attrib = (struct KeySecurityAttribute *)py_talloc_get_ptr(py_sec_attrib);
2020 }
2021 return true;
2022}
2023
2024static PyObject *unpack_py_winreg_SaveKey_args_out(struct winreg_SaveKey *r)
2025{
2026 PyObject *result;
2027 result = Py_None;
2028 Py_INCREF(result);
2029 if (!W_ERROR_IS_OK(r->out.result)) {
2030 PyErr_SetWERROR(r->out.result);
2031 return NULL;
2032 }
2033
2034 return result;
2035}
2036
2037static bool pack_py_winreg_SetKeySecurity_args_in(PyObject *args, PyObject *kwargs, struct winreg_SetKeySecurity *r)
2038{
2039 PyObject *py_handle;
2040 PyObject *py_sec_info;
2041 PyObject *py_sd;
2042 const char *kwnames[] = {
2043 "handle", "sec_info", "sd", NULL
2044 };
2045
2046 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_SetKeySecurity", discard_const_p(char *, kwnames), &py_handle, &py_sec_info, &py_sd)) {
2047 return false;
2048 }
2049
2050 r->in.handle = talloc_ptrtype(r, r->in.handle);
2051 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
2052 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
2053 PyErr_NoMemory();
2054 return false;
2055 }
2056 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
2057 if (PyLong_Check(py_sec_info)) {
2058 r->in.sec_info = PyLong_AsLongLong(py_sec_info);
2059 } else if (PyInt_Check(py_sec_info)) {
2060 r->in.sec_info = PyInt_AsLong(py_sec_info);
2061 } else {
2062 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2063 PyInt_Type.tp_name, PyLong_Type.tp_name);
2064 return false;
2065 }
2066 r->in.sd = talloc_ptrtype(r, r->in.sd);
2067 PY_CHECK_TYPE(&KeySecurityData_Type, py_sd, return false;);
2068 if (talloc_reference(r, py_talloc_get_mem_ctx(py_sd)) == NULL) {
2069 PyErr_NoMemory();
2070 return false;
2071 }
2072 r->in.sd = (struct KeySecurityData *)py_talloc_get_ptr(py_sd);
2073 return true;
2074}
2075
2076static PyObject *unpack_py_winreg_SetKeySecurity_args_out(struct winreg_SetKeySecurity *r)
2077{
2078 PyObject *result;
2079 result = Py_None;
2080 Py_INCREF(result);
2081 if (!W_ERROR_IS_OK(r->out.result)) {
2082 PyErr_SetWERROR(r->out.result);
2083 return NULL;
2084 }
2085
2086 return result;
2087}
2088
2089static bool pack_py_winreg_SetValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_SetValue *r)
2090{
2091 PyObject *py_handle;
2092 PyObject *py_name;
2093 PyObject *py_type;
2094 PyObject *py_data;
2095 const char *kwnames[] = {
2096 "handle", "name", "type", "data", NULL
2097 };
2098
2099 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_SetValue", discard_const_p(char *, kwnames), &py_handle, &py_name, &py_type, &py_data)) {
2100 return false;
2101 }
2102
2103 r->in.handle = talloc_ptrtype(r, r->in.handle);
2104 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
2105 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
2106 PyErr_NoMemory();
2107 return false;
2108 }
2109 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
2110 PY_CHECK_TYPE(&winreg_String_Type, py_name, return false;);
2111 if (talloc_reference(r, py_talloc_get_mem_ctx(py_name)) == NULL) {
2112 PyErr_NoMemory();
2113 return false;
2114 }
2115 r->in.name = *(struct winreg_String *)py_talloc_get_ptr(py_name);
2116 if (PyLong_Check(py_type)) {
2117 r->in.type = PyLong_AsLongLong(py_type);
2118 } else if (PyInt_Check(py_type)) {
2119 r->in.type = PyInt_AsLong(py_type);
2120 } else {
2121 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2122 PyInt_Type.tp_name, PyLong_Type.tp_name);
2123 return false;
2124 }
2125 r->in.data = talloc_ptrtype(r, r->in.data);
2126 PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
2127 {
2128 int data_cntr_1;
2129 r->in.data = talloc_array_ptrtype(r, r->in.data, PyList_GET_SIZE(py_data));
2130 if (!r->in.data) { return false;; }
2131 talloc_set_name_const(r->in.data, "ARRAY: r->in.data");
2132 for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(py_data); data_cntr_1++) {
2133 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(py_data, data_cntr_1), return false;);
2134 r->in.data[data_cntr_1] = PyInt_AsLong(PyList_GET_ITEM(py_data, data_cntr_1));
2135 }
2136 }
2137 PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
2138 r->in.size = PyList_GET_SIZE(py_data);
2139 return true;
2140}
2141
2142static PyObject *unpack_py_winreg_SetValue_args_out(struct winreg_SetValue *r)
2143{
2144 PyObject *result;
2145 result = Py_None;
2146 Py_INCREF(result);
2147 if (!W_ERROR_IS_OK(r->out.result)) {
2148 PyErr_SetWERROR(r->out.result);
2149 return NULL;
2150 }
2151
2152 return result;
2153}
2154
2155static bool pack_py_winreg_UnLoadKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_UnLoadKey *r)
2156{
2157 PyObject *py_handle;
2158 PyObject *py_subkey;
2159 const char *kwnames[] = {
2160 "handle", "subkey", NULL
2161 };
2162
2163 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_UnLoadKey", discard_const_p(char *, kwnames), &py_handle, &py_subkey)) {
2164 return false;
2165 }
2166
2167 r->in.handle = talloc_ptrtype(r, r->in.handle);
2168 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
2169 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
2170 PyErr_NoMemory();
2171 return false;
2172 }
2173 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
2174 r->in.subkey = talloc_ptrtype(r, r->in.subkey);
2175 PY_CHECK_TYPE(&winreg_String_Type, py_subkey, return false;);
2176 if (talloc_reference(r, py_talloc_get_mem_ctx(py_subkey)) == NULL) {
2177 PyErr_NoMemory();
2178 return false;
2179 }
2180 r->in.subkey = (struct winreg_String *)py_talloc_get_ptr(py_subkey);
2181 return true;
2182}
2183
2184static PyObject *unpack_py_winreg_UnLoadKey_args_out(struct winreg_UnLoadKey *r)
2185{
2186 PyObject *result;
2187 result = Py_None;
2188 Py_INCREF(result);
2189 if (!W_ERROR_IS_OK(r->out.result)) {
2190 PyErr_SetWERROR(r->out.result);
2191 return NULL;
2192 }
2193
2194 return result;
2195}
2196
2197static bool pack_py_winreg_InitiateSystemShutdown_args_in(PyObject *args, PyObject *kwargs, struct winreg_InitiateSystemShutdown *r)
2198{
2199 PyObject *py_hostname;
2200 PyObject *py_message;
2201 PyObject *py_timeout;
2202 PyObject *py_force_apps;
2203 PyObject *py_do_reboot;
2204 const char *kwnames[] = {
2205 "hostname", "message", "timeout", "force_apps", "do_reboot", NULL
2206 };
2207
2208 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winreg_InitiateSystemShutdown", discard_const_p(char *, kwnames), &py_hostname, &py_message, &py_timeout, &py_force_apps, &py_do_reboot)) {
2209 return false;
2210 }
2211
2212 if (py_hostname == Py_None) {
2213 r->in.hostname = NULL;
2214 } else {
2215 r->in.hostname = talloc_ptrtype(r, r->in.hostname);
2216 PY_CHECK_TYPE(&PyInt_Type, py_hostname, return false;);
2217 *r->in.hostname = PyInt_AsLong(py_hostname);
2218 }
2219 if (py_message == Py_None) {
2220 r->in.message = NULL;
2221 } else {
2222 r->in.message = NULL;
2223 PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
2224 if (talloc_reference(r, py_talloc_get_mem_ctx(py_message)) == NULL) {
2225 PyErr_NoMemory();
2226 return false;
2227 }
2228 r->in.message = (struct lsa_StringLarge *)py_talloc_get_ptr(py_message);
2229 }
2230 PY_CHECK_TYPE(&PyInt_Type, py_timeout, return false;);
2231 r->in.timeout = PyInt_AsLong(py_timeout);
2232 PY_CHECK_TYPE(&PyInt_Type, py_force_apps, return false;);
2233 r->in.force_apps = PyInt_AsLong(py_force_apps);
2234 PY_CHECK_TYPE(&PyInt_Type, py_do_reboot, return false;);
2235 r->in.do_reboot = PyInt_AsLong(py_do_reboot);
2236 return true;
2237}
2238
2239static PyObject *unpack_py_winreg_InitiateSystemShutdown_args_out(struct winreg_InitiateSystemShutdown *r)
2240{
2241 PyObject *result;
2242 result = Py_None;
2243 Py_INCREF(result);
2244 if (!W_ERROR_IS_OK(r->out.result)) {
2245 PyErr_SetWERROR(r->out.result);
2246 return NULL;
2247 }
2248
2249 return result;
2250}
2251
2252static bool pack_py_winreg_AbortSystemShutdown_args_in(PyObject *args, PyObject *kwargs, struct winreg_AbortSystemShutdown *r)
2253{
2254 PyObject *py_server;
2255 const char *kwnames[] = {
2256 "server", NULL
2257 };
2258
2259 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_AbortSystemShutdown", discard_const_p(char *, kwnames), &py_server)) {
2260 return false;
2261 }
2262
2263 if (py_server == Py_None) {
2264 r->in.server = NULL;
2265 } else {
2266 r->in.server = talloc_ptrtype(r, r->in.server);
2267 PY_CHECK_TYPE(&PyInt_Type, py_server, return false;);
2268 *r->in.server = PyInt_AsLong(py_server);
2269 }
2270 return true;
2271}
2272
2273static PyObject *unpack_py_winreg_AbortSystemShutdown_args_out(struct winreg_AbortSystemShutdown *r)
2274{
2275 PyObject *result;
2276 result = Py_None;
2277 Py_INCREF(result);
2278 if (!W_ERROR_IS_OK(r->out.result)) {
2279 PyErr_SetWERROR(r->out.result);
2280 return NULL;
2281 }
2282
2283 return result;
2284}
2285
2286static bool pack_py_winreg_GetVersion_args_in(PyObject *args, PyObject *kwargs, struct winreg_GetVersion *r)
2287{
2288 PyObject *py_handle;
2289 const char *kwnames[] = {
2290 "handle", NULL
2291 };
2292
2293 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_GetVersion", discard_const_p(char *, kwnames), &py_handle)) {
2294 return false;
2295 }
2296
2297 r->in.handle = talloc_ptrtype(r, r->in.handle);
2298 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
2299 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
2300 PyErr_NoMemory();
2301 return false;
2302 }
2303 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
2304 return true;
2305}
2306
2307static PyObject *unpack_py_winreg_GetVersion_args_out(struct winreg_GetVersion *r)
2308{
2309 PyObject *result;
2310 PyObject *py_version;
2311 py_version = PyInt_FromLong(*r->out.version);
2312 result = py_version;
2313 if (!W_ERROR_IS_OK(r->out.result)) {
2314 PyErr_SetWERROR(r->out.result);
2315 return NULL;
2316 }
2317
2318 return result;
2319}
2320
2321static bool pack_py_winreg_OpenHKCC_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCC *r)
2322{
2323 PyObject *py_system_name;
2324 PyObject *py_access_mask;
2325 const char *kwnames[] = {
2326 "system_name", "access_mask", NULL
2327 };
2328
2329 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCC", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2330 return false;
2331 }
2332
2333 if (py_system_name == Py_None) {
2334 r->in.system_name = NULL;
2335 } else {
2336 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2337 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
2338 *r->in.system_name = PyInt_AsLong(py_system_name);
2339 }
2340 if (PyLong_Check(py_access_mask)) {
2341 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
2342 } else if (PyInt_Check(py_access_mask)) {
2343 r->in.access_mask = PyInt_AsLong(py_access_mask);
2344 } else {
2345 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2346 PyInt_Type.tp_name, PyLong_Type.tp_name);
2347 return false;
2348 }
2349 return true;
2350}
2351
2352static PyObject *unpack_py_winreg_OpenHKCC_args_out(struct winreg_OpenHKCC *r)
2353{
2354 PyObject *result;
2355 PyObject *py_handle;
2356 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2357 result = py_handle;
2358 if (!W_ERROR_IS_OK(r->out.result)) {
2359 PyErr_SetWERROR(r->out.result);
2360 return NULL;
2361 }
2362
2363 return result;
2364}
2365
2366static bool pack_py_winreg_OpenHKDD_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKDD *r)
2367{
2368 PyObject *py_system_name;
2369 PyObject *py_access_mask;
2370 const char *kwnames[] = {
2371 "system_name", "access_mask", NULL
2372 };
2373
2374 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKDD", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2375 return false;
2376 }
2377
2378 if (py_system_name == Py_None) {
2379 r->in.system_name = NULL;
2380 } else {
2381 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2382 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
2383 *r->in.system_name = PyInt_AsLong(py_system_name);
2384 }
2385 if (PyLong_Check(py_access_mask)) {
2386 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
2387 } else if (PyInt_Check(py_access_mask)) {
2388 r->in.access_mask = PyInt_AsLong(py_access_mask);
2389 } else {
2390 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2391 PyInt_Type.tp_name, PyLong_Type.tp_name);
2392 return false;
2393 }
2394 return true;
2395}
2396
2397static PyObject *unpack_py_winreg_OpenHKDD_args_out(struct winreg_OpenHKDD *r)
2398{
2399 PyObject *result;
2400 PyObject *py_handle;
2401 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2402 result = py_handle;
2403 if (!W_ERROR_IS_OK(r->out.result)) {
2404 PyErr_SetWERROR(r->out.result);
2405 return NULL;
2406 }
2407
2408 return result;
2409}
2410
2411static bool pack_py_winreg_QueryMultipleValues_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryMultipleValues *r)
2412{
2413 PyObject *py_key_handle;
2414 PyObject *py_values_in;
2415 PyObject *py_buffer;
2416 const char *kwnames[] = {
2417 "key_handle", "values_in", "buffer", NULL
2418 };
2419
2420 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_QueryMultipleValues", discard_const_p(char *, kwnames), &py_key_handle, &py_values_in, &py_buffer)) {
2421 return false;
2422 }
2423
2424 r->in.key_handle = talloc_ptrtype(r, r->in.key_handle);
2425 PY_CHECK_TYPE(policy_handle_Type, py_key_handle, return false;);
2426 if (talloc_reference(r, py_talloc_get_mem_ctx(py_key_handle)) == NULL) {
2427 PyErr_NoMemory();
2428 return false;
2429 }
2430 r->in.key_handle = (struct policy_handle *)py_talloc_get_ptr(py_key_handle);
2431 r->in.values_in = talloc_ptrtype(r, r->in.values_in);
2432 PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
2433 {
2434 int values_in_cntr_1;
2435 r->in.values_in = talloc_array_ptrtype(r, r->in.values_in, PyList_GET_SIZE(py_values_in));
2436 if (!r->in.values_in) { return false;; }
2437 talloc_set_name_const(r->in.values_in, "ARRAY: r->in.values_in");
2438 for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(py_values_in); values_in_cntr_1++) {
2439 PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(py_values_in, values_in_cntr_1), return false;);
2440 if (talloc_reference(r->in.values_in, py_talloc_get_mem_ctx(PyList_GET_ITEM(py_values_in, values_in_cntr_1))) == NULL) {
2441 PyErr_NoMemory();
2442 return false;
2443 }
2444 r->in.values_in[values_in_cntr_1] = *(struct QueryMultipleValue *)py_talloc_get_ptr(PyList_GET_ITEM(py_values_in, values_in_cntr_1));
2445 }
2446 }
2447 PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
2448 r->in.num_values = PyList_GET_SIZE(py_values_in);
2449 if (py_buffer == Py_None) {
2450 r->in.buffer = NULL;
2451 } else {
2452 r->in.buffer = NULL;
2453 PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
2454 {
2455 int buffer_cntr_1;
2456 r->in.buffer = talloc_array_ptrtype(r, r->in.buffer, PyList_GET_SIZE(py_buffer));
2457 if (!r->in.buffer) { return false;; }
2458 talloc_set_name_const(r->in.buffer, "ARRAY: r->in.buffer");
2459 for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(py_buffer); buffer_cntr_1++) {
2460 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(py_buffer, buffer_cntr_1), return false;);
2461 r->in.buffer[buffer_cntr_1] = PyInt_AsLong(PyList_GET_ITEM(py_buffer, buffer_cntr_1));
2462 }
2463 }
2464 }
2465 PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
2466 r->in.buffer_size = talloc_ptrtype(r, r->in.buffer_size);
2467 *r->in.buffer_size = PyList_GET_SIZE(py_buffer);
2468 return true;
2469}
2470
2471static PyObject *unpack_py_winreg_QueryMultipleValues_args_out(struct winreg_QueryMultipleValues *r)
2472{
2473 PyObject *result;
2474 PyObject *py_values_out;
2475 PyObject *py_buffer;
2476 result = PyTuple_New(2);
2477 py_values_out = PyList_New(r->in.num_values);
2478 if (py_values_out == NULL) {
2479 return NULL;
2480 }
2481 {
2482 int values_out_cntr_1;
2483 for (values_out_cntr_1 = 0; values_out_cntr_1 < r->in.num_values; values_out_cntr_1++) {
2484 PyObject *py_values_out_1;
2485 py_values_out_1 = py_talloc_reference_ex(&QueryMultipleValue_Type, r->out.values_out, &r->out.values_out[values_out_cntr_1]);
2486 PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
2487 }
2488 }
2489 PyTuple_SetItem(result, 0, py_values_out);
2490 if (r->out.buffer == NULL) {
2491 py_buffer = Py_None;
2492 Py_INCREF(py_buffer);
2493 } else {
2494 py_buffer = PyList_New(*r->out.buffer_size);
2495 if (py_buffer == NULL) {
2496 return NULL;
2497 }
2498 {
2499 int buffer_cntr_1;
2500 for (buffer_cntr_1 = 0; buffer_cntr_1 < *r->out.buffer_size; buffer_cntr_1++) {
2501 PyObject *py_buffer_1;
2502 py_buffer_1 = PyInt_FromLong(r->out.buffer[buffer_cntr_1]);
2503 PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
2504 }
2505 }
2506 }
2507 PyTuple_SetItem(result, 1, py_buffer);
2508 if (!W_ERROR_IS_OK(r->out.result)) {
2509 PyErr_SetWERROR(r->out.result);
2510 return NULL;
2511 }
2512
2513 return result;
2514}
2515
2516static bool pack_py_winreg_InitiateSystemShutdownEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_InitiateSystemShutdownEx *r)
2517{
2518 PyObject *py_hostname;
2519 PyObject *py_message;
2520 PyObject *py_timeout;
2521 PyObject *py_force_apps;
2522 PyObject *py_do_reboot;
2523 PyObject *py_reason;
2524 const char *kwnames[] = {
2525 "hostname", "message", "timeout", "force_apps", "do_reboot", "reason", NULL
2526 };
2527
2528 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOO:winreg_InitiateSystemShutdownEx", discard_const_p(char *, kwnames), &py_hostname, &py_message, &py_timeout, &py_force_apps, &py_do_reboot, &py_reason)) {
2529 return false;
2530 }
2531
2532 if (py_hostname == Py_None) {
2533 r->in.hostname = NULL;
2534 } else {
2535 r->in.hostname = talloc_ptrtype(r, r->in.hostname);
2536 PY_CHECK_TYPE(&PyInt_Type, py_hostname, return false;);
2537 *r->in.hostname = PyInt_AsLong(py_hostname);
2538 }
2539 if (py_message == Py_None) {
2540 r->in.message = NULL;
2541 } else {
2542 r->in.message = NULL;
2543 PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
2544 if (talloc_reference(r, py_talloc_get_mem_ctx(py_message)) == NULL) {
2545 PyErr_NoMemory();
2546 return false;
2547 }
2548 r->in.message = (struct lsa_StringLarge *)py_talloc_get_ptr(py_message);
2549 }
2550 PY_CHECK_TYPE(&PyInt_Type, py_timeout, return false;);
2551 r->in.timeout = PyInt_AsLong(py_timeout);
2552 PY_CHECK_TYPE(&PyInt_Type, py_force_apps, return false;);
2553 r->in.force_apps = PyInt_AsLong(py_force_apps);
2554 PY_CHECK_TYPE(&PyInt_Type, py_do_reboot, return false;);
2555 r->in.do_reboot = PyInt_AsLong(py_do_reboot);
2556 PY_CHECK_TYPE(&PyInt_Type, py_reason, return false;);
2557 r->in.reason = PyInt_AsLong(py_reason);
2558 return true;
2559}
2560
2561static PyObject *unpack_py_winreg_InitiateSystemShutdownEx_args_out(struct winreg_InitiateSystemShutdownEx *r)
2562{
2563 PyObject *result;
2564 result = Py_None;
2565 Py_INCREF(result);
2566 if (!W_ERROR_IS_OK(r->out.result)) {
2567 PyErr_SetWERROR(r->out.result);
2568 return NULL;
2569 }
2570
2571 return result;
2572}
2573
2574static bool pack_py_winreg_SaveKeyEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_SaveKeyEx *r)
2575{
2576 PyObject *py_handle;
2577 PyObject *py_filename;
2578 PyObject *py_sec_attrib;
2579 PyObject *py_flags;
2580 const char *kwnames[] = {
2581 "handle", "filename", "sec_attrib", "flags", NULL
2582 };
2583
2584 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_SaveKeyEx", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_sec_attrib, &py_flags)) {
2585 return false;
2586 }
2587
2588 r->in.handle = talloc_ptrtype(r, r->in.handle);
2589 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
2590 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
2591 PyErr_NoMemory();
2592 return false;
2593 }
2594 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
2595 r->in.filename = talloc_ptrtype(r, r->in.filename);
2596 PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
2597 if (talloc_reference(r, py_talloc_get_mem_ctx(py_filename)) == NULL) {
2598 PyErr_NoMemory();
2599 return false;
2600 }
2601 r->in.filename = (struct winreg_String *)py_talloc_get_ptr(py_filename);
2602 if (py_sec_attrib == Py_None) {
2603 r->in.sec_attrib = NULL;
2604 } else {
2605 r->in.sec_attrib = NULL;
2606 PY_CHECK_TYPE(&KeySecurityAttribute_Type, py_sec_attrib, return false;);
2607 if (talloc_reference(r, py_talloc_get_mem_ctx(py_sec_attrib)) == NULL) {
2608 PyErr_NoMemory();
2609 return false;
2610 }
2611 r->in.sec_attrib = (struct KeySecurityAttribute *)py_talloc_get_ptr(py_sec_attrib);
2612 }
2613 PY_CHECK_TYPE(&PyInt_Type, py_flags, return false;);
2614 r->in.flags = PyInt_AsLong(py_flags);
2615 return true;
2616}
2617
2618static PyObject *unpack_py_winreg_SaveKeyEx_args_out(struct winreg_SaveKeyEx *r)
2619{
2620 PyObject *result;
2621 result = Py_None;
2622 Py_INCREF(result);
2623 if (!W_ERROR_IS_OK(r->out.result)) {
2624 PyErr_SetWERROR(r->out.result);
2625 return NULL;
2626 }
2627
2628 return result;
2629}
2630
2631static bool pack_py_winreg_OpenHKPT_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPT *r)
2632{
2633 PyObject *py_system_name;
2634 PyObject *py_access_mask;
2635 const char *kwnames[] = {
2636 "system_name", "access_mask", NULL
2637 };
2638
2639 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPT", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2640 return false;
2641 }
2642
2643 if (py_system_name == Py_None) {
2644 r->in.system_name = NULL;
2645 } else {
2646 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2647 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
2648 *r->in.system_name = PyInt_AsLong(py_system_name);
2649 }
2650 if (PyLong_Check(py_access_mask)) {
2651 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
2652 } else if (PyInt_Check(py_access_mask)) {
2653 r->in.access_mask = PyInt_AsLong(py_access_mask);
2654 } else {
2655 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2656 PyInt_Type.tp_name, PyLong_Type.tp_name);
2657 return false;
2658 }
2659 return true;
2660}
2661
2662static PyObject *unpack_py_winreg_OpenHKPT_args_out(struct winreg_OpenHKPT *r)
2663{
2664 PyObject *result;
2665 PyObject *py_handle;
2666 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2667 result = py_handle;
2668 if (!W_ERROR_IS_OK(r->out.result)) {
2669 PyErr_SetWERROR(r->out.result);
2670 return NULL;
2671 }
2672
2673 return result;
2674}
2675
2676static bool pack_py_winreg_OpenHKPN_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPN *r)
2677{
2678 PyObject *py_system_name;
2679 PyObject *py_access_mask;
2680 const char *kwnames[] = {
2681 "system_name", "access_mask", NULL
2682 };
2683
2684 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPN", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2685 return false;
2686 }
2687
2688 if (py_system_name == Py_None) {
2689 r->in.system_name = NULL;
2690 } else {
2691 r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2692 PY_CHECK_TYPE(&PyInt_Type, py_system_name, return false;);
2693 *r->in.system_name = PyInt_AsLong(py_system_name);
2694 }
2695 if (PyLong_Check(py_access_mask)) {
2696 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
2697 } else if (PyInt_Check(py_access_mask)) {
2698 r->in.access_mask = PyInt_AsLong(py_access_mask);
2699 } else {
2700 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2701 PyInt_Type.tp_name, PyLong_Type.tp_name);
2702 return false;
2703 }
2704 return true;
2705}
2706
2707static PyObject *unpack_py_winreg_OpenHKPN_args_out(struct winreg_OpenHKPN *r)
2708{
2709 PyObject *result;
2710 PyObject *py_handle;
2711 py_handle = py_talloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2712 result = py_handle;
2713 if (!W_ERROR_IS_OK(r->out.result)) {
2714 PyErr_SetWERROR(r->out.result);
2715 return NULL;
2716 }
2717
2718 return result;
2719}
2720
2721static bool pack_py_winreg_QueryMultipleValues2_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryMultipleValues2 *r)
2722{
2723 PyObject *py_key_handle;
2724 PyObject *py_values_in;
2725 PyObject *py_buffer;
2726 const char *kwnames[] = {
2727 "key_handle", "values_in", "buffer", NULL
2728 };
2729
2730 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_QueryMultipleValues2", discard_const_p(char *, kwnames), &py_key_handle, &py_values_in, &py_buffer)) {
2731 return false;
2732 }
2733
2734 r->in.key_handle = talloc_ptrtype(r, r->in.key_handle);
2735 PY_CHECK_TYPE(policy_handle_Type, py_key_handle, return false;);
2736 if (talloc_reference(r, py_talloc_get_mem_ctx(py_key_handle)) == NULL) {
2737 PyErr_NoMemory();
2738 return false;
2739 }
2740 r->in.key_handle = (struct policy_handle *)py_talloc_get_ptr(py_key_handle);
2741 r->in.values_in = talloc_ptrtype(r, r->in.values_in);
2742 PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
2743 {
2744 int values_in_cntr_1;
2745 r->in.values_in = talloc_array_ptrtype(r, r->in.values_in, PyList_GET_SIZE(py_values_in));
2746 if (!r->in.values_in) { return false;; }
2747 talloc_set_name_const(r->in.values_in, "ARRAY: r->in.values_in");
2748 for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(py_values_in); values_in_cntr_1++) {
2749 PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(py_values_in, values_in_cntr_1), return false;);
2750 if (talloc_reference(r->in.values_in, py_talloc_get_mem_ctx(PyList_GET_ITEM(py_values_in, values_in_cntr_1))) == NULL) {
2751 PyErr_NoMemory();
2752 return false;
2753 }
2754 r->in.values_in[values_in_cntr_1] = *(struct QueryMultipleValue *)py_talloc_get_ptr(PyList_GET_ITEM(py_values_in, values_in_cntr_1));
2755 }
2756 }
2757 PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
2758 r->in.num_values = PyList_GET_SIZE(py_values_in);
2759 if (py_buffer == Py_None) {
2760 r->in.buffer = NULL;
2761 } else {
2762 r->in.buffer = NULL;
2763 PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
2764 {
2765 int buffer_cntr_1;
2766 r->in.buffer = talloc_array_ptrtype(r, r->in.buffer, PyList_GET_SIZE(py_buffer));
2767 if (!r->in.buffer) { return false;; }
2768 talloc_set_name_const(r->in.buffer, "ARRAY: r->in.buffer");
2769 for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(py_buffer); buffer_cntr_1++) {
2770 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(py_buffer, buffer_cntr_1), return false;);
2771 r->in.buffer[buffer_cntr_1] = PyInt_AsLong(PyList_GET_ITEM(py_buffer, buffer_cntr_1));
2772 }
2773 }
2774 }
2775 PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
2776 r->in.offered = talloc_ptrtype(r, r->in.offered);
2777 *r->in.offered = PyList_GET_SIZE(py_buffer);
2778 return true;
2779}
2780
2781static PyObject *unpack_py_winreg_QueryMultipleValues2_args_out(struct winreg_QueryMultipleValues2 *r)
2782{
2783 PyObject *result;
2784 PyObject *py_values_out;
2785 PyObject *py_buffer;
2786 PyObject *py_needed;
2787 result = PyTuple_New(3);
2788 py_values_out = PyList_New(r->in.num_values);
2789 if (py_values_out == NULL) {
2790 return NULL;
2791 }
2792 {
2793 int values_out_cntr_1;
2794 for (values_out_cntr_1 = 0; values_out_cntr_1 < r->in.num_values; values_out_cntr_1++) {
2795 PyObject *py_values_out_1;
2796 py_values_out_1 = py_talloc_reference_ex(&QueryMultipleValue_Type, r->out.values_out, &r->out.values_out[values_out_cntr_1]);
2797 PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
2798 }
2799 }
2800 PyTuple_SetItem(result, 0, py_values_out);
2801 if (r->out.buffer == NULL) {
2802 py_buffer = Py_None;
2803 Py_INCREF(py_buffer);
2804 } else {
2805 py_buffer = PyList_New(*r->in.offered);
2806 if (py_buffer == NULL) {
2807 return NULL;
2808 }
2809 {
2810 int buffer_cntr_1;
2811 for (buffer_cntr_1 = 0; buffer_cntr_1 < *r->in.offered; buffer_cntr_1++) {
2812 PyObject *py_buffer_1;
2813 py_buffer_1 = PyInt_FromLong(r->out.buffer[buffer_cntr_1]);
2814 PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
2815 }
2816 }
2817 }
2818 PyTuple_SetItem(result, 1, py_buffer);
2819 py_needed = PyInt_FromLong(*r->out.needed);
2820 PyTuple_SetItem(result, 2, py_needed);
2821 if (!W_ERROR_IS_OK(r->out.result)) {
2822 PyErr_SetWERROR(r->out.result);
2823 return NULL;
2824 }
2825
2826 return result;
2827}
2828
2829static bool pack_py_winreg_DeleteKeyEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteKeyEx *r)
2830{
2831 PyObject *py_handle;
2832 PyObject *py_key;
2833 PyObject *py_access_mask;
2834 PyObject *py_reserved;
2835 const char *kwnames[] = {
2836 "handle", "key", "access_mask", "reserved", NULL
2837 };
2838
2839 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_DeleteKeyEx", discard_const_p(char *, kwnames), &py_handle, &py_key, &py_access_mask, &py_reserved)) {
2840 return false;
2841 }
2842
2843 r->in.handle = talloc_ptrtype(r, r->in.handle);
2844 PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
2845 if (talloc_reference(r, py_talloc_get_mem_ctx(py_handle)) == NULL) {
2846 PyErr_NoMemory();
2847 return false;
2848 }
2849 r->in.handle = (struct policy_handle *)py_talloc_get_ptr(py_handle);
2850 r->in.key = talloc_ptrtype(r, r->in.key);
2851 PY_CHECK_TYPE(&winreg_String_Type, py_key, return false;);
2852 if (talloc_reference(r, py_talloc_get_mem_ctx(py_key)) == NULL) {
2853 PyErr_NoMemory();
2854 return false;
2855 }
2856 r->in.key = (struct winreg_String *)py_talloc_get_ptr(py_key);
2857 if (PyLong_Check(py_access_mask)) {
2858 r->in.access_mask = PyLong_AsLongLong(py_access_mask);
2859 } else if (PyInt_Check(py_access_mask)) {
2860 r->in.access_mask = PyInt_AsLong(py_access_mask);
2861 } else {
2862 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
2863 PyInt_Type.tp_name, PyLong_Type.tp_name);
2864 return false;
2865 }
2866 PY_CHECK_TYPE(&PyInt_Type, py_reserved, return false;);
2867 r->in.reserved = PyInt_AsLong(py_reserved);
2868 return true;
2869}
2870
2871static PyObject *unpack_py_winreg_DeleteKeyEx_args_out(struct winreg_DeleteKeyEx *r)
2872{
2873 PyObject *result;
2874 result = Py_None;
2875 Py_INCREF(result);
2876 if (!W_ERROR_IS_OK(r->out.result)) {
2877 PyErr_SetWERROR(r->out.result);
2878 return NULL;
2879 }
2880
2881 return result;
2882}
2883
2884const struct PyNdrRpcMethodDef py_ndr_winreg_methods[] = {
2885 { "OpenHKCR", "S.OpenHKCR(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKCR_r, (py_data_pack_fn)pack_py_winreg_OpenHKCR_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKCR_args_out, 0, &ndr_table_winreg },
2886 { "OpenHKCU", "S.OpenHKCU(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKCU_r, (py_data_pack_fn)pack_py_winreg_OpenHKCU_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKCU_args_out, 1, &ndr_table_winreg },
2887 { "OpenHKLM", "S.OpenHKLM(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKLM_r, (py_data_pack_fn)pack_py_winreg_OpenHKLM_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKLM_args_out, 2, &ndr_table_winreg },
2888 { "OpenHKPD", "S.OpenHKPD(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKPD_r, (py_data_pack_fn)pack_py_winreg_OpenHKPD_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKPD_args_out, 3, &ndr_table_winreg },
2889 { "OpenHKU", "S.OpenHKU(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKU_r, (py_data_pack_fn)pack_py_winreg_OpenHKU_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKU_args_out, 4, &ndr_table_winreg },
2890 { "CloseKey", "S.CloseKey(handle) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_CloseKey_r, (py_data_pack_fn)pack_py_winreg_CloseKey_args_in, (py_data_unpack_fn)unpack_py_winreg_CloseKey_args_out, 5, &ndr_table_winreg },
2891 { "CreateKey", "S.CreateKey(handle, name, keyclass, options, access_mask, secdesc, action_taken) -> (new_handle, action_taken)", (py_dcerpc_call_fn)dcerpc_winreg_CreateKey_r, (py_data_pack_fn)pack_py_winreg_CreateKey_args_in, (py_data_unpack_fn)unpack_py_winreg_CreateKey_args_out, 6, &ndr_table_winreg },
2892 { "DeleteKey", "S.DeleteKey(handle, key) -> None", (py_dcerpc_call_fn)dcerpc_winreg_DeleteKey_r, (py_data_pack_fn)pack_py_winreg_DeleteKey_args_in, (py_data_unpack_fn)unpack_py_winreg_DeleteKey_args_out, 7, &ndr_table_winreg },
2893 { "DeleteValue", "S.DeleteValue(handle, value) -> None", (py_dcerpc_call_fn)dcerpc_winreg_DeleteValue_r, (py_data_pack_fn)pack_py_winreg_DeleteValue_args_in, (py_data_unpack_fn)unpack_py_winreg_DeleteValue_args_out, 8, &ndr_table_winreg },
2894 { "EnumKey", "S.EnumKey(handle, enum_index, name, keyclass, last_changed_time) -> (name, keyclass, last_changed_time)", (py_dcerpc_call_fn)dcerpc_winreg_EnumKey_r, (py_data_pack_fn)pack_py_winreg_EnumKey_args_in, (py_data_unpack_fn)unpack_py_winreg_EnumKey_args_out, 9, &ndr_table_winreg },
2895 { "EnumValue", "S.EnumValue(handle, enum_index, name, type, value, size, length) -> (name, type, value, size, length)", (py_dcerpc_call_fn)dcerpc_winreg_EnumValue_r, (py_data_pack_fn)pack_py_winreg_EnumValue_args_in, (py_data_unpack_fn)unpack_py_winreg_EnumValue_args_out, 10, &ndr_table_winreg },
2896 { "FlushKey", "S.FlushKey(handle) -> None", (py_dcerpc_call_fn)dcerpc_winreg_FlushKey_r, (py_data_pack_fn)pack_py_winreg_FlushKey_args_in, (py_data_unpack_fn)unpack_py_winreg_FlushKey_args_out, 11, &ndr_table_winreg },
2897 { "GetKeySecurity", "S.GetKeySecurity(handle, sec_info, sd) -> sd", (py_dcerpc_call_fn)dcerpc_winreg_GetKeySecurity_r, (py_data_pack_fn)pack_py_winreg_GetKeySecurity_args_in, (py_data_unpack_fn)unpack_py_winreg_GetKeySecurity_args_out, 12, &ndr_table_winreg },
2898 { "LoadKey", "S.LoadKey(handle, keyname, filename) -> None", (py_dcerpc_call_fn)dcerpc_winreg_LoadKey_r, (py_data_pack_fn)pack_py_winreg_LoadKey_args_in, (py_data_unpack_fn)unpack_py_winreg_LoadKey_args_out, 13, &ndr_table_winreg },
2899 { "NotifyChangeKeyValue", "S.NotifyChangeKeyValue(handle, watch_subtree, notify_filter, unknown, string1, string2, unknown2) -> None", (py_dcerpc_call_fn)dcerpc_winreg_NotifyChangeKeyValue_r, (py_data_pack_fn)pack_py_winreg_NotifyChangeKeyValue_args_in, (py_data_unpack_fn)unpack_py_winreg_NotifyChangeKeyValue_args_out, 14, &ndr_table_winreg },
2900 { "OpenKey", "S.OpenKey(parent_handle, keyname, options, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenKey_r, (py_data_pack_fn)pack_py_winreg_OpenKey_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenKey_args_out, 15, &ndr_table_winreg },
2901 { "QueryInfoKey", "S.QueryInfoKey(handle, classname) -> (classname, num_subkeys, max_subkeylen, max_classlen, num_values, max_valnamelen, max_valbufsize, secdescsize, last_changed_time)", (py_dcerpc_call_fn)dcerpc_winreg_QueryInfoKey_r, (py_data_pack_fn)pack_py_winreg_QueryInfoKey_args_in, (py_data_unpack_fn)unpack_py_winreg_QueryInfoKey_args_out, 16, &ndr_table_winreg },
2902 { "QueryValue", "S.QueryValue(handle, value_name, type, data, data_size, data_length) -> (type, data, data_size, data_length)", (py_dcerpc_call_fn)dcerpc_winreg_QueryValue_r, (py_data_pack_fn)pack_py_winreg_QueryValue_args_in, (py_data_unpack_fn)unpack_py_winreg_QueryValue_args_out, 17, &ndr_table_winreg },
2903 { "ReplaceKey", "S.ReplaceKey(handle, subkey, new_file, old_file) -> None", (py_dcerpc_call_fn)dcerpc_winreg_ReplaceKey_r, (py_data_pack_fn)pack_py_winreg_ReplaceKey_args_in, (py_data_unpack_fn)unpack_py_winreg_ReplaceKey_args_out, 18, &ndr_table_winreg },
2904 { "RestoreKey", "S.RestoreKey(handle, filename, flags) -> None", (py_dcerpc_call_fn)dcerpc_winreg_RestoreKey_r, (py_data_pack_fn)pack_py_winreg_RestoreKey_args_in, (py_data_unpack_fn)unpack_py_winreg_RestoreKey_args_out, 19, &ndr_table_winreg },
2905 { "SaveKey", "S.SaveKey(handle, filename, sec_attrib) -> None", (py_dcerpc_call_fn)dcerpc_winreg_SaveKey_r, (py_data_pack_fn)pack_py_winreg_SaveKey_args_in, (py_data_unpack_fn)unpack_py_winreg_SaveKey_args_out, 20, &ndr_table_winreg },
2906 { "SetKeySecurity", "S.SetKeySecurity(handle, sec_info, sd) -> None", (py_dcerpc_call_fn)dcerpc_winreg_SetKeySecurity_r, (py_data_pack_fn)pack_py_winreg_SetKeySecurity_args_in, (py_data_unpack_fn)unpack_py_winreg_SetKeySecurity_args_out, 21, &ndr_table_winreg },
2907 { "SetValue", "S.SetValue(handle, name, type, data) -> None", (py_dcerpc_call_fn)dcerpc_winreg_SetValue_r, (py_data_pack_fn)pack_py_winreg_SetValue_args_in, (py_data_unpack_fn)unpack_py_winreg_SetValue_args_out, 22, &ndr_table_winreg },
2908 { "UnLoadKey", "S.UnLoadKey(handle, subkey) -> None", (py_dcerpc_call_fn)dcerpc_winreg_UnLoadKey_r, (py_data_pack_fn)pack_py_winreg_UnLoadKey_args_in, (py_data_unpack_fn)unpack_py_winreg_UnLoadKey_args_out, 23, &ndr_table_winreg },
2909 { "InitiateSystemShutdown", "S.InitiateSystemShutdown(hostname, message, timeout, force_apps, do_reboot) -> None", (py_dcerpc_call_fn)dcerpc_winreg_InitiateSystemShutdown_r, (py_data_pack_fn)pack_py_winreg_InitiateSystemShutdown_args_in, (py_data_unpack_fn)unpack_py_winreg_InitiateSystemShutdown_args_out, 24, &ndr_table_winreg },
2910 { "AbortSystemShutdown", "S.AbortSystemShutdown(server) -> None", (py_dcerpc_call_fn)dcerpc_winreg_AbortSystemShutdown_r, (py_data_pack_fn)pack_py_winreg_AbortSystemShutdown_args_in, (py_data_unpack_fn)unpack_py_winreg_AbortSystemShutdown_args_out, 25, &ndr_table_winreg },
2911 { "GetVersion", "S.GetVersion(handle) -> version", (py_dcerpc_call_fn)dcerpc_winreg_GetVersion_r, (py_data_pack_fn)pack_py_winreg_GetVersion_args_in, (py_data_unpack_fn)unpack_py_winreg_GetVersion_args_out, 26, &ndr_table_winreg },
2912 { "OpenHKCC", "S.OpenHKCC(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKCC_r, (py_data_pack_fn)pack_py_winreg_OpenHKCC_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKCC_args_out, 27, &ndr_table_winreg },
2913 { "OpenHKDD", "S.OpenHKDD(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKDD_r, (py_data_pack_fn)pack_py_winreg_OpenHKDD_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKDD_args_out, 28, &ndr_table_winreg },
2914 { "QueryMultipleValues", "S.QueryMultipleValues(key_handle, values_in, buffer) -> (values_out, buffer)", (py_dcerpc_call_fn)dcerpc_winreg_QueryMultipleValues_r, (py_data_pack_fn)pack_py_winreg_QueryMultipleValues_args_in, (py_data_unpack_fn)unpack_py_winreg_QueryMultipleValues_args_out, 29, &ndr_table_winreg },
2915 { "InitiateSystemShutdownEx", "S.InitiateSystemShutdownEx(hostname, message, timeout, force_apps, do_reboot, reason) -> None", (py_dcerpc_call_fn)dcerpc_winreg_InitiateSystemShutdownEx_r, (py_data_pack_fn)pack_py_winreg_InitiateSystemShutdownEx_args_in, (py_data_unpack_fn)unpack_py_winreg_InitiateSystemShutdownEx_args_out, 30, &ndr_table_winreg },
2916 { "SaveKeyEx", "S.SaveKeyEx(handle, filename, sec_attrib, flags) -> None", (py_dcerpc_call_fn)dcerpc_winreg_SaveKeyEx_r, (py_data_pack_fn)pack_py_winreg_SaveKeyEx_args_in, (py_data_unpack_fn)unpack_py_winreg_SaveKeyEx_args_out, 31, &ndr_table_winreg },
2917 { "OpenHKPT", "S.OpenHKPT(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKPT_r, (py_data_pack_fn)pack_py_winreg_OpenHKPT_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKPT_args_out, 32, &ndr_table_winreg },
2918 { "OpenHKPN", "S.OpenHKPN(system_name, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_winreg_OpenHKPN_r, (py_data_pack_fn)pack_py_winreg_OpenHKPN_args_in, (py_data_unpack_fn)unpack_py_winreg_OpenHKPN_args_out, 33, &ndr_table_winreg },
2919 { "QueryMultipleValues2", "S.QueryMultipleValues2(key_handle, values_in, buffer) -> (values_out, buffer, needed)", (py_dcerpc_call_fn)dcerpc_winreg_QueryMultipleValues2_r, (py_data_pack_fn)pack_py_winreg_QueryMultipleValues2_args_in, (py_data_unpack_fn)unpack_py_winreg_QueryMultipleValues2_args_out, 34, &ndr_table_winreg },
2920 { "DeleteKeyEx", "S.DeleteKeyEx(handle, key, access_mask, reserved) -> None", (py_dcerpc_call_fn)dcerpc_winreg_DeleteKeyEx_r, (py_data_pack_fn)pack_py_winreg_DeleteKeyEx_args_in, (py_data_unpack_fn)unpack_py_winreg_DeleteKeyEx_args_out, 35, &ndr_table_winreg },
2921 { NULL }
2922};
2923
2924static PyObject *interface_winreg_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2925{
2926 return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_winreg);
2927}
2928
2929#define PY_DOC_WINREG "Remote Registry Service"
2930static PyTypeObject winreg_InterfaceType = {
2931 PyObject_HEAD_INIT(NULL) 0,
2932 .tp_name = "winreg.winreg",
2933 .tp_basicsize = sizeof(dcerpc_InterfaceObject),
2934 .tp_doc = "winreg(binding, lp_ctx=None, credentials=None) -> connection\n"
2935"\n"
2936"binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
2937"lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
2938"credentials should be a credentials.Credentials object.\n\n"PY_DOC_WINREG,
2939 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2940 .tp_new = interface_winreg_new,
2941};
2942
2943static PyMethodDef winreg_methods[] = {
2944 { NULL, NULL, 0, NULL }
2945};
2946
2947void initwinreg(void)
2948{
2949 PyObject *m;
2950 PyObject *dep_samba_dcerpc_security;
2951 PyObject *dep_talloc;
2952 PyObject *dep_samba_dcerpc_misc;
2953 PyObject *dep_samba_dcerpc_base;
2954 PyObject *dep_samba_dcerpc_lsa;
2955
2956 dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
2957 if (dep_samba_dcerpc_security == NULL)
2958 return;
2959
2960 dep_talloc = PyImport_ImportModule("talloc");
2961 if (dep_talloc == NULL)
2962 return;
2963
2964 dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
2965 if (dep_samba_dcerpc_misc == NULL)
2966 return;
2967
2968 dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
2969 if (dep_samba_dcerpc_base == NULL)
2970 return;
2971
2972 dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
2973 if (dep_samba_dcerpc_lsa == NULL)
2974 return;
2975
2976 lsa_StringLarge_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "StringLarge");
2977 if (lsa_StringLarge_Type == NULL)
2978 return;
2979
2980 policy_handle_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "policy_handle");
2981 if (policy_handle_Type == NULL)
2982 return;
2983
2984 Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
2985 if (Object_Type == NULL)
2986 return;
2987
2988 ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
2989 if (ClientConnection_Type == NULL)
2990 return;
2991
2992 winreg_String_Type.tp_base = Object_Type;
2993
2994 KeySecurityData_Type.tp_base = Object_Type;
2995
2996 winreg_SecBuf_Type.tp_base = Object_Type;
2997
2998 winreg_StringBuf_Type.tp_base = Object_Type;
2999
3000 winreg_ValNameBuf_Type.tp_base = Object_Type;
3001
3002 KeySecurityAttribute_Type.tp_base = Object_Type;
3003
3004 QueryMultipleValue_Type.tp_base = Object_Type;
3005
3006 winreg_InterfaceType.tp_base = ClientConnection_Type;
3007
3008 if (PyType_Ready(&winreg_String_Type) < 0)
3009 return;
3010 if (PyType_Ready(&KeySecurityData_Type) < 0)
3011 return;
3012 if (PyType_Ready(&winreg_SecBuf_Type) < 0)
3013 return;
3014 if (PyType_Ready(&winreg_StringBuf_Type) < 0)
3015 return;
3016 if (PyType_Ready(&winreg_ValNameBuf_Type) < 0)
3017 return;
3018 if (PyType_Ready(&KeySecurityAttribute_Type) < 0)
3019 return;
3020 if (PyType_Ready(&QueryMultipleValue_Type) < 0)
3021 return;
3022 if (PyType_Ready(&winreg_InterfaceType) < 0)
3023 return;
3024 if (!PyInterface_AddNdrRpcMethods(&winreg_InterfaceType, py_ndr_winreg_methods))
3025 return;
3026
3027#ifdef PY_STRING_PATCH
3028 PY_STRING_PATCH(&winreg_String_Type);
3029#endif
3030#ifdef PY_KEYSECURITYDATA_PATCH
3031 PY_KEYSECURITYDATA_PATCH(&KeySecurityData_Type);
3032#endif
3033#ifdef PY_SECBUF_PATCH
3034 PY_SECBUF_PATCH(&winreg_SecBuf_Type);
3035#endif
3036#ifdef PY_STRINGBUF_PATCH
3037 PY_STRINGBUF_PATCH(&winreg_StringBuf_Type);
3038#endif
3039#ifdef PY_VALNAMEBUF_PATCH
3040 PY_VALNAMEBUF_PATCH(&winreg_ValNameBuf_Type);
3041#endif
3042#ifdef PY_KEYSECURITYATTRIBUTE_PATCH
3043 PY_KEYSECURITYATTRIBUTE_PATCH(&KeySecurityAttribute_Type);
3044#endif
3045#ifdef PY_QUERYMULTIPLEVALUE_PATCH
3046 PY_QUERYMULTIPLEVALUE_PATCH(&QueryMultipleValue_Type);
3047#endif
3048#ifdef PY_WINREG_PATCH
3049 PY_WINREG_PATCH(&winreg_InterfaceType);
3050#endif
3051
3052 m = Py_InitModule3("winreg", winreg_methods, "winreg DCE/RPC");
3053 if (m == NULL)
3054 return;
3055
3056 PyModule_AddObject(m, "REG_KEY_ALL", PyInt_FromLong((STANDARD_RIGHTS_REQUIRED_ACCESS|REG_KEY_READ|REG_KEY_WRITE|KEY_CREATE_LINK)));
3057 PyModule_AddObject(m, "KEY_QUERY_VALUE", PyInt_FromLong(KEY_QUERY_VALUE));
3058 PyModule_AddObject(m, "KEY_WOW64_32KEY", PyInt_FromLong(KEY_WOW64_32KEY));
3059 PyModule_AddObject(m, "KEY_NOTIFY", PyInt_FromLong(KEY_NOTIFY));
3060 PyModule_AddObject(m, "REG_ACTION_NONE", PyInt_FromLong(REG_ACTION_NONE));
3061 PyModule_AddObject(m, "REG_OPTION_BACKUP_RESTORE", PyInt_FromLong(REG_OPTION_BACKUP_RESTORE));
3062 PyModule_AddObject(m, "KEY_ENUMERATE_SUB_KEYS", PyInt_FromLong(KEY_ENUMERATE_SUB_KEYS));
3063 PyModule_AddObject(m, "REG_KEY_READ", PyInt_FromLong((STANDARD_RIGHTS_READ_ACCESS|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|KEY_NOTIFY)));
3064 PyModule_AddObject(m, "REG_NOTIFY_CHANGE_ATTRIBUTES", PyInt_FromLong(REG_NOTIFY_CHANGE_ATTRIBUTES));
3065 PyModule_AddObject(m, "REG_OPENED_EXISTING_KEY", PyInt_FromLong(REG_OPENED_EXISTING_KEY));
3066 PyModule_AddObject(m, "REG_NOTIFY_CHANGE_SECURITY", PyInt_FromLong(REG_NOTIFY_CHANGE_SECURITY));
3067 PyModule_AddObject(m, "KEY_CREATE_LINK", PyInt_FromLong(KEY_CREATE_LINK));
3068 PyModule_AddObject(m, "REG_KEY_EXECUTE", PyInt_FromLong(REG_KEY_READ));
3069 PyModule_AddObject(m, "REG_FORCE_RESTORE", PyInt_FromLong(REG_FORCE_RESTORE));
3070 PyModule_AddObject(m, "REG_NOTIFY_CHANGE_LAST_SET", PyInt_FromLong(REG_NOTIFY_CHANGE_LAST_SET));
3071 PyModule_AddObject(m, "REG_NO_LAZY_FLUSH", PyInt_FromLong(REG_NO_LAZY_FLUSH));
3072 PyModule_AddObject(m, "REG_KEY_WRITE", PyInt_FromLong((STANDARD_RIGHTS_WRITE_ACCESS|KEY_SET_VALUE|KEY_CREATE_SUB_KEY)));
3073 PyModule_AddObject(m, "KEY_CREATE_SUB_KEY", PyInt_FromLong(KEY_CREATE_SUB_KEY));
3074 PyModule_AddObject(m, "REG_OPTION_NON_VOLATILE", PyInt_FromLong(0x00000000));
3075 PyModule_AddObject(m, "KEY_SET_VALUE", PyInt_FromLong(KEY_SET_VALUE));
3076 PyModule_AddObject(m, "REG_CREATED_NEW_KEY", PyInt_FromLong(REG_CREATED_NEW_KEY));
3077 PyModule_AddObject(m, "REG_OPTION_CREATE_LINK", PyInt_FromLong(REG_OPTION_CREATE_LINK));
3078 PyModule_AddObject(m, "REG_NOTIFY_CHANGE_NAME", PyInt_FromLong(REG_NOTIFY_CHANGE_NAME));
3079 PyModule_AddObject(m, "REG_OPTION_OPEN_LINK", PyInt_FromLong(REG_OPTION_OPEN_LINK));
3080 PyModule_AddObject(m, "REG_OPTION_VOLATILE", PyInt_FromLong(REG_OPTION_VOLATILE));
3081 PyModule_AddObject(m, "KEY_WOW64_64KEY", PyInt_FromLong(KEY_WOW64_64KEY));
3082 PyModule_AddObject(m, "REG_WHOLE_HIVE_VOLATILE", PyInt_FromLong(REG_WHOLE_HIVE_VOLATILE));
3083 PyModule_AddObject(m, "REG_REFRESH_HIVE", PyInt_FromLong(REG_REFRESH_HIVE));
3084 Py_INCREF((PyObject *)(void *)&winreg_String_Type);
3085 PyModule_AddObject(m, "String", (PyObject *)(void *)&winreg_String_Type);
3086 Py_INCREF((PyObject *)(void *)&KeySecurityData_Type);
3087 PyModule_AddObject(m, "KeySecurityData", (PyObject *)(void *)&KeySecurityData_Type);
3088 Py_INCREF((PyObject *)(void *)&winreg_SecBuf_Type);
3089 PyModule_AddObject(m, "SecBuf", (PyObject *)(void *)&winreg_SecBuf_Type);
3090 Py_INCREF((PyObject *)(void *)&winreg_StringBuf_Type);
3091 PyModule_AddObject(m, "StringBuf", (PyObject *)(void *)&winreg_StringBuf_Type);
3092 Py_INCREF((PyObject *)(void *)&winreg_ValNameBuf_Type);
3093 PyModule_AddObject(m, "ValNameBuf", (PyObject *)(void *)&winreg_ValNameBuf_Type);
3094 Py_INCREF((PyObject *)(void *)&KeySecurityAttribute_Type);
3095 PyModule_AddObject(m, "KeySecurityAttribute", (PyObject *)(void *)&KeySecurityAttribute_Type);
3096 Py_INCREF((PyObject *)(void *)&QueryMultipleValue_Type);
3097 PyModule_AddObject(m, "QueryMultipleValue", (PyObject *)(void *)&QueryMultipleValue_Type);
3098 Py_INCREF((PyObject *)(void *)&winreg_InterfaceType);
3099 PyModule_AddObject(m, "winreg", (PyObject *)(void *)&winreg_InterfaceType);
3100#ifdef PY_MOD_WINREG_PATCH
3101 PY_MOD_WINREG_PATCH(m);
3102#endif
3103
3104}
Note: See TracBrowser for help on using the repository browser.