Line data Source code
1 :
2 : /* Python wrapper functions auto-generated by pidl */
3 : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
4 : #include "lib/replace/system/python.h"
5 : #include "python/py3compat.h"
6 : #include "includes.h"
7 : #include "python/modules.h"
8 : #include <pytalloc.h>
9 : #include "librpc/rpc/pyrpc.h"
10 : #include "librpc/rpc/pyrpc_util.h"
11 : #include "bin/default/librpc/gen_ndr/ndr_winreg.h"
12 : #include "bin/default/librpc/gen_ndr/ndr_winreg_c.h"
13 :
14 : /*
15 : * Suppress compiler warnings if the generated code does not call these
16 : * functions
17 : */
18 : #ifndef _MAYBE_UNUSED_
19 : #ifdef __has_attribute
20 : #if __has_attribute(unused)
21 : #define _MAYBE_UNUSED_ __attribute__ ((unused))
22 : #else
23 : #define _MAYBE_UNUSED_
24 : #endif
25 : #endif
26 : #endif
27 : /*
28 : * These functions are here to ensure they can be optimized out by
29 : * the compiler based on the constant input values
30 : */
31 :
32 3 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 3 : switch (var_size) {
35 0 : case 8:
36 0 : return UINT64_MAX;
37 3 : case 4:
38 3 : return UINT32_MAX;
39 0 : case 2:
40 0 : return UINT16_MAX;
41 0 : case 1:
42 0 : return UINT8_MAX;
43 : }
44 :
45 0 : return 0;
46 : }
47 :
48 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
49 : {
50 : switch (var_size) {
51 : case 8:
52 : return INT64_MAX;
53 : case 4:
54 : return INT32_MAX;
55 : case 2:
56 : return INT16_MAX;
57 : case 1:
58 : return INT8_MAX;
59 : }
60 :
61 : return 0;
62 : }
63 :
64 : #include "librpc/gen_ndr/lsa.h"
65 : #include "librpc/gen_ndr/security.h"
66 : #include "librpc/gen_ndr/misc.h"
67 : static PyTypeObject winreg_String_Type;
68 : static PyTypeObject KeySecurityData_Type;
69 : static PyTypeObject winreg_SecBuf_Type;
70 : static PyTypeObject winreg_StringBuf_Type;
71 : static PyTypeObject winreg_ValNameBuf_Type;
72 : static PyTypeObject KeySecurityAttribute_Type;
73 : static PyTypeObject QueryMultipleValue_Type;
74 : static PyTypeObject winreg_InterfaceType;
75 : static PyTypeObject winreg_OpenHKCR_Type;
76 : static PyTypeObject winreg_OpenHKCU_Type;
77 : static PyTypeObject winreg_OpenHKLM_Type;
78 : static PyTypeObject winreg_OpenHKPD_Type;
79 : static PyTypeObject winreg_OpenHKU_Type;
80 : static PyTypeObject winreg_CloseKey_Type;
81 : static PyTypeObject winreg_CreateKey_Type;
82 : static PyTypeObject winreg_DeleteKey_Type;
83 : static PyTypeObject winreg_DeleteValue_Type;
84 : static PyTypeObject winreg_EnumKey_Type;
85 : static PyTypeObject winreg_EnumValue_Type;
86 : static PyTypeObject winreg_FlushKey_Type;
87 : static PyTypeObject winreg_GetKeySecurity_Type;
88 : static PyTypeObject winreg_LoadKey_Type;
89 : static PyTypeObject winreg_NotifyChangeKeyValue_Type;
90 : static PyTypeObject winreg_OpenKey_Type;
91 : static PyTypeObject winreg_QueryInfoKey_Type;
92 : static PyTypeObject winreg_QueryValue_Type;
93 : static PyTypeObject winreg_ReplaceKey_Type;
94 : static PyTypeObject winreg_RestoreKey_Type;
95 : static PyTypeObject winreg_SaveKey_Type;
96 : static PyTypeObject winreg_SetKeySecurity_Type;
97 : static PyTypeObject winreg_SetValue_Type;
98 : static PyTypeObject winreg_UnLoadKey_Type;
99 : static PyTypeObject winreg_InitiateSystemShutdown_Type;
100 : static PyTypeObject winreg_AbortSystemShutdown_Type;
101 : static PyTypeObject winreg_GetVersion_Type;
102 : static PyTypeObject winreg_OpenHKCC_Type;
103 : static PyTypeObject winreg_OpenHKDD_Type;
104 : static PyTypeObject winreg_QueryMultipleValues_Type;
105 : static PyTypeObject winreg_InitiateSystemShutdownEx_Type;
106 : static PyTypeObject winreg_SaveKeyEx_Type;
107 : static PyTypeObject winreg_OpenHKPT_Type;
108 : static PyTypeObject winreg_OpenHKPN_Type;
109 : static PyTypeObject winreg_QueryMultipleValues2_Type;
110 : static PyTypeObject winreg_DeleteKeyEx_Type;
111 :
112 : static PyTypeObject *BaseObject_Type;
113 : static PyTypeObject *policy_handle_Type;
114 : static PyTypeObject *lsa_StringLarge_Type;
115 : static PyTypeObject *ClientConnection_Type;
116 : static PyTypeObject *ndr_syntax_id_Type;
117 :
118 0 : static PyObject *py_winreg_String_get_name_len(PyObject *obj, void *closure)
119 : {
120 0 : struct winreg_String *object = pytalloc_get_ptr(obj);
121 : PyObject *py_name_len;
122 0 : py_name_len = PyLong_FromLong((uint16_t)(object->name_len));
123 0 : return py_name_len;
124 : }
125 :
126 0 : static int py_winreg_String_set_name_len(PyObject *py_obj, PyObject *value, void *closure)
127 : {
128 0 : struct winreg_String *object = pytalloc_get_ptr(py_obj);
129 0 : if (value == NULL) {
130 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name_len");
131 0 : return -1;
132 : }
133 : {
134 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->name_len));
135 0 : if (PyLong_Check(value)) {
136 : unsigned long long test_var;
137 0 : test_var = PyLong_AsUnsignedLongLong(value);
138 0 : if (PyErr_Occurred() != NULL) {
139 0 : return -1;
140 : }
141 0 : if (test_var > uint_max) {
142 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
143 : PyLong_Type.tp_name, uint_max, test_var);
144 0 : return -1;
145 : }
146 0 : object->name_len = test_var;
147 : } else {
148 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
149 : PyLong_Type.tp_name);
150 0 : return -1;
151 : }
152 : }
153 0 : return 0;
154 : }
155 :
156 0 : static PyObject *py_winreg_String_get_name_size(PyObject *obj, void *closure)
157 : {
158 0 : struct winreg_String *object = pytalloc_get_ptr(obj);
159 : PyObject *py_name_size;
160 0 : py_name_size = PyLong_FromLong((uint16_t)(object->name_size));
161 0 : return py_name_size;
162 : }
163 :
164 0 : static int py_winreg_String_set_name_size(PyObject *py_obj, PyObject *value, void *closure)
165 : {
166 0 : struct winreg_String *object = pytalloc_get_ptr(py_obj);
167 0 : if (value == NULL) {
168 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name_size");
169 0 : return -1;
170 : }
171 : {
172 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->name_size));
173 0 : if (PyLong_Check(value)) {
174 : unsigned long long test_var;
175 0 : test_var = PyLong_AsUnsignedLongLong(value);
176 0 : if (PyErr_Occurred() != NULL) {
177 0 : return -1;
178 : }
179 0 : if (test_var > uint_max) {
180 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
181 : PyLong_Type.tp_name, uint_max, test_var);
182 0 : return -1;
183 : }
184 0 : object->name_size = test_var;
185 : } else {
186 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
187 : PyLong_Type.tp_name);
188 0 : return -1;
189 : }
190 : }
191 0 : return 0;
192 : }
193 :
194 0 : static PyObject *py_winreg_String_get_name(PyObject *obj, void *closure)
195 : {
196 0 : struct winreg_String *object = pytalloc_get_ptr(obj);
197 : PyObject *py_name;
198 0 : if (object->name == NULL) {
199 0 : Py_RETURN_NONE;
200 : }
201 0 : if (object->name == NULL) {
202 0 : py_name = Py_None;
203 0 : Py_INCREF(py_name);
204 : } else {
205 0 : if (object->name == NULL) {
206 0 : py_name = Py_None;
207 0 : Py_INCREF(py_name);
208 : } else {
209 0 : py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
210 : }
211 : }
212 0 : return py_name;
213 : }
214 :
215 0 : static int py_winreg_String_set_name(PyObject *py_obj, PyObject *value, void *closure)
216 : {
217 0 : struct winreg_String *object = pytalloc_get_ptr(py_obj);
218 0 : if (value == NULL) {
219 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name");
220 0 : return -1;
221 : }
222 0 : if (value == Py_None) {
223 0 : object->name = NULL;
224 : } else {
225 0 : object->name = NULL;
226 : {
227 : const char *test_str;
228 : const char *talloc_str;
229 0 : PyObject *unicode = NULL;
230 0 : if (PyUnicode_Check(value)) {
231 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
232 0 : if (unicode == NULL) {
233 0 : return -1;
234 : }
235 0 : test_str = PyBytes_AS_STRING(unicode);
236 0 : } else if (PyBytes_Check(value)) {
237 0 : test_str = PyBytes_AS_STRING(value);
238 : } else {
239 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
240 0 : return -1;
241 : }
242 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
243 0 : if (unicode != NULL) {
244 0 : Py_DECREF(unicode);
245 : }
246 0 : if (talloc_str == NULL) {
247 0 : PyErr_NoMemory();
248 0 : return -1;
249 : }
250 0 : object->name = talloc_str;
251 : }
252 : }
253 0 : return 0;
254 : }
255 :
256 : static PyGetSetDef py_winreg_String_getsetters[] = {
257 : {
258 : .name = discard_const_p(char, "name_len"),
259 : .get = py_winreg_String_get_name_len,
260 : .set = py_winreg_String_set_name_len,
261 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
262 : },
263 : {
264 : .name = discard_const_p(char, "name_size"),
265 : .get = py_winreg_String_get_name_size,
266 : .set = py_winreg_String_set_name_size,
267 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
268 : },
269 : {
270 : .name = discard_const_p(char, "name"),
271 : .get = py_winreg_String_get_name,
272 : .set = py_winreg_String_set_name,
273 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
274 : },
275 : { .name = NULL }
276 : };
277 :
278 1 : static PyObject *py_winreg_String_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
279 : {
280 1 : return pytalloc_new(struct winreg_String, type);
281 : }
282 :
283 0 : static PyObject *py_winreg_String_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
284 : {
285 0 : struct winreg_String *object = pytalloc_get_ptr(py_obj);
286 0 : PyObject *ret = NULL;
287 : DATA_BLOB blob;
288 : enum ndr_err_code err;
289 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
290 0 : if (tmp_ctx == NULL) {
291 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
292 0 : return NULL;
293 : }
294 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_winreg_String);
295 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
296 0 : TALLOC_FREE(tmp_ctx);
297 0 : PyErr_SetNdrError(err);
298 0 : return NULL;
299 : }
300 :
301 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
302 0 : TALLOC_FREE(tmp_ctx);
303 0 : return ret;
304 : }
305 :
306 0 : static PyObject *py_winreg_String_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
307 : {
308 0 : struct winreg_String *object = pytalloc_get_ptr(py_obj);
309 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
310 0 : Py_ssize_t blob_length = 0;
311 : enum ndr_err_code err;
312 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
313 0 : PyObject *allow_remaining_obj = NULL;
314 0 : bool allow_remaining = false;
315 :
316 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
317 : discard_const_p(char *, kwnames),
318 : &blob.data, &blob_length,
319 : &allow_remaining_obj)) {
320 0 : return NULL;
321 : }
322 0 : blob.length = blob_length;
323 :
324 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
325 0 : allow_remaining = true;
326 : }
327 :
328 0 : if (allow_remaining) {
329 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_winreg_String);
330 : } else {
331 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_winreg_String);
332 : }
333 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
334 0 : PyErr_SetNdrError(err);
335 0 : return NULL;
336 : }
337 :
338 0 : Py_RETURN_NONE;
339 : }
340 :
341 0 : static PyObject *py_winreg_String_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
342 : {
343 0 : struct winreg_String *object = pytalloc_get_ptr(py_obj);
344 : PyObject *ret;
345 : char *retstr;
346 :
347 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_winreg_String, "winreg_String", object);
348 0 : ret = PyUnicode_FromString(retstr);
349 0 : talloc_free(retstr);
350 :
351 0 : return ret;
352 : }
353 :
354 : static PyMethodDef py_winreg_String_methods[] = {
355 : { "__ndr_pack__", (PyCFunction)py_winreg_String_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
356 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_String_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
357 : { "__ndr_print__", (PyCFunction)py_winreg_String_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
358 : { NULL, NULL, 0, NULL }
359 : };
360 :
361 :
362 : static PyTypeObject winreg_String_Type = {
363 : PyVarObject_HEAD_INIT(NULL, 0)
364 : .tp_name = "winreg.String",
365 : .tp_getset = py_winreg_String_getsetters,
366 : .tp_methods = py_winreg_String_methods,
367 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
368 : .tp_new = py_winreg_String_new,
369 : };
370 :
371 :
372 0 : static PyObject *py_KeySecurityData_get_data(PyObject *obj, void *closure)
373 : {
374 0 : struct KeySecurityData *object = pytalloc_get_ptr(obj);
375 : PyObject *py_data;
376 0 : if (object->data == NULL) {
377 0 : Py_RETURN_NONE;
378 : }
379 0 : if (object->data == NULL) {
380 0 : py_data = Py_None;
381 0 : Py_INCREF(py_data);
382 : } else {
383 0 : py_data = PyList_New(object->len);
384 0 : if (py_data == NULL) {
385 0 : return NULL;
386 : }
387 : {
388 : int data_cntr_1;
389 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->len); data_cntr_1++) {
390 : PyObject *py_data_1;
391 0 : py_data_1 = PyLong_FromLong((uint16_t)((object->data)[data_cntr_1]));
392 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
393 : }
394 : }
395 : }
396 0 : return py_data;
397 : }
398 :
399 0 : static int py_KeySecurityData_set_data(PyObject *py_obj, PyObject *value, void *closure)
400 : {
401 0 : struct KeySecurityData *object = pytalloc_get_ptr(py_obj);
402 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->data));
403 0 : if (value == NULL) {
404 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
405 0 : return -1;
406 : }
407 0 : if (value == Py_None) {
408 0 : object->data = NULL;
409 : } else {
410 0 : object->data = NULL;
411 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
412 : {
413 : int data_cntr_1;
414 0 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
415 0 : if (!object->data) { return -1; }
416 0 : talloc_set_name_const(object->data, "ARRAY: object->data");
417 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
418 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
419 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->data)[data_cntr_1]");
420 0 : return -1;
421 : }
422 : {
423 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->data)[data_cntr_1]));
424 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
425 : unsigned long long test_var;
426 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
427 0 : if (PyErr_Occurred() != NULL) {
428 0 : return -1;
429 : }
430 0 : if (test_var > uint_max) {
431 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
432 : PyLong_Type.tp_name, uint_max, test_var);
433 0 : return -1;
434 : }
435 0 : (object->data)[data_cntr_1] = test_var;
436 : } else {
437 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
438 : PyLong_Type.tp_name);
439 0 : return -1;
440 : }
441 : }
442 : }
443 : }
444 : }
445 0 : return 0;
446 : }
447 :
448 0 : static PyObject *py_KeySecurityData_get_size(PyObject *obj, void *closure)
449 : {
450 0 : struct KeySecurityData *object = pytalloc_get_ptr(obj);
451 : PyObject *py_size;
452 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)(object->size));
453 0 : return py_size;
454 : }
455 :
456 0 : static int py_KeySecurityData_set_size(PyObject *py_obj, PyObject *value, void *closure)
457 : {
458 0 : struct KeySecurityData *object = pytalloc_get_ptr(py_obj);
459 0 : if (value == NULL) {
460 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
461 0 : return -1;
462 : }
463 : {
464 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
465 0 : if (PyLong_Check(value)) {
466 : unsigned long long test_var;
467 0 : test_var = PyLong_AsUnsignedLongLong(value);
468 0 : if (PyErr_Occurred() != NULL) {
469 0 : return -1;
470 : }
471 0 : if (test_var > uint_max) {
472 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
473 : PyLong_Type.tp_name, uint_max, test_var);
474 0 : return -1;
475 : }
476 0 : object->size = test_var;
477 : } else {
478 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
479 : PyLong_Type.tp_name);
480 0 : return -1;
481 : }
482 : }
483 0 : return 0;
484 : }
485 :
486 0 : static PyObject *py_KeySecurityData_get_len(PyObject *obj, void *closure)
487 : {
488 0 : struct KeySecurityData *object = pytalloc_get_ptr(obj);
489 : PyObject *py_len;
490 0 : py_len = PyLong_FromUnsignedLongLong((uint32_t)(object->len));
491 0 : return py_len;
492 : }
493 :
494 0 : static int py_KeySecurityData_set_len(PyObject *py_obj, PyObject *value, void *closure)
495 : {
496 0 : struct KeySecurityData *object = pytalloc_get_ptr(py_obj);
497 0 : if (value == NULL) {
498 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->len");
499 0 : return -1;
500 : }
501 : {
502 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->len));
503 0 : if (PyLong_Check(value)) {
504 : unsigned long long test_var;
505 0 : test_var = PyLong_AsUnsignedLongLong(value);
506 0 : if (PyErr_Occurred() != NULL) {
507 0 : return -1;
508 : }
509 0 : if (test_var > uint_max) {
510 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
511 : PyLong_Type.tp_name, uint_max, test_var);
512 0 : return -1;
513 : }
514 0 : object->len = test_var;
515 : } else {
516 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
517 : PyLong_Type.tp_name);
518 0 : return -1;
519 : }
520 : }
521 0 : return 0;
522 : }
523 :
524 : static PyGetSetDef py_KeySecurityData_getsetters[] = {
525 : {
526 : .name = discard_const_p(char, "data"),
527 : .get = py_KeySecurityData_get_data,
528 : .set = py_KeySecurityData_set_data,
529 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
530 : },
531 : {
532 : .name = discard_const_p(char, "size"),
533 : .get = py_KeySecurityData_get_size,
534 : .set = py_KeySecurityData_set_size,
535 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
536 : },
537 : {
538 : .name = discard_const_p(char, "len"),
539 : .get = py_KeySecurityData_get_len,
540 : .set = py_KeySecurityData_set_len,
541 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
542 : },
543 : { .name = NULL }
544 : };
545 :
546 0 : static PyObject *py_KeySecurityData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
547 : {
548 0 : return pytalloc_new(struct KeySecurityData, type);
549 : }
550 :
551 :
552 : static PyTypeObject KeySecurityData_Type = {
553 : PyVarObject_HEAD_INIT(NULL, 0)
554 : .tp_name = "winreg.KeySecurityData",
555 : .tp_getset = py_KeySecurityData_getsetters,
556 : .tp_methods = NULL,
557 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
558 : .tp_new = py_KeySecurityData_new,
559 : };
560 :
561 :
562 0 : static PyObject *py_winreg_SecBuf_get_length(PyObject *obj, void *closure)
563 : {
564 0 : struct winreg_SecBuf *object = pytalloc_get_ptr(obj);
565 : PyObject *py_length;
566 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)(object->length));
567 0 : return py_length;
568 : }
569 :
570 0 : static int py_winreg_SecBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
571 : {
572 0 : struct winreg_SecBuf *object = pytalloc_get_ptr(py_obj);
573 0 : if (value == NULL) {
574 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->length");
575 0 : return -1;
576 : }
577 : {
578 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
579 0 : if (PyLong_Check(value)) {
580 : unsigned long long test_var;
581 0 : test_var = PyLong_AsUnsignedLongLong(value);
582 0 : if (PyErr_Occurred() != NULL) {
583 0 : return -1;
584 : }
585 0 : if (test_var > uint_max) {
586 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
587 : PyLong_Type.tp_name, uint_max, test_var);
588 0 : return -1;
589 : }
590 0 : object->length = test_var;
591 : } else {
592 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
593 : PyLong_Type.tp_name);
594 0 : return -1;
595 : }
596 : }
597 0 : return 0;
598 : }
599 :
600 0 : static PyObject *py_winreg_SecBuf_get_sd(PyObject *obj, void *closure)
601 : {
602 0 : struct winreg_SecBuf *object = pytalloc_get_ptr(obj);
603 : PyObject *py_sd;
604 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, pytalloc_get_mem_ctx(obj), &object->sd);
605 0 : return py_sd;
606 : }
607 :
608 0 : static int py_winreg_SecBuf_set_sd(PyObject *py_obj, PyObject *value, void *closure)
609 : {
610 0 : struct winreg_SecBuf *object = pytalloc_get_ptr(py_obj);
611 0 : if (value == NULL) {
612 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sd");
613 0 : return -1;
614 : }
615 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
616 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
617 0 : PyErr_NoMemory();
618 0 : return -1;
619 : }
620 0 : object->sd = *(struct KeySecurityData *)pytalloc_get_ptr(value);
621 0 : return 0;
622 : }
623 :
624 0 : static PyObject *py_winreg_SecBuf_get_inherit(PyObject *obj, void *closure)
625 : {
626 0 : struct winreg_SecBuf *object = pytalloc_get_ptr(obj);
627 : PyObject *py_inherit;
628 0 : py_inherit = PyLong_FromLong((uint16_t)(object->inherit));
629 0 : return py_inherit;
630 : }
631 :
632 0 : static int py_winreg_SecBuf_set_inherit(PyObject *py_obj, PyObject *value, void *closure)
633 : {
634 0 : struct winreg_SecBuf *object = pytalloc_get_ptr(py_obj);
635 0 : if (value == NULL) {
636 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->inherit");
637 0 : return -1;
638 : }
639 : {
640 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->inherit));
641 0 : if (PyLong_Check(value)) {
642 : unsigned long long test_var;
643 0 : test_var = PyLong_AsUnsignedLongLong(value);
644 0 : if (PyErr_Occurred() != NULL) {
645 0 : return -1;
646 : }
647 0 : if (test_var > uint_max) {
648 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
649 : PyLong_Type.tp_name, uint_max, test_var);
650 0 : return -1;
651 : }
652 0 : object->inherit = test_var;
653 : } else {
654 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
655 : PyLong_Type.tp_name);
656 0 : return -1;
657 : }
658 : }
659 0 : return 0;
660 : }
661 :
662 : static PyGetSetDef py_winreg_SecBuf_getsetters[] = {
663 : {
664 : .name = discard_const_p(char, "length"),
665 : .get = py_winreg_SecBuf_get_length,
666 : .set = py_winreg_SecBuf_set_length,
667 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
668 : },
669 : {
670 : .name = discard_const_p(char, "sd"),
671 : .get = py_winreg_SecBuf_get_sd,
672 : .set = py_winreg_SecBuf_set_sd,
673 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
674 : },
675 : {
676 : .name = discard_const_p(char, "inherit"),
677 : .get = py_winreg_SecBuf_get_inherit,
678 : .set = py_winreg_SecBuf_set_inherit,
679 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
680 : },
681 : { .name = NULL }
682 : };
683 :
684 0 : static PyObject *py_winreg_SecBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
685 : {
686 0 : return pytalloc_new(struct winreg_SecBuf, type);
687 : }
688 :
689 :
690 : static PyTypeObject winreg_SecBuf_Type = {
691 : PyVarObject_HEAD_INIT(NULL, 0)
692 : .tp_name = "winreg.SecBuf",
693 : .tp_getset = py_winreg_SecBuf_getsetters,
694 : .tp_methods = NULL,
695 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
696 : .tp_new = py_winreg_SecBuf_new,
697 : };
698 :
699 :
700 0 : static PyObject *py_winreg_StringBuf_get_length(PyObject *obj, void *closure)
701 : {
702 0 : struct winreg_StringBuf *object = pytalloc_get_ptr(obj);
703 : PyObject *py_length;
704 0 : py_length = PyLong_FromLong((uint16_t)(object->length));
705 0 : return py_length;
706 : }
707 :
708 0 : static int py_winreg_StringBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
709 : {
710 0 : struct winreg_StringBuf *object = pytalloc_get_ptr(py_obj);
711 0 : if (value == NULL) {
712 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->length");
713 0 : return -1;
714 : }
715 : {
716 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
717 0 : if (PyLong_Check(value)) {
718 : unsigned long long test_var;
719 0 : test_var = PyLong_AsUnsignedLongLong(value);
720 0 : if (PyErr_Occurred() != NULL) {
721 0 : return -1;
722 : }
723 0 : if (test_var > uint_max) {
724 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
725 : PyLong_Type.tp_name, uint_max, test_var);
726 0 : return -1;
727 : }
728 0 : object->length = test_var;
729 : } else {
730 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
731 : PyLong_Type.tp_name);
732 0 : return -1;
733 : }
734 : }
735 0 : return 0;
736 : }
737 :
738 0 : static PyObject *py_winreg_StringBuf_get_size(PyObject *obj, void *closure)
739 : {
740 0 : struct winreg_StringBuf *object = pytalloc_get_ptr(obj);
741 : PyObject *py_size;
742 0 : py_size = PyLong_FromLong((uint16_t)(object->size));
743 0 : return py_size;
744 : }
745 :
746 0 : static int py_winreg_StringBuf_set_size(PyObject *py_obj, PyObject *value, void *closure)
747 : {
748 0 : struct winreg_StringBuf *object = pytalloc_get_ptr(py_obj);
749 0 : if (value == NULL) {
750 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
751 0 : return -1;
752 : }
753 : {
754 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
755 0 : if (PyLong_Check(value)) {
756 : unsigned long long test_var;
757 0 : test_var = PyLong_AsUnsignedLongLong(value);
758 0 : if (PyErr_Occurred() != NULL) {
759 0 : return -1;
760 : }
761 0 : if (test_var > uint_max) {
762 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
763 : PyLong_Type.tp_name, uint_max, test_var);
764 0 : return -1;
765 : }
766 0 : object->size = test_var;
767 : } else {
768 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
769 : PyLong_Type.tp_name);
770 0 : return -1;
771 : }
772 : }
773 0 : return 0;
774 : }
775 :
776 0 : static PyObject *py_winreg_StringBuf_get_name(PyObject *obj, void *closure)
777 : {
778 0 : struct winreg_StringBuf *object = pytalloc_get_ptr(obj);
779 : PyObject *py_name;
780 0 : if (object->name == NULL) {
781 0 : Py_RETURN_NONE;
782 : }
783 0 : if (object->name == NULL) {
784 0 : py_name = Py_None;
785 0 : Py_INCREF(py_name);
786 : } else {
787 0 : if (object->name == NULL) {
788 0 : py_name = Py_None;
789 0 : Py_INCREF(py_name);
790 : } else {
791 0 : py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
792 : }
793 : }
794 0 : return py_name;
795 : }
796 :
797 0 : static int py_winreg_StringBuf_set_name(PyObject *py_obj, PyObject *value, void *closure)
798 : {
799 0 : struct winreg_StringBuf *object = pytalloc_get_ptr(py_obj);
800 0 : if (value == NULL) {
801 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name");
802 0 : return -1;
803 : }
804 0 : if (value == Py_None) {
805 0 : object->name = NULL;
806 : } else {
807 0 : object->name = NULL;
808 : {
809 : const char *test_str;
810 : const char *talloc_str;
811 0 : PyObject *unicode = NULL;
812 0 : if (PyUnicode_Check(value)) {
813 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
814 0 : if (unicode == NULL) {
815 0 : return -1;
816 : }
817 0 : test_str = PyBytes_AS_STRING(unicode);
818 0 : } else if (PyBytes_Check(value)) {
819 0 : test_str = PyBytes_AS_STRING(value);
820 : } else {
821 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
822 0 : return -1;
823 : }
824 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
825 0 : if (unicode != NULL) {
826 0 : Py_DECREF(unicode);
827 : }
828 0 : if (talloc_str == NULL) {
829 0 : PyErr_NoMemory();
830 0 : return -1;
831 : }
832 0 : object->name = talloc_str;
833 : }
834 : }
835 0 : return 0;
836 : }
837 :
838 : static PyGetSetDef py_winreg_StringBuf_getsetters[] = {
839 : {
840 : .name = discard_const_p(char, "length"),
841 : .get = py_winreg_StringBuf_get_length,
842 : .set = py_winreg_StringBuf_set_length,
843 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
844 : },
845 : {
846 : .name = discard_const_p(char, "size"),
847 : .get = py_winreg_StringBuf_get_size,
848 : .set = py_winreg_StringBuf_set_size,
849 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
850 : },
851 : {
852 : .name = discard_const_p(char, "name"),
853 : .get = py_winreg_StringBuf_get_name,
854 : .set = py_winreg_StringBuf_set_name,
855 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
856 : },
857 : { .name = NULL }
858 : };
859 :
860 0 : static PyObject *py_winreg_StringBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
861 : {
862 0 : return pytalloc_new(struct winreg_StringBuf, type);
863 : }
864 :
865 :
866 : static PyTypeObject winreg_StringBuf_Type = {
867 : PyVarObject_HEAD_INIT(NULL, 0)
868 : .tp_name = "winreg.StringBuf",
869 : .tp_getset = py_winreg_StringBuf_getsetters,
870 : .tp_methods = NULL,
871 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
872 : .tp_new = py_winreg_StringBuf_new,
873 : };
874 :
875 :
876 0 : static PyObject *py_winreg_ValNameBuf_get_length(PyObject *obj, void *closure)
877 : {
878 0 : struct winreg_ValNameBuf *object = pytalloc_get_ptr(obj);
879 : PyObject *py_length;
880 0 : py_length = PyLong_FromLong((uint16_t)(object->length));
881 0 : return py_length;
882 : }
883 :
884 0 : static int py_winreg_ValNameBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
885 : {
886 0 : struct winreg_ValNameBuf *object = pytalloc_get_ptr(py_obj);
887 0 : if (value == NULL) {
888 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->length");
889 0 : return -1;
890 : }
891 : {
892 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
893 0 : if (PyLong_Check(value)) {
894 : unsigned long long test_var;
895 0 : test_var = PyLong_AsUnsignedLongLong(value);
896 0 : if (PyErr_Occurred() != NULL) {
897 0 : return -1;
898 : }
899 0 : if (test_var > uint_max) {
900 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
901 : PyLong_Type.tp_name, uint_max, test_var);
902 0 : return -1;
903 : }
904 0 : object->length = test_var;
905 : } else {
906 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
907 : PyLong_Type.tp_name);
908 0 : return -1;
909 : }
910 : }
911 0 : return 0;
912 : }
913 :
914 0 : static PyObject *py_winreg_ValNameBuf_get_size(PyObject *obj, void *closure)
915 : {
916 0 : struct winreg_ValNameBuf *object = pytalloc_get_ptr(obj);
917 : PyObject *py_size;
918 0 : py_size = PyLong_FromLong((uint16_t)(object->size));
919 0 : return py_size;
920 : }
921 :
922 0 : static int py_winreg_ValNameBuf_set_size(PyObject *py_obj, PyObject *value, void *closure)
923 : {
924 0 : struct winreg_ValNameBuf *object = pytalloc_get_ptr(py_obj);
925 0 : if (value == NULL) {
926 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
927 0 : return -1;
928 : }
929 : {
930 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
931 0 : if (PyLong_Check(value)) {
932 : unsigned long long test_var;
933 0 : test_var = PyLong_AsUnsignedLongLong(value);
934 0 : if (PyErr_Occurred() != NULL) {
935 0 : return -1;
936 : }
937 0 : if (test_var > uint_max) {
938 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
939 : PyLong_Type.tp_name, uint_max, test_var);
940 0 : return -1;
941 : }
942 0 : object->size = test_var;
943 : } else {
944 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
945 : PyLong_Type.tp_name);
946 0 : return -1;
947 : }
948 : }
949 0 : return 0;
950 : }
951 :
952 0 : static PyObject *py_winreg_ValNameBuf_get_name(PyObject *obj, void *closure)
953 : {
954 0 : struct winreg_ValNameBuf *object = pytalloc_get_ptr(obj);
955 : PyObject *py_name;
956 0 : if (object->name == NULL) {
957 0 : Py_RETURN_NONE;
958 : }
959 0 : if (object->name == NULL) {
960 0 : py_name = Py_None;
961 0 : Py_INCREF(py_name);
962 : } else {
963 0 : if (object->name == NULL) {
964 0 : py_name = Py_None;
965 0 : Py_INCREF(py_name);
966 : } else {
967 0 : py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
968 : }
969 : }
970 0 : return py_name;
971 : }
972 :
973 0 : static int py_winreg_ValNameBuf_set_name(PyObject *py_obj, PyObject *value, void *closure)
974 : {
975 0 : struct winreg_ValNameBuf *object = pytalloc_get_ptr(py_obj);
976 0 : if (value == NULL) {
977 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name");
978 0 : return -1;
979 : }
980 0 : if (value == Py_None) {
981 0 : object->name = NULL;
982 : } else {
983 0 : object->name = NULL;
984 : {
985 : const char *test_str;
986 : const char *talloc_str;
987 0 : PyObject *unicode = NULL;
988 0 : if (PyUnicode_Check(value)) {
989 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
990 0 : if (unicode == NULL) {
991 0 : return -1;
992 : }
993 0 : test_str = PyBytes_AS_STRING(unicode);
994 0 : } else if (PyBytes_Check(value)) {
995 0 : test_str = PyBytes_AS_STRING(value);
996 : } else {
997 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
998 0 : return -1;
999 : }
1000 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1001 0 : if (unicode != NULL) {
1002 0 : Py_DECREF(unicode);
1003 : }
1004 0 : if (talloc_str == NULL) {
1005 0 : PyErr_NoMemory();
1006 0 : return -1;
1007 : }
1008 0 : object->name = talloc_str;
1009 : }
1010 : }
1011 0 : return 0;
1012 : }
1013 :
1014 : static PyGetSetDef py_winreg_ValNameBuf_getsetters[] = {
1015 : {
1016 : .name = discard_const_p(char, "length"),
1017 : .get = py_winreg_ValNameBuf_get_length,
1018 : .set = py_winreg_ValNameBuf_set_length,
1019 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1020 : },
1021 : {
1022 : .name = discard_const_p(char, "size"),
1023 : .get = py_winreg_ValNameBuf_get_size,
1024 : .set = py_winreg_ValNameBuf_set_size,
1025 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1026 : },
1027 : {
1028 : .name = discard_const_p(char, "name"),
1029 : .get = py_winreg_ValNameBuf_get_name,
1030 : .set = py_winreg_ValNameBuf_set_name,
1031 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1032 : },
1033 : { .name = NULL }
1034 : };
1035 :
1036 0 : static PyObject *py_winreg_ValNameBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1037 : {
1038 0 : return pytalloc_new(struct winreg_ValNameBuf, type);
1039 : }
1040 :
1041 :
1042 : static PyTypeObject winreg_ValNameBuf_Type = {
1043 : PyVarObject_HEAD_INIT(NULL, 0)
1044 : .tp_name = "winreg.ValNameBuf",
1045 : .tp_getset = py_winreg_ValNameBuf_getsetters,
1046 : .tp_methods = NULL,
1047 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1048 : .tp_new = py_winreg_ValNameBuf_new,
1049 : };
1050 :
1051 :
1052 0 : static PyObject *py_KeySecurityAttribute_get_data_size(PyObject *obj, void *closure)
1053 : {
1054 0 : struct KeySecurityAttribute *object = pytalloc_get_ptr(obj);
1055 : PyObject *py_data_size;
1056 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)(object->data_size));
1057 0 : return py_data_size;
1058 : }
1059 :
1060 0 : static int py_KeySecurityAttribute_set_data_size(PyObject *py_obj, PyObject *value, void *closure)
1061 : {
1062 0 : struct KeySecurityAttribute *object = pytalloc_get_ptr(py_obj);
1063 0 : if (value == NULL) {
1064 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data_size");
1065 0 : return -1;
1066 : }
1067 : {
1068 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->data_size));
1069 0 : if (PyLong_Check(value)) {
1070 : unsigned long long test_var;
1071 0 : test_var = PyLong_AsUnsignedLongLong(value);
1072 0 : if (PyErr_Occurred() != NULL) {
1073 0 : return -1;
1074 : }
1075 0 : if (test_var > uint_max) {
1076 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1077 : PyLong_Type.tp_name, uint_max, test_var);
1078 0 : return -1;
1079 : }
1080 0 : object->data_size = test_var;
1081 : } else {
1082 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1083 : PyLong_Type.tp_name);
1084 0 : return -1;
1085 : }
1086 : }
1087 0 : return 0;
1088 : }
1089 :
1090 0 : static PyObject *py_KeySecurityAttribute_get_sec_data(PyObject *obj, void *closure)
1091 : {
1092 0 : struct KeySecurityAttribute *object = pytalloc_get_ptr(obj);
1093 : PyObject *py_sec_data;
1094 0 : py_sec_data = pytalloc_reference_ex(&KeySecurityData_Type, pytalloc_get_mem_ctx(obj), &object->sec_data);
1095 0 : return py_sec_data;
1096 : }
1097 :
1098 0 : static int py_KeySecurityAttribute_set_sec_data(PyObject *py_obj, PyObject *value, void *closure)
1099 : {
1100 0 : struct KeySecurityAttribute *object = pytalloc_get_ptr(py_obj);
1101 0 : if (value == NULL) {
1102 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sec_data");
1103 0 : return -1;
1104 : }
1105 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
1106 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1107 0 : PyErr_NoMemory();
1108 0 : return -1;
1109 : }
1110 0 : object->sec_data = *(struct KeySecurityData *)pytalloc_get_ptr(value);
1111 0 : return 0;
1112 : }
1113 :
1114 0 : static PyObject *py_KeySecurityAttribute_get_inherit(PyObject *obj, void *closure)
1115 : {
1116 0 : struct KeySecurityAttribute *object = pytalloc_get_ptr(obj);
1117 : PyObject *py_inherit;
1118 0 : py_inherit = PyLong_FromLong((uint16_t)(object->inherit));
1119 0 : return py_inherit;
1120 : }
1121 :
1122 0 : static int py_KeySecurityAttribute_set_inherit(PyObject *py_obj, PyObject *value, void *closure)
1123 : {
1124 0 : struct KeySecurityAttribute *object = pytalloc_get_ptr(py_obj);
1125 0 : if (value == NULL) {
1126 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->inherit");
1127 0 : return -1;
1128 : }
1129 : {
1130 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->inherit));
1131 0 : if (PyLong_Check(value)) {
1132 : unsigned long long test_var;
1133 0 : test_var = PyLong_AsUnsignedLongLong(value);
1134 0 : if (PyErr_Occurred() != NULL) {
1135 0 : return -1;
1136 : }
1137 0 : if (test_var > uint_max) {
1138 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1139 : PyLong_Type.tp_name, uint_max, test_var);
1140 0 : return -1;
1141 : }
1142 0 : object->inherit = test_var;
1143 : } else {
1144 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1145 : PyLong_Type.tp_name);
1146 0 : return -1;
1147 : }
1148 : }
1149 0 : return 0;
1150 : }
1151 :
1152 : static PyGetSetDef py_KeySecurityAttribute_getsetters[] = {
1153 : {
1154 : .name = discard_const_p(char, "data_size"),
1155 : .get = py_KeySecurityAttribute_get_data_size,
1156 : .set = py_KeySecurityAttribute_set_data_size,
1157 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1158 : },
1159 : {
1160 : .name = discard_const_p(char, "sec_data"),
1161 : .get = py_KeySecurityAttribute_get_sec_data,
1162 : .set = py_KeySecurityAttribute_set_sec_data,
1163 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
1164 : },
1165 : {
1166 : .name = discard_const_p(char, "inherit"),
1167 : .get = py_KeySecurityAttribute_get_inherit,
1168 : .set = py_KeySecurityAttribute_set_inherit,
1169 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1170 : },
1171 : { .name = NULL }
1172 : };
1173 :
1174 0 : static PyObject *py_KeySecurityAttribute_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1175 : {
1176 0 : return pytalloc_new(struct KeySecurityAttribute, type);
1177 : }
1178 :
1179 :
1180 : static PyTypeObject KeySecurityAttribute_Type = {
1181 : PyVarObject_HEAD_INIT(NULL, 0)
1182 : .tp_name = "winreg.KeySecurityAttribute",
1183 : .tp_getset = py_KeySecurityAttribute_getsetters,
1184 : .tp_methods = NULL,
1185 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1186 : .tp_new = py_KeySecurityAttribute_new,
1187 : };
1188 :
1189 :
1190 0 : static PyObject *py_QueryMultipleValue_get_ve_valuename(PyObject *obj, void *closure)
1191 : {
1192 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(obj);
1193 : PyObject *py_ve_valuename;
1194 0 : if (object->ve_valuename == NULL) {
1195 0 : Py_RETURN_NONE;
1196 : }
1197 0 : if (object->ve_valuename == NULL) {
1198 0 : py_ve_valuename = Py_None;
1199 0 : Py_INCREF(py_ve_valuename);
1200 : } else {
1201 0 : py_ve_valuename = pytalloc_reference_ex(&winreg_ValNameBuf_Type, object->ve_valuename, object->ve_valuename);
1202 : }
1203 0 : return py_ve_valuename;
1204 : }
1205 :
1206 0 : static int py_QueryMultipleValue_set_ve_valuename(PyObject *py_obj, PyObject *value, void *closure)
1207 : {
1208 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(py_obj);
1209 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->ve_valuename));
1210 0 : if (value == NULL) {
1211 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ve_valuename");
1212 0 : return -1;
1213 : }
1214 0 : if (value == Py_None) {
1215 0 : object->ve_valuename = NULL;
1216 : } else {
1217 0 : object->ve_valuename = NULL;
1218 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, value, return -1;);
1219 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1220 0 : PyErr_NoMemory();
1221 0 : return -1;
1222 : }
1223 0 : object->ve_valuename = (struct winreg_ValNameBuf *)pytalloc_get_ptr(value);
1224 : }
1225 0 : return 0;
1226 : }
1227 :
1228 0 : static PyObject *py_QueryMultipleValue_get_ve_valuelen(PyObject *obj, void *closure)
1229 : {
1230 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(obj);
1231 : PyObject *py_ve_valuelen;
1232 0 : py_ve_valuelen = PyLong_FromUnsignedLongLong((uint32_t)(object->ve_valuelen));
1233 0 : return py_ve_valuelen;
1234 : }
1235 :
1236 0 : static int py_QueryMultipleValue_set_ve_valuelen(PyObject *py_obj, PyObject *value, void *closure)
1237 : {
1238 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(py_obj);
1239 0 : if (value == NULL) {
1240 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ve_valuelen");
1241 0 : return -1;
1242 : }
1243 : {
1244 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ve_valuelen));
1245 0 : if (PyLong_Check(value)) {
1246 : unsigned long long test_var;
1247 0 : test_var = PyLong_AsUnsignedLongLong(value);
1248 0 : if (PyErr_Occurred() != NULL) {
1249 0 : return -1;
1250 : }
1251 0 : if (test_var > uint_max) {
1252 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1253 : PyLong_Type.tp_name, uint_max, test_var);
1254 0 : return -1;
1255 : }
1256 0 : object->ve_valuelen = test_var;
1257 : } else {
1258 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1259 : PyLong_Type.tp_name);
1260 0 : return -1;
1261 : }
1262 : }
1263 0 : return 0;
1264 : }
1265 :
1266 0 : static PyObject *py_QueryMultipleValue_get_ve_valueptr(PyObject *obj, void *closure)
1267 : {
1268 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(obj);
1269 : PyObject *py_ve_valueptr;
1270 0 : py_ve_valueptr = PyLong_FromUnsignedLongLong((uint32_t)(object->ve_valueptr));
1271 0 : return py_ve_valueptr;
1272 : }
1273 :
1274 0 : static int py_QueryMultipleValue_set_ve_valueptr(PyObject *py_obj, PyObject *value, void *closure)
1275 : {
1276 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(py_obj);
1277 0 : if (value == NULL) {
1278 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ve_valueptr");
1279 0 : return -1;
1280 : }
1281 : {
1282 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ve_valueptr));
1283 0 : if (PyLong_Check(value)) {
1284 : unsigned long long test_var;
1285 0 : test_var = PyLong_AsUnsignedLongLong(value);
1286 0 : if (PyErr_Occurred() != NULL) {
1287 0 : return -1;
1288 : }
1289 0 : if (test_var > uint_max) {
1290 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1291 : PyLong_Type.tp_name, uint_max, test_var);
1292 0 : return -1;
1293 : }
1294 0 : object->ve_valueptr = test_var;
1295 : } else {
1296 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1297 : PyLong_Type.tp_name);
1298 0 : return -1;
1299 : }
1300 : }
1301 0 : return 0;
1302 : }
1303 :
1304 0 : static PyObject *py_QueryMultipleValue_get_ve_type(PyObject *obj, void *closure)
1305 : {
1306 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(obj);
1307 : PyObject *py_ve_type;
1308 0 : py_ve_type = PyLong_FromUnsignedLongLong((uint32_t)(object->ve_type));
1309 0 : return py_ve_type;
1310 : }
1311 :
1312 0 : static int py_QueryMultipleValue_set_ve_type(PyObject *py_obj, PyObject *value, void *closure)
1313 : {
1314 0 : struct QueryMultipleValue *object = pytalloc_get_ptr(py_obj);
1315 0 : if (value == NULL) {
1316 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ve_type");
1317 0 : return -1;
1318 : }
1319 : {
1320 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ve_type));
1321 0 : if (PyLong_Check(value)) {
1322 : unsigned long long test_var;
1323 0 : test_var = PyLong_AsUnsignedLongLong(value);
1324 0 : if (PyErr_Occurred() != NULL) {
1325 0 : return -1;
1326 : }
1327 0 : if (test_var > uint_max) {
1328 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1329 : PyLong_Type.tp_name, uint_max, test_var);
1330 0 : return -1;
1331 : }
1332 0 : object->ve_type = test_var;
1333 : } else {
1334 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1335 : PyLong_Type.tp_name);
1336 0 : return -1;
1337 : }
1338 : }
1339 0 : return 0;
1340 : }
1341 :
1342 : static PyGetSetDef py_QueryMultipleValue_getsetters[] = {
1343 : {
1344 : .name = discard_const_p(char, "ve_valuename"),
1345 : .get = py_QueryMultipleValue_get_ve_valuename,
1346 : .set = py_QueryMultipleValue_set_ve_valuename,
1347 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_ValNameBuf")
1348 : },
1349 : {
1350 : .name = discard_const_p(char, "ve_valuelen"),
1351 : .get = py_QueryMultipleValue_get_ve_valuelen,
1352 : .set = py_QueryMultipleValue_set_ve_valuelen,
1353 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1354 : },
1355 : {
1356 : .name = discard_const_p(char, "ve_valueptr"),
1357 : .get = py_QueryMultipleValue_get_ve_valueptr,
1358 : .set = py_QueryMultipleValue_set_ve_valueptr,
1359 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1360 : },
1361 : {
1362 : .name = discard_const_p(char, "ve_type"),
1363 : .get = py_QueryMultipleValue_get_ve_type,
1364 : .set = py_QueryMultipleValue_set_ve_type,
1365 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
1366 : },
1367 : { .name = NULL }
1368 : };
1369 :
1370 0 : static PyObject *py_QueryMultipleValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1371 : {
1372 0 : return pytalloc_new(struct QueryMultipleValue, type);
1373 : }
1374 :
1375 :
1376 : static PyTypeObject QueryMultipleValue_Type = {
1377 : PyVarObject_HEAD_INIT(NULL, 0)
1378 : .tp_name = "winreg.QueryMultipleValue",
1379 : .tp_getset = py_QueryMultipleValue_getsetters,
1380 : .tp_methods = NULL,
1381 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1382 : .tp_new = py_QueryMultipleValue_new,
1383 : };
1384 :
1385 :
1386 :
1387 0 : static PyObject *py_winreg_OpenHKCR_in_get_system_name(PyObject *obj, void *closure)
1388 : {
1389 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(obj);
1390 : PyObject *py_system_name;
1391 0 : if (object->in.system_name == NULL) {
1392 0 : Py_RETURN_NONE;
1393 : }
1394 0 : if (object->in.system_name == NULL) {
1395 0 : py_system_name = Py_None;
1396 0 : Py_INCREF(py_system_name);
1397 : } else {
1398 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
1399 : }
1400 0 : return py_system_name;
1401 : }
1402 :
1403 0 : static int py_winreg_OpenHKCR_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
1404 : {
1405 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(py_obj);
1406 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
1407 0 : if (value == NULL) {
1408 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
1409 0 : return -1;
1410 : }
1411 0 : if (value == Py_None) {
1412 0 : object->in.system_name = NULL;
1413 : } else {
1414 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
1415 0 : if (object->in.system_name == NULL) {
1416 0 : PyErr_NoMemory();
1417 0 : return -1;
1418 : }
1419 : {
1420 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
1421 0 : if (PyLong_Check(value)) {
1422 : unsigned long long test_var;
1423 0 : test_var = PyLong_AsUnsignedLongLong(value);
1424 0 : if (PyErr_Occurred() != NULL) {
1425 0 : return -1;
1426 : }
1427 0 : if (test_var > uint_max) {
1428 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1429 : PyLong_Type.tp_name, uint_max, test_var);
1430 0 : return -1;
1431 : }
1432 0 : *object->in.system_name = test_var;
1433 : } else {
1434 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1435 : PyLong_Type.tp_name);
1436 0 : return -1;
1437 : }
1438 : }
1439 : }
1440 0 : return 0;
1441 : }
1442 :
1443 0 : static PyObject *py_winreg_OpenHKCR_in_get_access_mask(PyObject *obj, void *closure)
1444 : {
1445 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(obj);
1446 : PyObject *py_access_mask;
1447 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
1448 0 : return py_access_mask;
1449 : }
1450 :
1451 0 : static int py_winreg_OpenHKCR_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
1452 : {
1453 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(py_obj);
1454 0 : if (value == NULL) {
1455 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
1456 0 : return -1;
1457 : }
1458 : {
1459 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
1460 0 : if (PyLong_Check(value)) {
1461 : unsigned long long test_var;
1462 0 : test_var = PyLong_AsUnsignedLongLong(value);
1463 0 : if (PyErr_Occurred() != NULL) {
1464 0 : return -1;
1465 : }
1466 0 : if (test_var > uint_max) {
1467 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1468 : PyLong_Type.tp_name, uint_max, test_var);
1469 0 : return -1;
1470 : }
1471 0 : object->in.access_mask = test_var;
1472 : } else {
1473 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1474 : PyLong_Type.tp_name);
1475 0 : return -1;
1476 : }
1477 : }
1478 0 : return 0;
1479 : }
1480 :
1481 0 : static PyObject *py_winreg_OpenHKCR_out_get_handle(PyObject *obj, void *closure)
1482 : {
1483 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(obj);
1484 : PyObject *py_handle;
1485 0 : if (object->out.handle == NULL) {
1486 0 : Py_RETURN_NONE;
1487 : }
1488 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
1489 0 : return py_handle;
1490 : }
1491 :
1492 0 : static int py_winreg_OpenHKCR_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
1493 : {
1494 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(py_obj);
1495 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
1496 0 : if (value == NULL) {
1497 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
1498 0 : return -1;
1499 : }
1500 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
1501 0 : if (object->out.handle == NULL) {
1502 0 : PyErr_NoMemory();
1503 0 : return -1;
1504 : }
1505 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
1506 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1507 0 : PyErr_NoMemory();
1508 0 : return -1;
1509 : }
1510 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
1511 0 : return 0;
1512 : }
1513 :
1514 0 : static PyObject *py_winreg_OpenHKCR_get_result(PyObject *obj, void *closure)
1515 : {
1516 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(obj);
1517 : PyObject *py_result;
1518 0 : py_result = PyErr_FromWERROR(object->out.result);
1519 0 : return py_result;
1520 : }
1521 :
1522 0 : static int py_winreg_OpenHKCR_set_result(PyObject *py_obj, PyObject *value, void *closure)
1523 : {
1524 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(py_obj);
1525 0 : if (value == NULL) {
1526 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
1527 0 : return -1;
1528 : }
1529 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
1530 0 : return 0;
1531 : }
1532 :
1533 : static PyGetSetDef py_winreg_OpenHKCR_getsetters[] = {
1534 : {
1535 : .name = discard_const_p(char, "in_system_name"),
1536 : .get = py_winreg_OpenHKCR_in_get_system_name,
1537 : .set = py_winreg_OpenHKCR_in_set_system_name,
1538 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1539 : },
1540 : {
1541 : .name = discard_const_p(char, "in_access_mask"),
1542 : .get = py_winreg_OpenHKCR_in_get_access_mask,
1543 : .set = py_winreg_OpenHKCR_in_set_access_mask,
1544 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
1545 : },
1546 : {
1547 : .name = discard_const_p(char, "out_handle"),
1548 : .get = py_winreg_OpenHKCR_out_get_handle,
1549 : .set = py_winreg_OpenHKCR_out_set_handle,
1550 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
1551 : },
1552 : {
1553 : .name = discard_const_p(char, "result"),
1554 : .get = py_winreg_OpenHKCR_get_result,
1555 : .set = py_winreg_OpenHKCR_set_result,
1556 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
1557 : },
1558 : { .name = NULL }
1559 : };
1560 :
1561 0 : static PyObject *py_winreg_OpenHKCR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1562 : {
1563 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKCR, type);
1564 0 : struct winreg_OpenHKCR *_self = (struct winreg_OpenHKCR *)pytalloc_get_ptr(self);
1565 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
1566 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
1567 0 : return self;
1568 : }
1569 :
1570 0 : static PyObject *py_winreg_OpenHKCR_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
1571 : {
1572 :
1573 :
1574 0 : return PyLong_FromLong(0);
1575 : }
1576 :
1577 0 : static PyObject *py_winreg_OpenHKCR_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
1578 : {
1579 0 : const struct ndr_interface_call *call = NULL;
1580 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(py_obj);
1581 0 : PyObject *ret = NULL;
1582 0 : struct ndr_push *push = NULL;
1583 : DATA_BLOB blob;
1584 : enum ndr_err_code err;
1585 :
1586 0 : if (ndr_table_winreg.num_calls < 1) {
1587 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCR_ndr_pack");
1588 0 : return NULL;
1589 : }
1590 0 : call = &ndr_table_winreg.calls[0];
1591 :
1592 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
1593 0 : if (push == NULL) {
1594 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1595 0 : return NULL;
1596 : }
1597 :
1598 0 : push->flags |= ndr_push_flags;
1599 :
1600 0 : err = call->ndr_push(push, ndr_inout_flags, object);
1601 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1602 0 : TALLOC_FREE(push);
1603 0 : PyErr_SetNdrError(err);
1604 0 : return NULL;
1605 : }
1606 0 : blob = ndr_push_blob(push);
1607 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1608 0 : TALLOC_FREE(push);
1609 0 : return ret;
1610 : }
1611 :
1612 0 : static PyObject *py_winreg_OpenHKCR_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1613 : {
1614 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
1615 0 : PyObject *bigendian_obj = NULL;
1616 0 : PyObject *ndr64_obj = NULL;
1617 0 : libndr_flags ndr_push_flags = 0;
1618 :
1619 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
1620 : discard_const_p(char *, kwnames),
1621 : &bigendian_obj,
1622 : &ndr64_obj)) {
1623 0 : return NULL;
1624 : }
1625 :
1626 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1627 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
1628 : }
1629 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1630 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
1631 : }
1632 :
1633 0 : return py_winreg_OpenHKCR_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
1634 : }
1635 :
1636 0 : static PyObject *py_winreg_OpenHKCR_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1637 : {
1638 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
1639 0 : PyObject *bigendian_obj = NULL;
1640 0 : PyObject *ndr64_obj = NULL;
1641 0 : libndr_flags ndr_push_flags = 0;
1642 :
1643 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
1644 : discard_const_p(char *, kwnames),
1645 : &bigendian_obj,
1646 : &ndr64_obj)) {
1647 0 : return NULL;
1648 : }
1649 :
1650 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1651 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
1652 : }
1653 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1654 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
1655 : }
1656 :
1657 0 : return py_winreg_OpenHKCR_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
1658 : }
1659 :
1660 0 : static PyObject *py_winreg_OpenHKCR_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
1661 : {
1662 0 : const struct ndr_interface_call *call = NULL;
1663 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(py_obj);
1664 0 : struct ndr_pull *pull = NULL;
1665 : enum ndr_err_code err;
1666 :
1667 0 : if (ndr_table_winreg.num_calls < 1) {
1668 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCR_ndr_unpack");
1669 0 : return NULL;
1670 : }
1671 0 : call = &ndr_table_winreg.calls[0];
1672 :
1673 0 : pull = ndr_pull_init_blob(blob, object);
1674 0 : if (pull == NULL) {
1675 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1676 0 : return NULL;
1677 : }
1678 :
1679 0 : pull->flags |= ndr_pull_flags;
1680 :
1681 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
1682 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1683 0 : TALLOC_FREE(pull);
1684 0 : PyErr_SetNdrError(err);
1685 0 : return NULL;
1686 : }
1687 0 : if (!allow_remaining) {
1688 : uint32_t highest_ofs;
1689 :
1690 0 : if (pull->offset > pull->relative_highest_offset) {
1691 0 : highest_ofs = pull->offset;
1692 : } else {
1693 0 : highest_ofs = pull->relative_highest_offset;
1694 : }
1695 0 : if (highest_ofs < pull->data_size) {
1696 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
1697 : "not all bytes consumed ofs[%u] size[%u]",
1698 : highest_ofs, pull->data_size);
1699 0 : TALLOC_FREE(pull);
1700 0 : PyErr_SetNdrError(err);
1701 0 : return NULL;
1702 : }
1703 : }
1704 :
1705 0 : TALLOC_FREE(pull);
1706 0 : Py_RETURN_NONE;
1707 : }
1708 :
1709 0 : static PyObject *py_winreg_OpenHKCR_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1710 : {
1711 : DATA_BLOB blob;
1712 0 : Py_ssize_t blob_length = 0;
1713 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
1714 0 : PyObject *bigendian_obj = NULL;
1715 0 : PyObject *ndr64_obj = NULL;
1716 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
1717 0 : PyObject *allow_remaining_obj = NULL;
1718 0 : bool allow_remaining = false;
1719 :
1720 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
1721 : discard_const_p(char *, kwnames),
1722 : &blob.data, &blob_length,
1723 : &bigendian_obj,
1724 : &ndr64_obj,
1725 : &allow_remaining_obj)) {
1726 0 : return NULL;
1727 : }
1728 0 : blob.length = blob_length;
1729 :
1730 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1731 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
1732 : }
1733 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1734 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
1735 : }
1736 :
1737 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1738 0 : allow_remaining = true;
1739 : }
1740 :
1741 0 : return py_winreg_OpenHKCR_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
1742 : }
1743 :
1744 0 : static PyObject *py_winreg_OpenHKCR_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1745 : {
1746 : DATA_BLOB blob;
1747 0 : Py_ssize_t blob_length = 0;
1748 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
1749 0 : PyObject *bigendian_obj = NULL;
1750 0 : PyObject *ndr64_obj = NULL;
1751 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
1752 0 : PyObject *allow_remaining_obj = NULL;
1753 0 : bool allow_remaining = false;
1754 :
1755 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
1756 : discard_const_p(char *, kwnames),
1757 : &blob.data, &blob_length,
1758 : &bigendian_obj,
1759 : &ndr64_obj,
1760 : &allow_remaining_obj)) {
1761 0 : return NULL;
1762 : }
1763 0 : blob.length = blob_length;
1764 :
1765 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1766 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
1767 : }
1768 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1769 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
1770 : }
1771 :
1772 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1773 0 : allow_remaining = true;
1774 : }
1775 :
1776 0 : return py_winreg_OpenHKCR_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
1777 : }
1778 :
1779 0 : static PyObject *py_winreg_OpenHKCR_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
1780 : {
1781 0 : const struct ndr_interface_call *call = NULL;
1782 0 : struct winreg_OpenHKCR *object = pytalloc_get_ptr(py_obj);
1783 : PyObject *ret;
1784 : char *retstr;
1785 :
1786 0 : if (ndr_table_winreg.num_calls < 1) {
1787 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCR_ndr_print");
1788 0 : return NULL;
1789 : }
1790 0 : call = &ndr_table_winreg.calls[0];
1791 :
1792 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
1793 0 : ret = PyUnicode_FromString(retstr);
1794 0 : TALLOC_FREE(retstr);
1795 :
1796 0 : return ret;
1797 : }
1798 :
1799 0 : static PyObject *py_winreg_OpenHKCR_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1800 : {
1801 0 : return py_winreg_OpenHKCR_ndr_print(py_obj, "winreg_OpenHKCR_in", NDR_IN);
1802 : }
1803 :
1804 0 : static PyObject *py_winreg_OpenHKCR_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1805 : {
1806 0 : return py_winreg_OpenHKCR_ndr_print(py_obj, "winreg_OpenHKCR_out", NDR_OUT);
1807 : }
1808 :
1809 : static PyMethodDef py_winreg_OpenHKCR_methods[] = {
1810 : { "opnum", (PyCFunction)py_winreg_OpenHKCR_ndr_opnum, METH_NOARGS|METH_CLASS,
1811 : "winreg.OpenHKCR.opnum() -> 0 (0x00) " },
1812 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
1813 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
1814 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
1815 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
1816 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
1817 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
1818 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
1819 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
1820 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKCR_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
1821 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKCR_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
1822 : { NULL, NULL, 0, NULL }
1823 : };
1824 :
1825 :
1826 : static PyTypeObject winreg_OpenHKCR_Type = {
1827 : PyVarObject_HEAD_INIT(NULL, 0)
1828 : .tp_name = "winreg.OpenHKCR",
1829 : .tp_getset = py_winreg_OpenHKCR_getsetters,
1830 : .tp_methods = py_winreg_OpenHKCR_methods,
1831 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1832 : .tp_new = py_winreg_OpenHKCR_new,
1833 : };
1834 :
1835 0 : static bool pack_py_winreg_OpenHKCR_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCR *r)
1836 : {
1837 : PyObject *py_system_name;
1838 : PyObject *py_access_mask;
1839 0 : const char *kwnames[] = {
1840 : "system_name", "access_mask", NULL
1841 : };
1842 :
1843 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCR", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
1844 0 : return false;
1845 : }
1846 :
1847 0 : if (py_system_name == NULL) {
1848 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
1849 0 : return false;
1850 : }
1851 0 : if (py_system_name == Py_None) {
1852 0 : r->in.system_name = NULL;
1853 : } else {
1854 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
1855 0 : if (r->in.system_name == NULL) {
1856 0 : PyErr_NoMemory();
1857 0 : return false;
1858 : }
1859 : {
1860 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
1861 0 : if (PyLong_Check(py_system_name)) {
1862 : unsigned long long test_var;
1863 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
1864 0 : if (PyErr_Occurred() != NULL) {
1865 0 : return false;
1866 : }
1867 0 : if (test_var > uint_max) {
1868 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1869 : PyLong_Type.tp_name, uint_max, test_var);
1870 0 : return false;
1871 : }
1872 0 : *r->in.system_name = test_var;
1873 : } else {
1874 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1875 : PyLong_Type.tp_name);
1876 0 : return false;
1877 : }
1878 : }
1879 : }
1880 0 : if (py_access_mask == NULL) {
1881 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
1882 0 : return false;
1883 : }
1884 : {
1885 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
1886 0 : if (PyLong_Check(py_access_mask)) {
1887 : unsigned long long test_var;
1888 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
1889 0 : if (PyErr_Occurred() != NULL) {
1890 0 : return false;
1891 : }
1892 0 : if (test_var > uint_max) {
1893 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1894 : PyLong_Type.tp_name, uint_max, test_var);
1895 0 : return false;
1896 : }
1897 0 : r->in.access_mask = test_var;
1898 : } else {
1899 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1900 : PyLong_Type.tp_name);
1901 0 : return false;
1902 : }
1903 : }
1904 0 : return true;
1905 : }
1906 :
1907 0 : static PyObject *unpack_py_winreg_OpenHKCR_args_out(struct winreg_OpenHKCR *r)
1908 : {
1909 : PyObject *result;
1910 : PyObject *py_handle;
1911 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
1912 0 : result = py_handle;
1913 0 : if (!W_ERROR_IS_OK(r->out.result)) {
1914 0 : PyErr_SetWERROR(r->out.result);
1915 0 : return NULL;
1916 : }
1917 :
1918 0 : return result;
1919 : }
1920 :
1921 :
1922 0 : static PyObject *py_winreg_OpenHKCU_in_get_system_name(PyObject *obj, void *closure)
1923 : {
1924 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(obj);
1925 : PyObject *py_system_name;
1926 0 : if (object->in.system_name == NULL) {
1927 0 : Py_RETURN_NONE;
1928 : }
1929 0 : if (object->in.system_name == NULL) {
1930 0 : py_system_name = Py_None;
1931 0 : Py_INCREF(py_system_name);
1932 : } else {
1933 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
1934 : }
1935 0 : return py_system_name;
1936 : }
1937 :
1938 0 : static int py_winreg_OpenHKCU_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
1939 : {
1940 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(py_obj);
1941 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
1942 0 : if (value == NULL) {
1943 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
1944 0 : return -1;
1945 : }
1946 0 : if (value == Py_None) {
1947 0 : object->in.system_name = NULL;
1948 : } else {
1949 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
1950 0 : if (object->in.system_name == NULL) {
1951 0 : PyErr_NoMemory();
1952 0 : return -1;
1953 : }
1954 : {
1955 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
1956 0 : if (PyLong_Check(value)) {
1957 : unsigned long long test_var;
1958 0 : test_var = PyLong_AsUnsignedLongLong(value);
1959 0 : if (PyErr_Occurred() != NULL) {
1960 0 : return -1;
1961 : }
1962 0 : if (test_var > uint_max) {
1963 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1964 : PyLong_Type.tp_name, uint_max, test_var);
1965 0 : return -1;
1966 : }
1967 0 : *object->in.system_name = test_var;
1968 : } else {
1969 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1970 : PyLong_Type.tp_name);
1971 0 : return -1;
1972 : }
1973 : }
1974 : }
1975 0 : return 0;
1976 : }
1977 :
1978 0 : static PyObject *py_winreg_OpenHKCU_in_get_access_mask(PyObject *obj, void *closure)
1979 : {
1980 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(obj);
1981 : PyObject *py_access_mask;
1982 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
1983 0 : return py_access_mask;
1984 : }
1985 :
1986 0 : static int py_winreg_OpenHKCU_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
1987 : {
1988 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(py_obj);
1989 0 : if (value == NULL) {
1990 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
1991 0 : return -1;
1992 : }
1993 : {
1994 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
1995 0 : if (PyLong_Check(value)) {
1996 : unsigned long long test_var;
1997 0 : test_var = PyLong_AsUnsignedLongLong(value);
1998 0 : if (PyErr_Occurred() != NULL) {
1999 0 : return -1;
2000 : }
2001 0 : if (test_var > uint_max) {
2002 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2003 : PyLong_Type.tp_name, uint_max, test_var);
2004 0 : return -1;
2005 : }
2006 0 : object->in.access_mask = test_var;
2007 : } else {
2008 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2009 : PyLong_Type.tp_name);
2010 0 : return -1;
2011 : }
2012 : }
2013 0 : return 0;
2014 : }
2015 :
2016 0 : static PyObject *py_winreg_OpenHKCU_out_get_handle(PyObject *obj, void *closure)
2017 : {
2018 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(obj);
2019 : PyObject *py_handle;
2020 0 : if (object->out.handle == NULL) {
2021 0 : Py_RETURN_NONE;
2022 : }
2023 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
2024 0 : return py_handle;
2025 : }
2026 :
2027 0 : static int py_winreg_OpenHKCU_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
2028 : {
2029 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(py_obj);
2030 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
2031 0 : if (value == NULL) {
2032 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
2033 0 : return -1;
2034 : }
2035 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
2036 0 : if (object->out.handle == NULL) {
2037 0 : PyErr_NoMemory();
2038 0 : return -1;
2039 : }
2040 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
2041 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2042 0 : PyErr_NoMemory();
2043 0 : return -1;
2044 : }
2045 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
2046 0 : return 0;
2047 : }
2048 :
2049 0 : static PyObject *py_winreg_OpenHKCU_get_result(PyObject *obj, void *closure)
2050 : {
2051 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(obj);
2052 : PyObject *py_result;
2053 0 : py_result = PyErr_FromWERROR(object->out.result);
2054 0 : return py_result;
2055 : }
2056 :
2057 0 : static int py_winreg_OpenHKCU_set_result(PyObject *py_obj, PyObject *value, void *closure)
2058 : {
2059 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(py_obj);
2060 0 : if (value == NULL) {
2061 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
2062 0 : return -1;
2063 : }
2064 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
2065 0 : return 0;
2066 : }
2067 :
2068 : static PyGetSetDef py_winreg_OpenHKCU_getsetters[] = {
2069 : {
2070 : .name = discard_const_p(char, "in_system_name"),
2071 : .get = py_winreg_OpenHKCU_in_get_system_name,
2072 : .set = py_winreg_OpenHKCU_in_set_system_name,
2073 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2074 : },
2075 : {
2076 : .name = discard_const_p(char, "in_access_mask"),
2077 : .get = py_winreg_OpenHKCU_in_get_access_mask,
2078 : .set = py_winreg_OpenHKCU_in_set_access_mask,
2079 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
2080 : },
2081 : {
2082 : .name = discard_const_p(char, "out_handle"),
2083 : .get = py_winreg_OpenHKCU_out_get_handle,
2084 : .set = py_winreg_OpenHKCU_out_set_handle,
2085 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
2086 : },
2087 : {
2088 : .name = discard_const_p(char, "result"),
2089 : .get = py_winreg_OpenHKCU_get_result,
2090 : .set = py_winreg_OpenHKCU_set_result,
2091 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
2092 : },
2093 : { .name = NULL }
2094 : };
2095 :
2096 0 : static PyObject *py_winreg_OpenHKCU_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2097 : {
2098 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKCU, type);
2099 0 : struct winreg_OpenHKCU *_self = (struct winreg_OpenHKCU *)pytalloc_get_ptr(self);
2100 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
2101 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
2102 0 : return self;
2103 : }
2104 :
2105 0 : static PyObject *py_winreg_OpenHKCU_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
2106 : {
2107 :
2108 :
2109 0 : return PyLong_FromLong(1);
2110 : }
2111 :
2112 0 : static PyObject *py_winreg_OpenHKCU_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
2113 : {
2114 0 : const struct ndr_interface_call *call = NULL;
2115 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(py_obj);
2116 0 : PyObject *ret = NULL;
2117 0 : struct ndr_push *push = NULL;
2118 : DATA_BLOB blob;
2119 : enum ndr_err_code err;
2120 :
2121 0 : if (ndr_table_winreg.num_calls < 2) {
2122 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCU_ndr_pack");
2123 0 : return NULL;
2124 : }
2125 0 : call = &ndr_table_winreg.calls[1];
2126 :
2127 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
2128 0 : if (push == NULL) {
2129 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2130 0 : return NULL;
2131 : }
2132 :
2133 0 : push->flags |= ndr_push_flags;
2134 :
2135 0 : err = call->ndr_push(push, ndr_inout_flags, object);
2136 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2137 0 : TALLOC_FREE(push);
2138 0 : PyErr_SetNdrError(err);
2139 0 : return NULL;
2140 : }
2141 0 : blob = ndr_push_blob(push);
2142 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2143 0 : TALLOC_FREE(push);
2144 0 : return ret;
2145 : }
2146 :
2147 0 : static PyObject *py_winreg_OpenHKCU_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2148 : {
2149 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2150 0 : PyObject *bigendian_obj = NULL;
2151 0 : PyObject *ndr64_obj = NULL;
2152 0 : libndr_flags ndr_push_flags = 0;
2153 :
2154 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
2155 : discard_const_p(char *, kwnames),
2156 : &bigendian_obj,
2157 : &ndr64_obj)) {
2158 0 : return NULL;
2159 : }
2160 :
2161 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2162 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2163 : }
2164 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2165 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2166 : }
2167 :
2168 0 : return py_winreg_OpenHKCU_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
2169 : }
2170 :
2171 0 : static PyObject *py_winreg_OpenHKCU_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2172 : {
2173 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2174 0 : PyObject *bigendian_obj = NULL;
2175 0 : PyObject *ndr64_obj = NULL;
2176 0 : libndr_flags ndr_push_flags = 0;
2177 :
2178 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
2179 : discard_const_p(char *, kwnames),
2180 : &bigendian_obj,
2181 : &ndr64_obj)) {
2182 0 : return NULL;
2183 : }
2184 :
2185 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2186 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2187 : }
2188 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2189 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2190 : }
2191 :
2192 0 : return py_winreg_OpenHKCU_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
2193 : }
2194 :
2195 0 : static PyObject *py_winreg_OpenHKCU_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
2196 : {
2197 0 : const struct ndr_interface_call *call = NULL;
2198 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(py_obj);
2199 0 : struct ndr_pull *pull = NULL;
2200 : enum ndr_err_code err;
2201 :
2202 0 : if (ndr_table_winreg.num_calls < 2) {
2203 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCU_ndr_unpack");
2204 0 : return NULL;
2205 : }
2206 0 : call = &ndr_table_winreg.calls[1];
2207 :
2208 0 : pull = ndr_pull_init_blob(blob, object);
2209 0 : if (pull == NULL) {
2210 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2211 0 : return NULL;
2212 : }
2213 :
2214 0 : pull->flags |= ndr_pull_flags;
2215 :
2216 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
2217 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2218 0 : TALLOC_FREE(pull);
2219 0 : PyErr_SetNdrError(err);
2220 0 : return NULL;
2221 : }
2222 0 : if (!allow_remaining) {
2223 : uint32_t highest_ofs;
2224 :
2225 0 : if (pull->offset > pull->relative_highest_offset) {
2226 0 : highest_ofs = pull->offset;
2227 : } else {
2228 0 : highest_ofs = pull->relative_highest_offset;
2229 : }
2230 0 : if (highest_ofs < pull->data_size) {
2231 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
2232 : "not all bytes consumed ofs[%u] size[%u]",
2233 : highest_ofs, pull->data_size);
2234 0 : TALLOC_FREE(pull);
2235 0 : PyErr_SetNdrError(err);
2236 0 : return NULL;
2237 : }
2238 : }
2239 :
2240 0 : TALLOC_FREE(pull);
2241 0 : Py_RETURN_NONE;
2242 : }
2243 :
2244 0 : static PyObject *py_winreg_OpenHKCU_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2245 : {
2246 : DATA_BLOB blob;
2247 0 : Py_ssize_t blob_length = 0;
2248 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2249 0 : PyObject *bigendian_obj = NULL;
2250 0 : PyObject *ndr64_obj = NULL;
2251 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2252 0 : PyObject *allow_remaining_obj = NULL;
2253 0 : bool allow_remaining = false;
2254 :
2255 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
2256 : discard_const_p(char *, kwnames),
2257 : &blob.data, &blob_length,
2258 : &bigendian_obj,
2259 : &ndr64_obj,
2260 : &allow_remaining_obj)) {
2261 0 : return NULL;
2262 : }
2263 0 : blob.length = blob_length;
2264 :
2265 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2266 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2267 : }
2268 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2269 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2270 : }
2271 :
2272 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2273 0 : allow_remaining = true;
2274 : }
2275 :
2276 0 : return py_winreg_OpenHKCU_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
2277 : }
2278 :
2279 0 : static PyObject *py_winreg_OpenHKCU_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2280 : {
2281 : DATA_BLOB blob;
2282 0 : Py_ssize_t blob_length = 0;
2283 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2284 0 : PyObject *bigendian_obj = NULL;
2285 0 : PyObject *ndr64_obj = NULL;
2286 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2287 0 : PyObject *allow_remaining_obj = NULL;
2288 0 : bool allow_remaining = false;
2289 :
2290 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
2291 : discard_const_p(char *, kwnames),
2292 : &blob.data, &blob_length,
2293 : &bigendian_obj,
2294 : &ndr64_obj,
2295 : &allow_remaining_obj)) {
2296 0 : return NULL;
2297 : }
2298 0 : blob.length = blob_length;
2299 :
2300 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2301 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2302 : }
2303 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2304 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2305 : }
2306 :
2307 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2308 0 : allow_remaining = true;
2309 : }
2310 :
2311 0 : return py_winreg_OpenHKCU_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
2312 : }
2313 :
2314 0 : static PyObject *py_winreg_OpenHKCU_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
2315 : {
2316 0 : const struct ndr_interface_call *call = NULL;
2317 0 : struct winreg_OpenHKCU *object = pytalloc_get_ptr(py_obj);
2318 : PyObject *ret;
2319 : char *retstr;
2320 :
2321 0 : if (ndr_table_winreg.num_calls < 2) {
2322 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCU_ndr_print");
2323 0 : return NULL;
2324 : }
2325 0 : call = &ndr_table_winreg.calls[1];
2326 :
2327 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
2328 0 : ret = PyUnicode_FromString(retstr);
2329 0 : TALLOC_FREE(retstr);
2330 :
2331 0 : return ret;
2332 : }
2333 :
2334 0 : static PyObject *py_winreg_OpenHKCU_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2335 : {
2336 0 : return py_winreg_OpenHKCU_ndr_print(py_obj, "winreg_OpenHKCU_in", NDR_IN);
2337 : }
2338 :
2339 0 : static PyObject *py_winreg_OpenHKCU_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2340 : {
2341 0 : return py_winreg_OpenHKCU_ndr_print(py_obj, "winreg_OpenHKCU_out", NDR_OUT);
2342 : }
2343 :
2344 : static PyMethodDef py_winreg_OpenHKCU_methods[] = {
2345 : { "opnum", (PyCFunction)py_winreg_OpenHKCU_ndr_opnum, METH_NOARGS|METH_CLASS,
2346 : "winreg.OpenHKCU.opnum() -> 1 (0x01) " },
2347 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
2348 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
2349 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
2350 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
2351 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
2352 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
2353 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
2354 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
2355 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKCU_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
2356 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKCU_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
2357 : { NULL, NULL, 0, NULL }
2358 : };
2359 :
2360 :
2361 : static PyTypeObject winreg_OpenHKCU_Type = {
2362 : PyVarObject_HEAD_INIT(NULL, 0)
2363 : .tp_name = "winreg.OpenHKCU",
2364 : .tp_getset = py_winreg_OpenHKCU_getsetters,
2365 : .tp_methods = py_winreg_OpenHKCU_methods,
2366 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2367 : .tp_new = py_winreg_OpenHKCU_new,
2368 : };
2369 :
2370 0 : static bool pack_py_winreg_OpenHKCU_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCU *r)
2371 : {
2372 : PyObject *py_system_name;
2373 : PyObject *py_access_mask;
2374 0 : const char *kwnames[] = {
2375 : "system_name", "access_mask", NULL
2376 : };
2377 :
2378 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCU", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2379 0 : return false;
2380 : }
2381 :
2382 0 : if (py_system_name == NULL) {
2383 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
2384 0 : return false;
2385 : }
2386 0 : if (py_system_name == Py_None) {
2387 0 : r->in.system_name = NULL;
2388 : } else {
2389 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2390 0 : if (r->in.system_name == NULL) {
2391 0 : PyErr_NoMemory();
2392 0 : return false;
2393 : }
2394 : {
2395 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
2396 0 : if (PyLong_Check(py_system_name)) {
2397 : unsigned long long test_var;
2398 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
2399 0 : if (PyErr_Occurred() != NULL) {
2400 0 : return false;
2401 : }
2402 0 : if (test_var > uint_max) {
2403 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2404 : PyLong_Type.tp_name, uint_max, test_var);
2405 0 : return false;
2406 : }
2407 0 : *r->in.system_name = test_var;
2408 : } else {
2409 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2410 : PyLong_Type.tp_name);
2411 0 : return false;
2412 : }
2413 : }
2414 : }
2415 0 : if (py_access_mask == NULL) {
2416 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
2417 0 : return false;
2418 : }
2419 : {
2420 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
2421 0 : if (PyLong_Check(py_access_mask)) {
2422 : unsigned long long test_var;
2423 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
2424 0 : if (PyErr_Occurred() != NULL) {
2425 0 : return false;
2426 : }
2427 0 : if (test_var > uint_max) {
2428 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2429 : PyLong_Type.tp_name, uint_max, test_var);
2430 0 : return false;
2431 : }
2432 0 : r->in.access_mask = test_var;
2433 : } else {
2434 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2435 : PyLong_Type.tp_name);
2436 0 : return false;
2437 : }
2438 : }
2439 0 : return true;
2440 : }
2441 :
2442 0 : static PyObject *unpack_py_winreg_OpenHKCU_args_out(struct winreg_OpenHKCU *r)
2443 : {
2444 : PyObject *result;
2445 : PyObject *py_handle;
2446 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2447 0 : result = py_handle;
2448 0 : if (!W_ERROR_IS_OK(r->out.result)) {
2449 0 : PyErr_SetWERROR(r->out.result);
2450 0 : return NULL;
2451 : }
2452 :
2453 0 : return result;
2454 : }
2455 :
2456 :
2457 0 : static PyObject *py_winreg_OpenHKLM_in_get_system_name(PyObject *obj, void *closure)
2458 : {
2459 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(obj);
2460 : PyObject *py_system_name;
2461 0 : if (object->in.system_name == NULL) {
2462 0 : Py_RETURN_NONE;
2463 : }
2464 0 : if (object->in.system_name == NULL) {
2465 0 : py_system_name = Py_None;
2466 0 : Py_INCREF(py_system_name);
2467 : } else {
2468 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
2469 : }
2470 0 : return py_system_name;
2471 : }
2472 :
2473 0 : static int py_winreg_OpenHKLM_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
2474 : {
2475 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(py_obj);
2476 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
2477 0 : if (value == NULL) {
2478 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
2479 0 : return -1;
2480 : }
2481 0 : if (value == Py_None) {
2482 0 : object->in.system_name = NULL;
2483 : } else {
2484 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
2485 0 : if (object->in.system_name == NULL) {
2486 0 : PyErr_NoMemory();
2487 0 : return -1;
2488 : }
2489 : {
2490 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
2491 0 : if (PyLong_Check(value)) {
2492 : unsigned long long test_var;
2493 0 : test_var = PyLong_AsUnsignedLongLong(value);
2494 0 : if (PyErr_Occurred() != NULL) {
2495 0 : return -1;
2496 : }
2497 0 : if (test_var > uint_max) {
2498 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2499 : PyLong_Type.tp_name, uint_max, test_var);
2500 0 : return -1;
2501 : }
2502 0 : *object->in.system_name = test_var;
2503 : } else {
2504 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2505 : PyLong_Type.tp_name);
2506 0 : return -1;
2507 : }
2508 : }
2509 : }
2510 0 : return 0;
2511 : }
2512 :
2513 0 : static PyObject *py_winreg_OpenHKLM_in_get_access_mask(PyObject *obj, void *closure)
2514 : {
2515 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(obj);
2516 : PyObject *py_access_mask;
2517 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
2518 0 : return py_access_mask;
2519 : }
2520 :
2521 0 : static int py_winreg_OpenHKLM_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
2522 : {
2523 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(py_obj);
2524 0 : if (value == NULL) {
2525 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
2526 0 : return -1;
2527 : }
2528 : {
2529 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
2530 0 : if (PyLong_Check(value)) {
2531 : unsigned long long test_var;
2532 0 : test_var = PyLong_AsUnsignedLongLong(value);
2533 0 : if (PyErr_Occurred() != NULL) {
2534 0 : return -1;
2535 : }
2536 0 : if (test_var > uint_max) {
2537 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2538 : PyLong_Type.tp_name, uint_max, test_var);
2539 0 : return -1;
2540 : }
2541 0 : object->in.access_mask = test_var;
2542 : } else {
2543 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2544 : PyLong_Type.tp_name);
2545 0 : return -1;
2546 : }
2547 : }
2548 0 : return 0;
2549 : }
2550 :
2551 0 : static PyObject *py_winreg_OpenHKLM_out_get_handle(PyObject *obj, void *closure)
2552 : {
2553 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(obj);
2554 : PyObject *py_handle;
2555 0 : if (object->out.handle == NULL) {
2556 0 : Py_RETURN_NONE;
2557 : }
2558 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
2559 0 : return py_handle;
2560 : }
2561 :
2562 0 : static int py_winreg_OpenHKLM_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
2563 : {
2564 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(py_obj);
2565 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
2566 0 : if (value == NULL) {
2567 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
2568 0 : return -1;
2569 : }
2570 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
2571 0 : if (object->out.handle == NULL) {
2572 0 : PyErr_NoMemory();
2573 0 : return -1;
2574 : }
2575 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
2576 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2577 0 : PyErr_NoMemory();
2578 0 : return -1;
2579 : }
2580 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
2581 0 : return 0;
2582 : }
2583 :
2584 0 : static PyObject *py_winreg_OpenHKLM_get_result(PyObject *obj, void *closure)
2585 : {
2586 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(obj);
2587 : PyObject *py_result;
2588 0 : py_result = PyErr_FromWERROR(object->out.result);
2589 0 : return py_result;
2590 : }
2591 :
2592 0 : static int py_winreg_OpenHKLM_set_result(PyObject *py_obj, PyObject *value, void *closure)
2593 : {
2594 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(py_obj);
2595 0 : if (value == NULL) {
2596 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
2597 0 : return -1;
2598 : }
2599 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
2600 0 : return 0;
2601 : }
2602 :
2603 : static PyGetSetDef py_winreg_OpenHKLM_getsetters[] = {
2604 : {
2605 : .name = discard_const_p(char, "in_system_name"),
2606 : .get = py_winreg_OpenHKLM_in_get_system_name,
2607 : .set = py_winreg_OpenHKLM_in_set_system_name,
2608 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2609 : },
2610 : {
2611 : .name = discard_const_p(char, "in_access_mask"),
2612 : .get = py_winreg_OpenHKLM_in_get_access_mask,
2613 : .set = py_winreg_OpenHKLM_in_set_access_mask,
2614 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
2615 : },
2616 : {
2617 : .name = discard_const_p(char, "out_handle"),
2618 : .get = py_winreg_OpenHKLM_out_get_handle,
2619 : .set = py_winreg_OpenHKLM_out_set_handle,
2620 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
2621 : },
2622 : {
2623 : .name = discard_const_p(char, "result"),
2624 : .get = py_winreg_OpenHKLM_get_result,
2625 : .set = py_winreg_OpenHKLM_set_result,
2626 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
2627 : },
2628 : { .name = NULL }
2629 : };
2630 :
2631 0 : static PyObject *py_winreg_OpenHKLM_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2632 : {
2633 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKLM, type);
2634 0 : struct winreg_OpenHKLM *_self = (struct winreg_OpenHKLM *)pytalloc_get_ptr(self);
2635 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
2636 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
2637 0 : return self;
2638 : }
2639 :
2640 0 : static PyObject *py_winreg_OpenHKLM_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
2641 : {
2642 :
2643 :
2644 0 : return PyLong_FromLong(2);
2645 : }
2646 :
2647 0 : static PyObject *py_winreg_OpenHKLM_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
2648 : {
2649 0 : const struct ndr_interface_call *call = NULL;
2650 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(py_obj);
2651 0 : PyObject *ret = NULL;
2652 0 : struct ndr_push *push = NULL;
2653 : DATA_BLOB blob;
2654 : enum ndr_err_code err;
2655 :
2656 0 : if (ndr_table_winreg.num_calls < 3) {
2657 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKLM_ndr_pack");
2658 0 : return NULL;
2659 : }
2660 0 : call = &ndr_table_winreg.calls[2];
2661 :
2662 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
2663 0 : if (push == NULL) {
2664 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2665 0 : return NULL;
2666 : }
2667 :
2668 0 : push->flags |= ndr_push_flags;
2669 :
2670 0 : err = call->ndr_push(push, ndr_inout_flags, object);
2671 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2672 0 : TALLOC_FREE(push);
2673 0 : PyErr_SetNdrError(err);
2674 0 : return NULL;
2675 : }
2676 0 : blob = ndr_push_blob(push);
2677 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2678 0 : TALLOC_FREE(push);
2679 0 : return ret;
2680 : }
2681 :
2682 0 : static PyObject *py_winreg_OpenHKLM_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2683 : {
2684 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2685 0 : PyObject *bigendian_obj = NULL;
2686 0 : PyObject *ndr64_obj = NULL;
2687 0 : libndr_flags ndr_push_flags = 0;
2688 :
2689 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
2690 : discard_const_p(char *, kwnames),
2691 : &bigendian_obj,
2692 : &ndr64_obj)) {
2693 0 : return NULL;
2694 : }
2695 :
2696 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2697 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2698 : }
2699 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2700 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2701 : }
2702 :
2703 0 : return py_winreg_OpenHKLM_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
2704 : }
2705 :
2706 0 : static PyObject *py_winreg_OpenHKLM_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2707 : {
2708 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2709 0 : PyObject *bigendian_obj = NULL;
2710 0 : PyObject *ndr64_obj = NULL;
2711 0 : libndr_flags ndr_push_flags = 0;
2712 :
2713 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
2714 : discard_const_p(char *, kwnames),
2715 : &bigendian_obj,
2716 : &ndr64_obj)) {
2717 0 : return NULL;
2718 : }
2719 :
2720 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2721 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2722 : }
2723 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2724 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2725 : }
2726 :
2727 0 : return py_winreg_OpenHKLM_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
2728 : }
2729 :
2730 0 : static PyObject *py_winreg_OpenHKLM_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
2731 : {
2732 0 : const struct ndr_interface_call *call = NULL;
2733 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(py_obj);
2734 0 : struct ndr_pull *pull = NULL;
2735 : enum ndr_err_code err;
2736 :
2737 0 : if (ndr_table_winreg.num_calls < 3) {
2738 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKLM_ndr_unpack");
2739 0 : return NULL;
2740 : }
2741 0 : call = &ndr_table_winreg.calls[2];
2742 :
2743 0 : pull = ndr_pull_init_blob(blob, object);
2744 0 : if (pull == NULL) {
2745 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2746 0 : return NULL;
2747 : }
2748 :
2749 0 : pull->flags |= ndr_pull_flags;
2750 :
2751 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
2752 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2753 0 : TALLOC_FREE(pull);
2754 0 : PyErr_SetNdrError(err);
2755 0 : return NULL;
2756 : }
2757 0 : if (!allow_remaining) {
2758 : uint32_t highest_ofs;
2759 :
2760 0 : if (pull->offset > pull->relative_highest_offset) {
2761 0 : highest_ofs = pull->offset;
2762 : } else {
2763 0 : highest_ofs = pull->relative_highest_offset;
2764 : }
2765 0 : if (highest_ofs < pull->data_size) {
2766 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
2767 : "not all bytes consumed ofs[%u] size[%u]",
2768 : highest_ofs, pull->data_size);
2769 0 : TALLOC_FREE(pull);
2770 0 : PyErr_SetNdrError(err);
2771 0 : return NULL;
2772 : }
2773 : }
2774 :
2775 0 : TALLOC_FREE(pull);
2776 0 : Py_RETURN_NONE;
2777 : }
2778 :
2779 0 : static PyObject *py_winreg_OpenHKLM_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2780 : {
2781 : DATA_BLOB blob;
2782 0 : Py_ssize_t blob_length = 0;
2783 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2784 0 : PyObject *bigendian_obj = NULL;
2785 0 : PyObject *ndr64_obj = NULL;
2786 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2787 0 : PyObject *allow_remaining_obj = NULL;
2788 0 : bool allow_remaining = false;
2789 :
2790 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
2791 : discard_const_p(char *, kwnames),
2792 : &blob.data, &blob_length,
2793 : &bigendian_obj,
2794 : &ndr64_obj,
2795 : &allow_remaining_obj)) {
2796 0 : return NULL;
2797 : }
2798 0 : blob.length = blob_length;
2799 :
2800 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2801 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2802 : }
2803 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2804 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2805 : }
2806 :
2807 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2808 0 : allow_remaining = true;
2809 : }
2810 :
2811 0 : return py_winreg_OpenHKLM_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
2812 : }
2813 :
2814 0 : static PyObject *py_winreg_OpenHKLM_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2815 : {
2816 : DATA_BLOB blob;
2817 0 : Py_ssize_t blob_length = 0;
2818 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2819 0 : PyObject *bigendian_obj = NULL;
2820 0 : PyObject *ndr64_obj = NULL;
2821 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2822 0 : PyObject *allow_remaining_obj = NULL;
2823 0 : bool allow_remaining = false;
2824 :
2825 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
2826 : discard_const_p(char *, kwnames),
2827 : &blob.data, &blob_length,
2828 : &bigendian_obj,
2829 : &ndr64_obj,
2830 : &allow_remaining_obj)) {
2831 0 : return NULL;
2832 : }
2833 0 : blob.length = blob_length;
2834 :
2835 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2836 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2837 : }
2838 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2839 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2840 : }
2841 :
2842 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2843 0 : allow_remaining = true;
2844 : }
2845 :
2846 0 : return py_winreg_OpenHKLM_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
2847 : }
2848 :
2849 0 : static PyObject *py_winreg_OpenHKLM_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
2850 : {
2851 0 : const struct ndr_interface_call *call = NULL;
2852 0 : struct winreg_OpenHKLM *object = pytalloc_get_ptr(py_obj);
2853 : PyObject *ret;
2854 : char *retstr;
2855 :
2856 0 : if (ndr_table_winreg.num_calls < 3) {
2857 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKLM_ndr_print");
2858 0 : return NULL;
2859 : }
2860 0 : call = &ndr_table_winreg.calls[2];
2861 :
2862 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
2863 0 : ret = PyUnicode_FromString(retstr);
2864 0 : TALLOC_FREE(retstr);
2865 :
2866 0 : return ret;
2867 : }
2868 :
2869 0 : static PyObject *py_winreg_OpenHKLM_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2870 : {
2871 0 : return py_winreg_OpenHKLM_ndr_print(py_obj, "winreg_OpenHKLM_in", NDR_IN);
2872 : }
2873 :
2874 0 : static PyObject *py_winreg_OpenHKLM_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2875 : {
2876 0 : return py_winreg_OpenHKLM_ndr_print(py_obj, "winreg_OpenHKLM_out", NDR_OUT);
2877 : }
2878 :
2879 : static PyMethodDef py_winreg_OpenHKLM_methods[] = {
2880 : { "opnum", (PyCFunction)py_winreg_OpenHKLM_ndr_opnum, METH_NOARGS|METH_CLASS,
2881 : "winreg.OpenHKLM.opnum() -> 2 (0x02) " },
2882 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
2883 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
2884 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
2885 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
2886 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
2887 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
2888 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
2889 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
2890 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKLM_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
2891 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKLM_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
2892 : { NULL, NULL, 0, NULL }
2893 : };
2894 :
2895 :
2896 : static PyTypeObject winreg_OpenHKLM_Type = {
2897 : PyVarObject_HEAD_INIT(NULL, 0)
2898 : .tp_name = "winreg.OpenHKLM",
2899 : .tp_getset = py_winreg_OpenHKLM_getsetters,
2900 : .tp_methods = py_winreg_OpenHKLM_methods,
2901 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2902 : .tp_new = py_winreg_OpenHKLM_new,
2903 : };
2904 :
2905 3 : static bool pack_py_winreg_OpenHKLM_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKLM *r)
2906 : {
2907 : PyObject *py_system_name;
2908 : PyObject *py_access_mask;
2909 3 : const char *kwnames[] = {
2910 : "system_name", "access_mask", NULL
2911 : };
2912 :
2913 3 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKLM", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2914 0 : return false;
2915 : }
2916 :
2917 3 : if (py_system_name == NULL) {
2918 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
2919 0 : return false;
2920 : }
2921 3 : if (py_system_name == Py_None) {
2922 3 : r->in.system_name = NULL;
2923 : } else {
2924 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2925 0 : if (r->in.system_name == NULL) {
2926 0 : PyErr_NoMemory();
2927 0 : return false;
2928 : }
2929 : {
2930 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
2931 0 : if (PyLong_Check(py_system_name)) {
2932 : unsigned long long test_var;
2933 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
2934 0 : if (PyErr_Occurred() != NULL) {
2935 0 : return false;
2936 : }
2937 0 : if (test_var > uint_max) {
2938 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2939 : PyLong_Type.tp_name, uint_max, test_var);
2940 0 : return false;
2941 : }
2942 0 : *r->in.system_name = test_var;
2943 : } else {
2944 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2945 : PyLong_Type.tp_name);
2946 0 : return false;
2947 : }
2948 : }
2949 : }
2950 3 : if (py_access_mask == NULL) {
2951 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
2952 0 : return false;
2953 : }
2954 : {
2955 3 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
2956 3 : if (PyLong_Check(py_access_mask)) {
2957 : unsigned long long test_var;
2958 3 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
2959 3 : if (PyErr_Occurred() != NULL) {
2960 0 : return false;
2961 : }
2962 3 : if (test_var > uint_max) {
2963 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2964 : PyLong_Type.tp_name, uint_max, test_var);
2965 0 : return false;
2966 : }
2967 3 : r->in.access_mask = test_var;
2968 : } else {
2969 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2970 : PyLong_Type.tp_name);
2971 0 : return false;
2972 : }
2973 : }
2974 3 : return true;
2975 : }
2976 :
2977 3 : static PyObject *unpack_py_winreg_OpenHKLM_args_out(struct winreg_OpenHKLM *r)
2978 : {
2979 : PyObject *result;
2980 : PyObject *py_handle;
2981 3 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2982 3 : result = py_handle;
2983 3 : if (!W_ERROR_IS_OK(r->out.result)) {
2984 0 : PyErr_SetWERROR(r->out.result);
2985 0 : return NULL;
2986 : }
2987 :
2988 3 : return result;
2989 : }
2990 :
2991 :
2992 0 : static PyObject *py_winreg_OpenHKPD_in_get_system_name(PyObject *obj, void *closure)
2993 : {
2994 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(obj);
2995 : PyObject *py_system_name;
2996 0 : if (object->in.system_name == NULL) {
2997 0 : Py_RETURN_NONE;
2998 : }
2999 0 : if (object->in.system_name == NULL) {
3000 0 : py_system_name = Py_None;
3001 0 : Py_INCREF(py_system_name);
3002 : } else {
3003 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
3004 : }
3005 0 : return py_system_name;
3006 : }
3007 :
3008 0 : static int py_winreg_OpenHKPD_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
3009 : {
3010 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(py_obj);
3011 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
3012 0 : if (value == NULL) {
3013 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
3014 0 : return -1;
3015 : }
3016 0 : if (value == Py_None) {
3017 0 : object->in.system_name = NULL;
3018 : } else {
3019 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
3020 0 : if (object->in.system_name == NULL) {
3021 0 : PyErr_NoMemory();
3022 0 : return -1;
3023 : }
3024 : {
3025 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
3026 0 : if (PyLong_Check(value)) {
3027 : unsigned long long test_var;
3028 0 : test_var = PyLong_AsUnsignedLongLong(value);
3029 0 : if (PyErr_Occurred() != NULL) {
3030 0 : return -1;
3031 : }
3032 0 : if (test_var > uint_max) {
3033 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3034 : PyLong_Type.tp_name, uint_max, test_var);
3035 0 : return -1;
3036 : }
3037 0 : *object->in.system_name = test_var;
3038 : } else {
3039 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3040 : PyLong_Type.tp_name);
3041 0 : return -1;
3042 : }
3043 : }
3044 : }
3045 0 : return 0;
3046 : }
3047 :
3048 0 : static PyObject *py_winreg_OpenHKPD_in_get_access_mask(PyObject *obj, void *closure)
3049 : {
3050 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(obj);
3051 : PyObject *py_access_mask;
3052 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
3053 0 : return py_access_mask;
3054 : }
3055 :
3056 0 : static int py_winreg_OpenHKPD_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
3057 : {
3058 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(py_obj);
3059 0 : if (value == NULL) {
3060 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
3061 0 : return -1;
3062 : }
3063 : {
3064 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
3065 0 : if (PyLong_Check(value)) {
3066 : unsigned long long test_var;
3067 0 : test_var = PyLong_AsUnsignedLongLong(value);
3068 0 : if (PyErr_Occurred() != NULL) {
3069 0 : return -1;
3070 : }
3071 0 : if (test_var > uint_max) {
3072 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3073 : PyLong_Type.tp_name, uint_max, test_var);
3074 0 : return -1;
3075 : }
3076 0 : object->in.access_mask = test_var;
3077 : } else {
3078 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3079 : PyLong_Type.tp_name);
3080 0 : return -1;
3081 : }
3082 : }
3083 0 : return 0;
3084 : }
3085 :
3086 0 : static PyObject *py_winreg_OpenHKPD_out_get_handle(PyObject *obj, void *closure)
3087 : {
3088 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(obj);
3089 : PyObject *py_handle;
3090 0 : if (object->out.handle == NULL) {
3091 0 : Py_RETURN_NONE;
3092 : }
3093 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
3094 0 : return py_handle;
3095 : }
3096 :
3097 0 : static int py_winreg_OpenHKPD_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
3098 : {
3099 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(py_obj);
3100 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
3101 0 : if (value == NULL) {
3102 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
3103 0 : return -1;
3104 : }
3105 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
3106 0 : if (object->out.handle == NULL) {
3107 0 : PyErr_NoMemory();
3108 0 : return -1;
3109 : }
3110 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
3111 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3112 0 : PyErr_NoMemory();
3113 0 : return -1;
3114 : }
3115 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
3116 0 : return 0;
3117 : }
3118 :
3119 0 : static PyObject *py_winreg_OpenHKPD_get_result(PyObject *obj, void *closure)
3120 : {
3121 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(obj);
3122 : PyObject *py_result;
3123 0 : py_result = PyErr_FromWERROR(object->out.result);
3124 0 : return py_result;
3125 : }
3126 :
3127 0 : static int py_winreg_OpenHKPD_set_result(PyObject *py_obj, PyObject *value, void *closure)
3128 : {
3129 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(py_obj);
3130 0 : if (value == NULL) {
3131 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
3132 0 : return -1;
3133 : }
3134 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
3135 0 : return 0;
3136 : }
3137 :
3138 : static PyGetSetDef py_winreg_OpenHKPD_getsetters[] = {
3139 : {
3140 : .name = discard_const_p(char, "in_system_name"),
3141 : .get = py_winreg_OpenHKPD_in_get_system_name,
3142 : .set = py_winreg_OpenHKPD_in_set_system_name,
3143 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3144 : },
3145 : {
3146 : .name = discard_const_p(char, "in_access_mask"),
3147 : .get = py_winreg_OpenHKPD_in_get_access_mask,
3148 : .set = py_winreg_OpenHKPD_in_set_access_mask,
3149 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
3150 : },
3151 : {
3152 : .name = discard_const_p(char, "out_handle"),
3153 : .get = py_winreg_OpenHKPD_out_get_handle,
3154 : .set = py_winreg_OpenHKPD_out_set_handle,
3155 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
3156 : },
3157 : {
3158 : .name = discard_const_p(char, "result"),
3159 : .get = py_winreg_OpenHKPD_get_result,
3160 : .set = py_winreg_OpenHKPD_set_result,
3161 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
3162 : },
3163 : { .name = NULL }
3164 : };
3165 :
3166 0 : static PyObject *py_winreg_OpenHKPD_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3167 : {
3168 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKPD, type);
3169 0 : struct winreg_OpenHKPD *_self = (struct winreg_OpenHKPD *)pytalloc_get_ptr(self);
3170 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
3171 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3172 0 : return self;
3173 : }
3174 :
3175 0 : static PyObject *py_winreg_OpenHKPD_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
3176 : {
3177 :
3178 :
3179 0 : return PyLong_FromLong(3);
3180 : }
3181 :
3182 0 : static PyObject *py_winreg_OpenHKPD_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
3183 : {
3184 0 : const struct ndr_interface_call *call = NULL;
3185 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(py_obj);
3186 0 : PyObject *ret = NULL;
3187 0 : struct ndr_push *push = NULL;
3188 : DATA_BLOB blob;
3189 : enum ndr_err_code err;
3190 :
3191 0 : if (ndr_table_winreg.num_calls < 4) {
3192 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPD_ndr_pack");
3193 0 : return NULL;
3194 : }
3195 0 : call = &ndr_table_winreg.calls[3];
3196 :
3197 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
3198 0 : if (push == NULL) {
3199 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3200 0 : return NULL;
3201 : }
3202 :
3203 0 : push->flags |= ndr_push_flags;
3204 :
3205 0 : err = call->ndr_push(push, ndr_inout_flags, object);
3206 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3207 0 : TALLOC_FREE(push);
3208 0 : PyErr_SetNdrError(err);
3209 0 : return NULL;
3210 : }
3211 0 : blob = ndr_push_blob(push);
3212 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3213 0 : TALLOC_FREE(push);
3214 0 : return ret;
3215 : }
3216 :
3217 0 : static PyObject *py_winreg_OpenHKPD_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3218 : {
3219 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3220 0 : PyObject *bigendian_obj = NULL;
3221 0 : PyObject *ndr64_obj = NULL;
3222 0 : libndr_flags ndr_push_flags = 0;
3223 :
3224 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
3225 : discard_const_p(char *, kwnames),
3226 : &bigendian_obj,
3227 : &ndr64_obj)) {
3228 0 : return NULL;
3229 : }
3230 :
3231 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3232 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3233 : }
3234 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3235 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3236 : }
3237 :
3238 0 : return py_winreg_OpenHKPD_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
3239 : }
3240 :
3241 0 : static PyObject *py_winreg_OpenHKPD_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3242 : {
3243 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3244 0 : PyObject *bigendian_obj = NULL;
3245 0 : PyObject *ndr64_obj = NULL;
3246 0 : libndr_flags ndr_push_flags = 0;
3247 :
3248 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
3249 : discard_const_p(char *, kwnames),
3250 : &bigendian_obj,
3251 : &ndr64_obj)) {
3252 0 : return NULL;
3253 : }
3254 :
3255 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3256 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3257 : }
3258 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3259 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3260 : }
3261 :
3262 0 : return py_winreg_OpenHKPD_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
3263 : }
3264 :
3265 0 : static PyObject *py_winreg_OpenHKPD_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
3266 : {
3267 0 : const struct ndr_interface_call *call = NULL;
3268 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(py_obj);
3269 0 : struct ndr_pull *pull = NULL;
3270 : enum ndr_err_code err;
3271 :
3272 0 : if (ndr_table_winreg.num_calls < 4) {
3273 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPD_ndr_unpack");
3274 0 : return NULL;
3275 : }
3276 0 : call = &ndr_table_winreg.calls[3];
3277 :
3278 0 : pull = ndr_pull_init_blob(blob, object);
3279 0 : if (pull == NULL) {
3280 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3281 0 : return NULL;
3282 : }
3283 :
3284 0 : pull->flags |= ndr_pull_flags;
3285 :
3286 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
3287 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3288 0 : TALLOC_FREE(pull);
3289 0 : PyErr_SetNdrError(err);
3290 0 : return NULL;
3291 : }
3292 0 : if (!allow_remaining) {
3293 : uint32_t highest_ofs;
3294 :
3295 0 : if (pull->offset > pull->relative_highest_offset) {
3296 0 : highest_ofs = pull->offset;
3297 : } else {
3298 0 : highest_ofs = pull->relative_highest_offset;
3299 : }
3300 0 : if (highest_ofs < pull->data_size) {
3301 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
3302 : "not all bytes consumed ofs[%u] size[%u]",
3303 : highest_ofs, pull->data_size);
3304 0 : TALLOC_FREE(pull);
3305 0 : PyErr_SetNdrError(err);
3306 0 : return NULL;
3307 : }
3308 : }
3309 :
3310 0 : TALLOC_FREE(pull);
3311 0 : Py_RETURN_NONE;
3312 : }
3313 :
3314 0 : static PyObject *py_winreg_OpenHKPD_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3315 : {
3316 : DATA_BLOB blob;
3317 0 : Py_ssize_t blob_length = 0;
3318 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3319 0 : PyObject *bigendian_obj = NULL;
3320 0 : PyObject *ndr64_obj = NULL;
3321 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3322 0 : PyObject *allow_remaining_obj = NULL;
3323 0 : bool allow_remaining = false;
3324 :
3325 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
3326 : discard_const_p(char *, kwnames),
3327 : &blob.data, &blob_length,
3328 : &bigendian_obj,
3329 : &ndr64_obj,
3330 : &allow_remaining_obj)) {
3331 0 : return NULL;
3332 : }
3333 0 : blob.length = blob_length;
3334 :
3335 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3336 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3337 : }
3338 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3339 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3340 : }
3341 :
3342 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3343 0 : allow_remaining = true;
3344 : }
3345 :
3346 0 : return py_winreg_OpenHKPD_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
3347 : }
3348 :
3349 0 : static PyObject *py_winreg_OpenHKPD_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3350 : {
3351 : DATA_BLOB blob;
3352 0 : Py_ssize_t blob_length = 0;
3353 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3354 0 : PyObject *bigendian_obj = NULL;
3355 0 : PyObject *ndr64_obj = NULL;
3356 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3357 0 : PyObject *allow_remaining_obj = NULL;
3358 0 : bool allow_remaining = false;
3359 :
3360 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
3361 : discard_const_p(char *, kwnames),
3362 : &blob.data, &blob_length,
3363 : &bigendian_obj,
3364 : &ndr64_obj,
3365 : &allow_remaining_obj)) {
3366 0 : return NULL;
3367 : }
3368 0 : blob.length = blob_length;
3369 :
3370 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3371 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3372 : }
3373 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3374 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3375 : }
3376 :
3377 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3378 0 : allow_remaining = true;
3379 : }
3380 :
3381 0 : return py_winreg_OpenHKPD_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
3382 : }
3383 :
3384 0 : static PyObject *py_winreg_OpenHKPD_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
3385 : {
3386 0 : const struct ndr_interface_call *call = NULL;
3387 0 : struct winreg_OpenHKPD *object = pytalloc_get_ptr(py_obj);
3388 : PyObject *ret;
3389 : char *retstr;
3390 :
3391 0 : if (ndr_table_winreg.num_calls < 4) {
3392 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPD_ndr_print");
3393 0 : return NULL;
3394 : }
3395 0 : call = &ndr_table_winreg.calls[3];
3396 :
3397 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
3398 0 : ret = PyUnicode_FromString(retstr);
3399 0 : TALLOC_FREE(retstr);
3400 :
3401 0 : return ret;
3402 : }
3403 :
3404 0 : static PyObject *py_winreg_OpenHKPD_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3405 : {
3406 0 : return py_winreg_OpenHKPD_ndr_print(py_obj, "winreg_OpenHKPD_in", NDR_IN);
3407 : }
3408 :
3409 0 : static PyObject *py_winreg_OpenHKPD_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3410 : {
3411 0 : return py_winreg_OpenHKPD_ndr_print(py_obj, "winreg_OpenHKPD_out", NDR_OUT);
3412 : }
3413 :
3414 : static PyMethodDef py_winreg_OpenHKPD_methods[] = {
3415 : { "opnum", (PyCFunction)py_winreg_OpenHKPD_ndr_opnum, METH_NOARGS|METH_CLASS,
3416 : "winreg.OpenHKPD.opnum() -> 3 (0x03) " },
3417 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
3418 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
3419 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
3420 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
3421 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
3422 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
3423 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
3424 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
3425 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKPD_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
3426 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKPD_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
3427 : { NULL, NULL, 0, NULL }
3428 : };
3429 :
3430 :
3431 : static PyTypeObject winreg_OpenHKPD_Type = {
3432 : PyVarObject_HEAD_INIT(NULL, 0)
3433 : .tp_name = "winreg.OpenHKPD",
3434 : .tp_getset = py_winreg_OpenHKPD_getsetters,
3435 : .tp_methods = py_winreg_OpenHKPD_methods,
3436 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3437 : .tp_new = py_winreg_OpenHKPD_new,
3438 : };
3439 :
3440 0 : static bool pack_py_winreg_OpenHKPD_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPD *r)
3441 : {
3442 : PyObject *py_system_name;
3443 : PyObject *py_access_mask;
3444 0 : const char *kwnames[] = {
3445 : "system_name", "access_mask", NULL
3446 : };
3447 :
3448 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPD", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
3449 0 : return false;
3450 : }
3451 :
3452 0 : if (py_system_name == NULL) {
3453 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
3454 0 : return false;
3455 : }
3456 0 : if (py_system_name == Py_None) {
3457 0 : r->in.system_name = NULL;
3458 : } else {
3459 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
3460 0 : if (r->in.system_name == NULL) {
3461 0 : PyErr_NoMemory();
3462 0 : return false;
3463 : }
3464 : {
3465 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
3466 0 : if (PyLong_Check(py_system_name)) {
3467 : unsigned long long test_var;
3468 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
3469 0 : if (PyErr_Occurred() != NULL) {
3470 0 : return false;
3471 : }
3472 0 : if (test_var > uint_max) {
3473 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3474 : PyLong_Type.tp_name, uint_max, test_var);
3475 0 : return false;
3476 : }
3477 0 : *r->in.system_name = test_var;
3478 : } else {
3479 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3480 : PyLong_Type.tp_name);
3481 0 : return false;
3482 : }
3483 : }
3484 : }
3485 0 : if (py_access_mask == NULL) {
3486 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
3487 0 : return false;
3488 : }
3489 : {
3490 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
3491 0 : if (PyLong_Check(py_access_mask)) {
3492 : unsigned long long test_var;
3493 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
3494 0 : if (PyErr_Occurred() != NULL) {
3495 0 : return false;
3496 : }
3497 0 : if (test_var > uint_max) {
3498 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3499 : PyLong_Type.tp_name, uint_max, test_var);
3500 0 : return false;
3501 : }
3502 0 : r->in.access_mask = test_var;
3503 : } else {
3504 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3505 : PyLong_Type.tp_name);
3506 0 : return false;
3507 : }
3508 : }
3509 0 : return true;
3510 : }
3511 :
3512 0 : static PyObject *unpack_py_winreg_OpenHKPD_args_out(struct winreg_OpenHKPD *r)
3513 : {
3514 : PyObject *result;
3515 : PyObject *py_handle;
3516 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
3517 0 : result = py_handle;
3518 0 : if (!W_ERROR_IS_OK(r->out.result)) {
3519 0 : PyErr_SetWERROR(r->out.result);
3520 0 : return NULL;
3521 : }
3522 :
3523 0 : return result;
3524 : }
3525 :
3526 :
3527 0 : static PyObject *py_winreg_OpenHKU_in_get_system_name(PyObject *obj, void *closure)
3528 : {
3529 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(obj);
3530 : PyObject *py_system_name;
3531 0 : if (object->in.system_name == NULL) {
3532 0 : Py_RETURN_NONE;
3533 : }
3534 0 : if (object->in.system_name == NULL) {
3535 0 : py_system_name = Py_None;
3536 0 : Py_INCREF(py_system_name);
3537 : } else {
3538 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
3539 : }
3540 0 : return py_system_name;
3541 : }
3542 :
3543 0 : static int py_winreg_OpenHKU_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
3544 : {
3545 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(py_obj);
3546 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
3547 0 : if (value == NULL) {
3548 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
3549 0 : return -1;
3550 : }
3551 0 : if (value == Py_None) {
3552 0 : object->in.system_name = NULL;
3553 : } else {
3554 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
3555 0 : if (object->in.system_name == NULL) {
3556 0 : PyErr_NoMemory();
3557 0 : return -1;
3558 : }
3559 : {
3560 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
3561 0 : if (PyLong_Check(value)) {
3562 : unsigned long long test_var;
3563 0 : test_var = PyLong_AsUnsignedLongLong(value);
3564 0 : if (PyErr_Occurred() != NULL) {
3565 0 : return -1;
3566 : }
3567 0 : if (test_var > uint_max) {
3568 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3569 : PyLong_Type.tp_name, uint_max, test_var);
3570 0 : return -1;
3571 : }
3572 0 : *object->in.system_name = test_var;
3573 : } else {
3574 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3575 : PyLong_Type.tp_name);
3576 0 : return -1;
3577 : }
3578 : }
3579 : }
3580 0 : return 0;
3581 : }
3582 :
3583 0 : static PyObject *py_winreg_OpenHKU_in_get_access_mask(PyObject *obj, void *closure)
3584 : {
3585 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(obj);
3586 : PyObject *py_access_mask;
3587 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
3588 0 : return py_access_mask;
3589 : }
3590 :
3591 0 : static int py_winreg_OpenHKU_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
3592 : {
3593 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(py_obj);
3594 0 : if (value == NULL) {
3595 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
3596 0 : return -1;
3597 : }
3598 : {
3599 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
3600 0 : if (PyLong_Check(value)) {
3601 : unsigned long long test_var;
3602 0 : test_var = PyLong_AsUnsignedLongLong(value);
3603 0 : if (PyErr_Occurred() != NULL) {
3604 0 : return -1;
3605 : }
3606 0 : if (test_var > uint_max) {
3607 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3608 : PyLong_Type.tp_name, uint_max, test_var);
3609 0 : return -1;
3610 : }
3611 0 : object->in.access_mask = test_var;
3612 : } else {
3613 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3614 : PyLong_Type.tp_name);
3615 0 : return -1;
3616 : }
3617 : }
3618 0 : return 0;
3619 : }
3620 :
3621 0 : static PyObject *py_winreg_OpenHKU_out_get_handle(PyObject *obj, void *closure)
3622 : {
3623 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(obj);
3624 : PyObject *py_handle;
3625 0 : if (object->out.handle == NULL) {
3626 0 : Py_RETURN_NONE;
3627 : }
3628 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
3629 0 : return py_handle;
3630 : }
3631 :
3632 0 : static int py_winreg_OpenHKU_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
3633 : {
3634 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(py_obj);
3635 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
3636 0 : if (value == NULL) {
3637 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
3638 0 : return -1;
3639 : }
3640 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
3641 0 : if (object->out.handle == NULL) {
3642 0 : PyErr_NoMemory();
3643 0 : return -1;
3644 : }
3645 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
3646 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3647 0 : PyErr_NoMemory();
3648 0 : return -1;
3649 : }
3650 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
3651 0 : return 0;
3652 : }
3653 :
3654 0 : static PyObject *py_winreg_OpenHKU_get_result(PyObject *obj, void *closure)
3655 : {
3656 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(obj);
3657 : PyObject *py_result;
3658 0 : py_result = PyErr_FromWERROR(object->out.result);
3659 0 : return py_result;
3660 : }
3661 :
3662 0 : static int py_winreg_OpenHKU_set_result(PyObject *py_obj, PyObject *value, void *closure)
3663 : {
3664 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(py_obj);
3665 0 : if (value == NULL) {
3666 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
3667 0 : return -1;
3668 : }
3669 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
3670 0 : return 0;
3671 : }
3672 :
3673 : static PyGetSetDef py_winreg_OpenHKU_getsetters[] = {
3674 : {
3675 : .name = discard_const_p(char, "in_system_name"),
3676 : .get = py_winreg_OpenHKU_in_get_system_name,
3677 : .set = py_winreg_OpenHKU_in_set_system_name,
3678 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3679 : },
3680 : {
3681 : .name = discard_const_p(char, "in_access_mask"),
3682 : .get = py_winreg_OpenHKU_in_get_access_mask,
3683 : .set = py_winreg_OpenHKU_in_set_access_mask,
3684 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
3685 : },
3686 : {
3687 : .name = discard_const_p(char, "out_handle"),
3688 : .get = py_winreg_OpenHKU_out_get_handle,
3689 : .set = py_winreg_OpenHKU_out_set_handle,
3690 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
3691 : },
3692 : {
3693 : .name = discard_const_p(char, "result"),
3694 : .get = py_winreg_OpenHKU_get_result,
3695 : .set = py_winreg_OpenHKU_set_result,
3696 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
3697 : },
3698 : { .name = NULL }
3699 : };
3700 :
3701 0 : static PyObject *py_winreg_OpenHKU_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3702 : {
3703 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKU, type);
3704 0 : struct winreg_OpenHKU *_self = (struct winreg_OpenHKU *)pytalloc_get_ptr(self);
3705 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
3706 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3707 0 : return self;
3708 : }
3709 :
3710 0 : static PyObject *py_winreg_OpenHKU_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
3711 : {
3712 :
3713 :
3714 0 : return PyLong_FromLong(4);
3715 : }
3716 :
3717 0 : static PyObject *py_winreg_OpenHKU_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
3718 : {
3719 0 : const struct ndr_interface_call *call = NULL;
3720 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(py_obj);
3721 0 : PyObject *ret = NULL;
3722 0 : struct ndr_push *push = NULL;
3723 : DATA_BLOB blob;
3724 : enum ndr_err_code err;
3725 :
3726 0 : if (ndr_table_winreg.num_calls < 5) {
3727 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKU_ndr_pack");
3728 0 : return NULL;
3729 : }
3730 0 : call = &ndr_table_winreg.calls[4];
3731 :
3732 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
3733 0 : if (push == NULL) {
3734 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3735 0 : return NULL;
3736 : }
3737 :
3738 0 : push->flags |= ndr_push_flags;
3739 :
3740 0 : err = call->ndr_push(push, ndr_inout_flags, object);
3741 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3742 0 : TALLOC_FREE(push);
3743 0 : PyErr_SetNdrError(err);
3744 0 : return NULL;
3745 : }
3746 0 : blob = ndr_push_blob(push);
3747 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3748 0 : TALLOC_FREE(push);
3749 0 : return ret;
3750 : }
3751 :
3752 0 : static PyObject *py_winreg_OpenHKU_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3753 : {
3754 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3755 0 : PyObject *bigendian_obj = NULL;
3756 0 : PyObject *ndr64_obj = NULL;
3757 0 : libndr_flags ndr_push_flags = 0;
3758 :
3759 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
3760 : discard_const_p(char *, kwnames),
3761 : &bigendian_obj,
3762 : &ndr64_obj)) {
3763 0 : return NULL;
3764 : }
3765 :
3766 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3767 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3768 : }
3769 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3770 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3771 : }
3772 :
3773 0 : return py_winreg_OpenHKU_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
3774 : }
3775 :
3776 0 : static PyObject *py_winreg_OpenHKU_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3777 : {
3778 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3779 0 : PyObject *bigendian_obj = NULL;
3780 0 : PyObject *ndr64_obj = NULL;
3781 0 : libndr_flags ndr_push_flags = 0;
3782 :
3783 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
3784 : discard_const_p(char *, kwnames),
3785 : &bigendian_obj,
3786 : &ndr64_obj)) {
3787 0 : return NULL;
3788 : }
3789 :
3790 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3791 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3792 : }
3793 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3794 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3795 : }
3796 :
3797 0 : return py_winreg_OpenHKU_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
3798 : }
3799 :
3800 0 : static PyObject *py_winreg_OpenHKU_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
3801 : {
3802 0 : const struct ndr_interface_call *call = NULL;
3803 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(py_obj);
3804 0 : struct ndr_pull *pull = NULL;
3805 : enum ndr_err_code err;
3806 :
3807 0 : if (ndr_table_winreg.num_calls < 5) {
3808 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKU_ndr_unpack");
3809 0 : return NULL;
3810 : }
3811 0 : call = &ndr_table_winreg.calls[4];
3812 :
3813 0 : pull = ndr_pull_init_blob(blob, object);
3814 0 : if (pull == NULL) {
3815 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3816 0 : return NULL;
3817 : }
3818 :
3819 0 : pull->flags |= ndr_pull_flags;
3820 :
3821 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
3822 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3823 0 : TALLOC_FREE(pull);
3824 0 : PyErr_SetNdrError(err);
3825 0 : return NULL;
3826 : }
3827 0 : if (!allow_remaining) {
3828 : uint32_t highest_ofs;
3829 :
3830 0 : if (pull->offset > pull->relative_highest_offset) {
3831 0 : highest_ofs = pull->offset;
3832 : } else {
3833 0 : highest_ofs = pull->relative_highest_offset;
3834 : }
3835 0 : if (highest_ofs < pull->data_size) {
3836 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
3837 : "not all bytes consumed ofs[%u] size[%u]",
3838 : highest_ofs, pull->data_size);
3839 0 : TALLOC_FREE(pull);
3840 0 : PyErr_SetNdrError(err);
3841 0 : return NULL;
3842 : }
3843 : }
3844 :
3845 0 : TALLOC_FREE(pull);
3846 0 : Py_RETURN_NONE;
3847 : }
3848 :
3849 0 : static PyObject *py_winreg_OpenHKU_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3850 : {
3851 : DATA_BLOB blob;
3852 0 : Py_ssize_t blob_length = 0;
3853 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3854 0 : PyObject *bigendian_obj = NULL;
3855 0 : PyObject *ndr64_obj = NULL;
3856 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3857 0 : PyObject *allow_remaining_obj = NULL;
3858 0 : bool allow_remaining = false;
3859 :
3860 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
3861 : discard_const_p(char *, kwnames),
3862 : &blob.data, &blob_length,
3863 : &bigendian_obj,
3864 : &ndr64_obj,
3865 : &allow_remaining_obj)) {
3866 0 : return NULL;
3867 : }
3868 0 : blob.length = blob_length;
3869 :
3870 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3871 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3872 : }
3873 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3874 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3875 : }
3876 :
3877 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3878 0 : allow_remaining = true;
3879 : }
3880 :
3881 0 : return py_winreg_OpenHKU_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
3882 : }
3883 :
3884 0 : static PyObject *py_winreg_OpenHKU_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3885 : {
3886 : DATA_BLOB blob;
3887 0 : Py_ssize_t blob_length = 0;
3888 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3889 0 : PyObject *bigendian_obj = NULL;
3890 0 : PyObject *ndr64_obj = NULL;
3891 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3892 0 : PyObject *allow_remaining_obj = NULL;
3893 0 : bool allow_remaining = false;
3894 :
3895 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
3896 : discard_const_p(char *, kwnames),
3897 : &blob.data, &blob_length,
3898 : &bigendian_obj,
3899 : &ndr64_obj,
3900 : &allow_remaining_obj)) {
3901 0 : return NULL;
3902 : }
3903 0 : blob.length = blob_length;
3904 :
3905 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3906 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3907 : }
3908 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3909 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3910 : }
3911 :
3912 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3913 0 : allow_remaining = true;
3914 : }
3915 :
3916 0 : return py_winreg_OpenHKU_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
3917 : }
3918 :
3919 0 : static PyObject *py_winreg_OpenHKU_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
3920 : {
3921 0 : const struct ndr_interface_call *call = NULL;
3922 0 : struct winreg_OpenHKU *object = pytalloc_get_ptr(py_obj);
3923 : PyObject *ret;
3924 : char *retstr;
3925 :
3926 0 : if (ndr_table_winreg.num_calls < 5) {
3927 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKU_ndr_print");
3928 0 : return NULL;
3929 : }
3930 0 : call = &ndr_table_winreg.calls[4];
3931 :
3932 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
3933 0 : ret = PyUnicode_FromString(retstr);
3934 0 : TALLOC_FREE(retstr);
3935 :
3936 0 : return ret;
3937 : }
3938 :
3939 0 : static PyObject *py_winreg_OpenHKU_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3940 : {
3941 0 : return py_winreg_OpenHKU_ndr_print(py_obj, "winreg_OpenHKU_in", NDR_IN);
3942 : }
3943 :
3944 0 : static PyObject *py_winreg_OpenHKU_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3945 : {
3946 0 : return py_winreg_OpenHKU_ndr_print(py_obj, "winreg_OpenHKU_out", NDR_OUT);
3947 : }
3948 :
3949 : static PyMethodDef py_winreg_OpenHKU_methods[] = {
3950 : { "opnum", (PyCFunction)py_winreg_OpenHKU_ndr_opnum, METH_NOARGS|METH_CLASS,
3951 : "winreg.OpenHKU.opnum() -> 4 (0x04) " },
3952 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
3953 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
3954 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
3955 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
3956 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
3957 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
3958 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
3959 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
3960 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKU_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
3961 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKU_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
3962 : { NULL, NULL, 0, NULL }
3963 : };
3964 :
3965 :
3966 : static PyTypeObject winreg_OpenHKU_Type = {
3967 : PyVarObject_HEAD_INIT(NULL, 0)
3968 : .tp_name = "winreg.OpenHKU",
3969 : .tp_getset = py_winreg_OpenHKU_getsetters,
3970 : .tp_methods = py_winreg_OpenHKU_methods,
3971 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3972 : .tp_new = py_winreg_OpenHKU_new,
3973 : };
3974 :
3975 0 : static bool pack_py_winreg_OpenHKU_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKU *r)
3976 : {
3977 : PyObject *py_system_name;
3978 : PyObject *py_access_mask;
3979 0 : const char *kwnames[] = {
3980 : "system_name", "access_mask", NULL
3981 : };
3982 :
3983 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKU", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
3984 0 : return false;
3985 : }
3986 :
3987 0 : if (py_system_name == NULL) {
3988 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
3989 0 : return false;
3990 : }
3991 0 : if (py_system_name == Py_None) {
3992 0 : r->in.system_name = NULL;
3993 : } else {
3994 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
3995 0 : if (r->in.system_name == NULL) {
3996 0 : PyErr_NoMemory();
3997 0 : return false;
3998 : }
3999 : {
4000 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
4001 0 : if (PyLong_Check(py_system_name)) {
4002 : unsigned long long test_var;
4003 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
4004 0 : if (PyErr_Occurred() != NULL) {
4005 0 : return false;
4006 : }
4007 0 : if (test_var > uint_max) {
4008 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4009 : PyLong_Type.tp_name, uint_max, test_var);
4010 0 : return false;
4011 : }
4012 0 : *r->in.system_name = test_var;
4013 : } else {
4014 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4015 : PyLong_Type.tp_name);
4016 0 : return false;
4017 : }
4018 : }
4019 : }
4020 0 : if (py_access_mask == NULL) {
4021 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
4022 0 : return false;
4023 : }
4024 : {
4025 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
4026 0 : if (PyLong_Check(py_access_mask)) {
4027 : unsigned long long test_var;
4028 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
4029 0 : if (PyErr_Occurred() != NULL) {
4030 0 : return false;
4031 : }
4032 0 : if (test_var > uint_max) {
4033 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4034 : PyLong_Type.tp_name, uint_max, test_var);
4035 0 : return false;
4036 : }
4037 0 : r->in.access_mask = test_var;
4038 : } else {
4039 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4040 : PyLong_Type.tp_name);
4041 0 : return false;
4042 : }
4043 : }
4044 0 : return true;
4045 : }
4046 :
4047 0 : static PyObject *unpack_py_winreg_OpenHKU_args_out(struct winreg_OpenHKU *r)
4048 : {
4049 : PyObject *result;
4050 : PyObject *py_handle;
4051 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
4052 0 : result = py_handle;
4053 0 : if (!W_ERROR_IS_OK(r->out.result)) {
4054 0 : PyErr_SetWERROR(r->out.result);
4055 0 : return NULL;
4056 : }
4057 :
4058 0 : return result;
4059 : }
4060 :
4061 :
4062 0 : static PyObject *py_winreg_CloseKey_in_get_handle(PyObject *obj, void *closure)
4063 : {
4064 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(obj);
4065 : PyObject *py_handle;
4066 0 : if (object->in.handle == NULL) {
4067 0 : Py_RETURN_NONE;
4068 : }
4069 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
4070 0 : return py_handle;
4071 : }
4072 :
4073 0 : static int py_winreg_CloseKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
4074 : {
4075 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(py_obj);
4076 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
4077 0 : if (value == NULL) {
4078 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
4079 0 : return -1;
4080 : }
4081 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
4082 0 : if (object->in.handle == NULL) {
4083 0 : PyErr_NoMemory();
4084 0 : return -1;
4085 : }
4086 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4087 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4088 0 : PyErr_NoMemory();
4089 0 : return -1;
4090 : }
4091 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
4092 0 : return 0;
4093 : }
4094 :
4095 0 : static PyObject *py_winreg_CloseKey_out_get_handle(PyObject *obj, void *closure)
4096 : {
4097 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(obj);
4098 : PyObject *py_handle;
4099 0 : if (object->out.handle == NULL) {
4100 0 : Py_RETURN_NONE;
4101 : }
4102 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
4103 0 : return py_handle;
4104 : }
4105 :
4106 0 : static int py_winreg_CloseKey_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
4107 : {
4108 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(py_obj);
4109 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
4110 0 : if (value == NULL) {
4111 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
4112 0 : return -1;
4113 : }
4114 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
4115 0 : if (object->out.handle == NULL) {
4116 0 : PyErr_NoMemory();
4117 0 : return -1;
4118 : }
4119 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4120 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4121 0 : PyErr_NoMemory();
4122 0 : return -1;
4123 : }
4124 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
4125 0 : return 0;
4126 : }
4127 :
4128 0 : static PyObject *py_winreg_CloseKey_get_result(PyObject *obj, void *closure)
4129 : {
4130 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(obj);
4131 : PyObject *py_result;
4132 0 : py_result = PyErr_FromWERROR(object->out.result);
4133 0 : return py_result;
4134 : }
4135 :
4136 0 : static int py_winreg_CloseKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
4137 : {
4138 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(py_obj);
4139 0 : if (value == NULL) {
4140 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
4141 0 : return -1;
4142 : }
4143 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
4144 0 : return 0;
4145 : }
4146 :
4147 : static PyGetSetDef py_winreg_CloseKey_getsetters[] = {
4148 : {
4149 : .name = discard_const_p(char, "in_handle"),
4150 : .get = py_winreg_CloseKey_in_get_handle,
4151 : .set = py_winreg_CloseKey_in_set_handle,
4152 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4153 : },
4154 : {
4155 : .name = discard_const_p(char, "out_handle"),
4156 : .get = py_winreg_CloseKey_out_get_handle,
4157 : .set = py_winreg_CloseKey_out_set_handle,
4158 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4159 : },
4160 : {
4161 : .name = discard_const_p(char, "result"),
4162 : .get = py_winreg_CloseKey_get_result,
4163 : .set = py_winreg_CloseKey_set_result,
4164 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
4165 : },
4166 : { .name = NULL }
4167 : };
4168 :
4169 0 : static PyObject *py_winreg_CloseKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4170 : {
4171 0 : PyObject *self = pytalloc_new(struct winreg_CloseKey, type);
4172 0 : struct winreg_CloseKey *_self = (struct winreg_CloseKey *)pytalloc_get_ptr(self);
4173 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
4174 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
4175 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
4176 0 : return self;
4177 : }
4178 :
4179 0 : static PyObject *py_winreg_CloseKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
4180 : {
4181 :
4182 :
4183 0 : return PyLong_FromLong(5);
4184 : }
4185 :
4186 0 : static PyObject *py_winreg_CloseKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
4187 : {
4188 0 : const struct ndr_interface_call *call = NULL;
4189 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(py_obj);
4190 0 : PyObject *ret = NULL;
4191 0 : struct ndr_push *push = NULL;
4192 : DATA_BLOB blob;
4193 : enum ndr_err_code err;
4194 :
4195 0 : if (ndr_table_winreg.num_calls < 6) {
4196 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CloseKey_ndr_pack");
4197 0 : return NULL;
4198 : }
4199 0 : call = &ndr_table_winreg.calls[5];
4200 :
4201 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
4202 0 : if (push == NULL) {
4203 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4204 0 : return NULL;
4205 : }
4206 :
4207 0 : push->flags |= ndr_push_flags;
4208 :
4209 0 : err = call->ndr_push(push, ndr_inout_flags, object);
4210 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4211 0 : TALLOC_FREE(push);
4212 0 : PyErr_SetNdrError(err);
4213 0 : return NULL;
4214 : }
4215 0 : blob = ndr_push_blob(push);
4216 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4217 0 : TALLOC_FREE(push);
4218 0 : return ret;
4219 : }
4220 :
4221 0 : static PyObject *py_winreg_CloseKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4222 : {
4223 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4224 0 : PyObject *bigendian_obj = NULL;
4225 0 : PyObject *ndr64_obj = NULL;
4226 0 : libndr_flags ndr_push_flags = 0;
4227 :
4228 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
4229 : discard_const_p(char *, kwnames),
4230 : &bigendian_obj,
4231 : &ndr64_obj)) {
4232 0 : return NULL;
4233 : }
4234 :
4235 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4236 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
4237 : }
4238 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4239 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
4240 : }
4241 :
4242 0 : return py_winreg_CloseKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
4243 : }
4244 :
4245 0 : static PyObject *py_winreg_CloseKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4246 : {
4247 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4248 0 : PyObject *bigendian_obj = NULL;
4249 0 : PyObject *ndr64_obj = NULL;
4250 0 : libndr_flags ndr_push_flags = 0;
4251 :
4252 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
4253 : discard_const_p(char *, kwnames),
4254 : &bigendian_obj,
4255 : &ndr64_obj)) {
4256 0 : return NULL;
4257 : }
4258 :
4259 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4260 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
4261 : }
4262 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4263 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
4264 : }
4265 :
4266 0 : return py_winreg_CloseKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
4267 : }
4268 :
4269 0 : static PyObject *py_winreg_CloseKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
4270 : {
4271 0 : const struct ndr_interface_call *call = NULL;
4272 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(py_obj);
4273 0 : struct ndr_pull *pull = NULL;
4274 : enum ndr_err_code err;
4275 :
4276 0 : if (ndr_table_winreg.num_calls < 6) {
4277 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CloseKey_ndr_unpack");
4278 0 : return NULL;
4279 : }
4280 0 : call = &ndr_table_winreg.calls[5];
4281 :
4282 0 : pull = ndr_pull_init_blob(blob, object);
4283 0 : if (pull == NULL) {
4284 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4285 0 : return NULL;
4286 : }
4287 :
4288 0 : pull->flags |= ndr_pull_flags;
4289 :
4290 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
4291 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4292 0 : TALLOC_FREE(pull);
4293 0 : PyErr_SetNdrError(err);
4294 0 : return NULL;
4295 : }
4296 0 : if (!allow_remaining) {
4297 : uint32_t highest_ofs;
4298 :
4299 0 : if (pull->offset > pull->relative_highest_offset) {
4300 0 : highest_ofs = pull->offset;
4301 : } else {
4302 0 : highest_ofs = pull->relative_highest_offset;
4303 : }
4304 0 : if (highest_ofs < pull->data_size) {
4305 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
4306 : "not all bytes consumed ofs[%u] size[%u]",
4307 : highest_ofs, pull->data_size);
4308 0 : TALLOC_FREE(pull);
4309 0 : PyErr_SetNdrError(err);
4310 0 : return NULL;
4311 : }
4312 : }
4313 :
4314 0 : TALLOC_FREE(pull);
4315 0 : Py_RETURN_NONE;
4316 : }
4317 :
4318 0 : static PyObject *py_winreg_CloseKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4319 : {
4320 : DATA_BLOB blob;
4321 0 : Py_ssize_t blob_length = 0;
4322 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
4323 0 : PyObject *bigendian_obj = NULL;
4324 0 : PyObject *ndr64_obj = NULL;
4325 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
4326 0 : PyObject *allow_remaining_obj = NULL;
4327 0 : bool allow_remaining = false;
4328 :
4329 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
4330 : discard_const_p(char *, kwnames),
4331 : &blob.data, &blob_length,
4332 : &bigendian_obj,
4333 : &ndr64_obj,
4334 : &allow_remaining_obj)) {
4335 0 : return NULL;
4336 : }
4337 0 : blob.length = blob_length;
4338 :
4339 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4340 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
4341 : }
4342 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4343 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
4344 : }
4345 :
4346 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4347 0 : allow_remaining = true;
4348 : }
4349 :
4350 0 : return py_winreg_CloseKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
4351 : }
4352 :
4353 0 : static PyObject *py_winreg_CloseKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4354 : {
4355 : DATA_BLOB blob;
4356 0 : Py_ssize_t blob_length = 0;
4357 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
4358 0 : PyObject *bigendian_obj = NULL;
4359 0 : PyObject *ndr64_obj = NULL;
4360 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
4361 0 : PyObject *allow_remaining_obj = NULL;
4362 0 : bool allow_remaining = false;
4363 :
4364 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
4365 : discard_const_p(char *, kwnames),
4366 : &blob.data, &blob_length,
4367 : &bigendian_obj,
4368 : &ndr64_obj,
4369 : &allow_remaining_obj)) {
4370 0 : return NULL;
4371 : }
4372 0 : blob.length = blob_length;
4373 :
4374 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4375 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
4376 : }
4377 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4378 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
4379 : }
4380 :
4381 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4382 0 : allow_remaining = true;
4383 : }
4384 :
4385 0 : return py_winreg_CloseKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
4386 : }
4387 :
4388 0 : static PyObject *py_winreg_CloseKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
4389 : {
4390 0 : const struct ndr_interface_call *call = NULL;
4391 0 : struct winreg_CloseKey *object = pytalloc_get_ptr(py_obj);
4392 : PyObject *ret;
4393 : char *retstr;
4394 :
4395 0 : if (ndr_table_winreg.num_calls < 6) {
4396 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CloseKey_ndr_print");
4397 0 : return NULL;
4398 : }
4399 0 : call = &ndr_table_winreg.calls[5];
4400 :
4401 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
4402 0 : ret = PyUnicode_FromString(retstr);
4403 0 : TALLOC_FREE(retstr);
4404 :
4405 0 : return ret;
4406 : }
4407 :
4408 0 : static PyObject *py_winreg_CloseKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4409 : {
4410 0 : return py_winreg_CloseKey_ndr_print(py_obj, "winreg_CloseKey_in", NDR_IN);
4411 : }
4412 :
4413 0 : static PyObject *py_winreg_CloseKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4414 : {
4415 0 : return py_winreg_CloseKey_ndr_print(py_obj, "winreg_CloseKey_out", NDR_OUT);
4416 : }
4417 :
4418 : static PyMethodDef py_winreg_CloseKey_methods[] = {
4419 : { "opnum", (PyCFunction)py_winreg_CloseKey_ndr_opnum, METH_NOARGS|METH_CLASS,
4420 : "winreg.CloseKey.opnum() -> 5 (0x05) " },
4421 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
4422 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
4423 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
4424 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
4425 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
4426 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
4427 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
4428 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
4429 : { "__ndr_print_in__", (PyCFunction)py_winreg_CloseKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
4430 : { "__ndr_print_out__", (PyCFunction)py_winreg_CloseKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
4431 : { NULL, NULL, 0, NULL }
4432 : };
4433 :
4434 :
4435 : static PyTypeObject winreg_CloseKey_Type = {
4436 : PyVarObject_HEAD_INIT(NULL, 0)
4437 : .tp_name = "winreg.CloseKey",
4438 : .tp_getset = py_winreg_CloseKey_getsetters,
4439 : .tp_methods = py_winreg_CloseKey_methods,
4440 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4441 : .tp_new = py_winreg_CloseKey_new,
4442 : };
4443 :
4444 3 : static bool pack_py_winreg_CloseKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_CloseKey *r)
4445 : {
4446 : PyObject *py_handle;
4447 3 : const char *kwnames[] = {
4448 : "handle", NULL
4449 : };
4450 :
4451 3 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_CloseKey", discard_const_p(char *, kwnames), &py_handle)) {
4452 0 : return false;
4453 : }
4454 :
4455 3 : if (py_handle == NULL) {
4456 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
4457 0 : return false;
4458 : }
4459 3 : r->in.handle = talloc_ptrtype(r, r->in.handle);
4460 3 : if (r->in.handle == NULL) {
4461 0 : PyErr_NoMemory();
4462 0 : return false;
4463 : }
4464 3 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
4465 3 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
4466 0 : PyErr_NoMemory();
4467 0 : return false;
4468 : }
4469 3 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
4470 3 : return true;
4471 : }
4472 :
4473 3 : static PyObject *unpack_py_winreg_CloseKey_args_out(struct winreg_CloseKey *r)
4474 : {
4475 : PyObject *result;
4476 : PyObject *py_handle;
4477 3 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
4478 3 : result = py_handle;
4479 3 : if (!W_ERROR_IS_OK(r->out.result)) {
4480 0 : PyErr_SetWERROR(r->out.result);
4481 0 : return NULL;
4482 : }
4483 :
4484 3 : return result;
4485 : }
4486 :
4487 :
4488 0 : static PyObject *py_winreg_CreateKey_in_get_handle(PyObject *obj, void *closure)
4489 : {
4490 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4491 : PyObject *py_handle;
4492 0 : if (object->in.handle == NULL) {
4493 0 : Py_RETURN_NONE;
4494 : }
4495 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
4496 0 : return py_handle;
4497 : }
4498 :
4499 0 : static int py_winreg_CreateKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
4500 : {
4501 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4502 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
4503 0 : if (value == NULL) {
4504 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
4505 0 : return -1;
4506 : }
4507 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
4508 0 : if (object->in.handle == NULL) {
4509 0 : PyErr_NoMemory();
4510 0 : return -1;
4511 : }
4512 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4513 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4514 0 : PyErr_NoMemory();
4515 0 : return -1;
4516 : }
4517 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
4518 0 : return 0;
4519 : }
4520 :
4521 0 : static PyObject *py_winreg_CreateKey_in_get_name(PyObject *obj, void *closure)
4522 : {
4523 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4524 : PyObject *py_name;
4525 0 : py_name = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.name);
4526 0 : return py_name;
4527 : }
4528 :
4529 0 : static int py_winreg_CreateKey_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
4530 : {
4531 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4532 0 : if (value == NULL) {
4533 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.name");
4534 0 : return -1;
4535 : }
4536 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
4537 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4538 0 : PyErr_NoMemory();
4539 0 : return -1;
4540 : }
4541 0 : object->in.name = *(struct winreg_String *)pytalloc_get_ptr(value);
4542 0 : return 0;
4543 : }
4544 :
4545 0 : static PyObject *py_winreg_CreateKey_in_get_keyclass(PyObject *obj, void *closure)
4546 : {
4547 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4548 : PyObject *py_keyclass;
4549 0 : py_keyclass = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.keyclass);
4550 0 : return py_keyclass;
4551 : }
4552 :
4553 0 : static int py_winreg_CreateKey_in_set_keyclass(PyObject *py_obj, PyObject *value, void *closure)
4554 : {
4555 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4556 0 : if (value == NULL) {
4557 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.keyclass");
4558 0 : return -1;
4559 : }
4560 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
4561 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4562 0 : PyErr_NoMemory();
4563 0 : return -1;
4564 : }
4565 0 : object->in.keyclass = *(struct winreg_String *)pytalloc_get_ptr(value);
4566 0 : return 0;
4567 : }
4568 :
4569 0 : static PyObject *py_winreg_CreateKey_in_get_options(PyObject *obj, void *closure)
4570 : {
4571 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4572 : PyObject *py_options;
4573 0 : py_options = PyLong_FromUnsignedLongLong((uint32_t)(object->in.options));
4574 0 : return py_options;
4575 : }
4576 :
4577 0 : static int py_winreg_CreateKey_in_set_options(PyObject *py_obj, PyObject *value, void *closure)
4578 : {
4579 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4580 0 : if (value == NULL) {
4581 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.options");
4582 0 : return -1;
4583 : }
4584 : {
4585 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.options));
4586 0 : if (PyLong_Check(value)) {
4587 : unsigned long long test_var;
4588 0 : test_var = PyLong_AsUnsignedLongLong(value);
4589 0 : if (PyErr_Occurred() != NULL) {
4590 0 : return -1;
4591 : }
4592 0 : if (test_var > uint_max) {
4593 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4594 : PyLong_Type.tp_name, uint_max, test_var);
4595 0 : return -1;
4596 : }
4597 0 : object->in.options = test_var;
4598 : } else {
4599 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4600 : PyLong_Type.tp_name);
4601 0 : return -1;
4602 : }
4603 : }
4604 0 : return 0;
4605 : }
4606 :
4607 0 : static PyObject *py_winreg_CreateKey_in_get_access_mask(PyObject *obj, void *closure)
4608 : {
4609 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4610 : PyObject *py_access_mask;
4611 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
4612 0 : return py_access_mask;
4613 : }
4614 :
4615 0 : static int py_winreg_CreateKey_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
4616 : {
4617 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4618 0 : if (value == NULL) {
4619 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
4620 0 : return -1;
4621 : }
4622 : {
4623 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
4624 0 : if (PyLong_Check(value)) {
4625 : unsigned long long test_var;
4626 0 : test_var = PyLong_AsUnsignedLongLong(value);
4627 0 : if (PyErr_Occurred() != NULL) {
4628 0 : return -1;
4629 : }
4630 0 : if (test_var > uint_max) {
4631 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4632 : PyLong_Type.tp_name, uint_max, test_var);
4633 0 : return -1;
4634 : }
4635 0 : object->in.access_mask = test_var;
4636 : } else {
4637 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4638 : PyLong_Type.tp_name);
4639 0 : return -1;
4640 : }
4641 : }
4642 0 : return 0;
4643 : }
4644 :
4645 0 : static PyObject *py_winreg_CreateKey_in_get_secdesc(PyObject *obj, void *closure)
4646 : {
4647 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4648 : PyObject *py_secdesc;
4649 0 : if (object->in.secdesc == NULL) {
4650 0 : Py_RETURN_NONE;
4651 : }
4652 0 : if (object->in.secdesc == NULL) {
4653 0 : py_secdesc = Py_None;
4654 0 : Py_INCREF(py_secdesc);
4655 : } else {
4656 0 : py_secdesc = pytalloc_reference_ex(&winreg_SecBuf_Type, object->in.secdesc, object->in.secdesc);
4657 : }
4658 0 : return py_secdesc;
4659 : }
4660 :
4661 0 : static int py_winreg_CreateKey_in_set_secdesc(PyObject *py_obj, PyObject *value, void *closure)
4662 : {
4663 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4664 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.secdesc));
4665 0 : if (value == NULL) {
4666 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.secdesc");
4667 0 : return -1;
4668 : }
4669 0 : if (value == Py_None) {
4670 0 : object->in.secdesc = NULL;
4671 : } else {
4672 0 : object->in.secdesc = NULL;
4673 0 : PY_CHECK_TYPE(&winreg_SecBuf_Type, value, return -1;);
4674 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4675 0 : PyErr_NoMemory();
4676 0 : return -1;
4677 : }
4678 0 : object->in.secdesc = (struct winreg_SecBuf *)pytalloc_get_ptr(value);
4679 : }
4680 0 : return 0;
4681 : }
4682 :
4683 0 : static PyObject *py_winreg_CreateKey_out_get_new_handle(PyObject *obj, void *closure)
4684 : {
4685 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4686 : PyObject *py_new_handle;
4687 0 : if (object->out.new_handle == NULL) {
4688 0 : Py_RETURN_NONE;
4689 : }
4690 0 : py_new_handle = pytalloc_reference_ex(policy_handle_Type, object->out.new_handle, object->out.new_handle);
4691 0 : return py_new_handle;
4692 : }
4693 :
4694 0 : static int py_winreg_CreateKey_out_set_new_handle(PyObject *py_obj, PyObject *value, void *closure)
4695 : {
4696 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4697 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.new_handle));
4698 0 : if (value == NULL) {
4699 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.new_handle");
4700 0 : return -1;
4701 : }
4702 0 : object->out.new_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.new_handle);
4703 0 : if (object->out.new_handle == NULL) {
4704 0 : PyErr_NoMemory();
4705 0 : return -1;
4706 : }
4707 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4708 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4709 0 : PyErr_NoMemory();
4710 0 : return -1;
4711 : }
4712 0 : object->out.new_handle = (struct policy_handle *)pytalloc_get_ptr(value);
4713 0 : return 0;
4714 : }
4715 :
4716 0 : static PyObject *py_winreg_CreateKey_in_get_action_taken(PyObject *obj, void *closure)
4717 : {
4718 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4719 : PyObject *py_action_taken;
4720 0 : if (object->in.action_taken == NULL) {
4721 0 : Py_RETURN_NONE;
4722 : }
4723 0 : if (object->in.action_taken == NULL) {
4724 0 : py_action_taken = Py_None;
4725 0 : Py_INCREF(py_action_taken);
4726 : } else {
4727 0 : py_action_taken = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.action_taken));
4728 : }
4729 0 : return py_action_taken;
4730 : }
4731 :
4732 0 : static int py_winreg_CreateKey_in_set_action_taken(PyObject *py_obj, PyObject *value, void *closure)
4733 : {
4734 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4735 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.action_taken));
4736 0 : if (value == NULL) {
4737 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.action_taken");
4738 0 : return -1;
4739 : }
4740 0 : if (value == Py_None) {
4741 0 : object->in.action_taken = NULL;
4742 : } else {
4743 0 : object->in.action_taken = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.action_taken);
4744 0 : if (object->in.action_taken == NULL) {
4745 0 : PyErr_NoMemory();
4746 0 : return -1;
4747 : }
4748 : {
4749 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.action_taken));
4750 0 : if (PyLong_Check(value)) {
4751 : unsigned long long test_var;
4752 0 : test_var = PyLong_AsUnsignedLongLong(value);
4753 0 : if (PyErr_Occurred() != NULL) {
4754 0 : return -1;
4755 : }
4756 0 : if (test_var > uint_max) {
4757 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4758 : PyLong_Type.tp_name, uint_max, test_var);
4759 0 : return -1;
4760 : }
4761 0 : *object->in.action_taken = test_var;
4762 : } else {
4763 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4764 : PyLong_Type.tp_name);
4765 0 : return -1;
4766 : }
4767 : }
4768 : }
4769 0 : return 0;
4770 : }
4771 :
4772 0 : static PyObject *py_winreg_CreateKey_out_get_action_taken(PyObject *obj, void *closure)
4773 : {
4774 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4775 : PyObject *py_action_taken;
4776 0 : if (object->out.action_taken == NULL) {
4777 0 : Py_RETURN_NONE;
4778 : }
4779 0 : if (object->out.action_taken == NULL) {
4780 0 : py_action_taken = Py_None;
4781 0 : Py_INCREF(py_action_taken);
4782 : } else {
4783 0 : py_action_taken = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.action_taken));
4784 : }
4785 0 : return py_action_taken;
4786 : }
4787 :
4788 0 : static int py_winreg_CreateKey_out_set_action_taken(PyObject *py_obj, PyObject *value, void *closure)
4789 : {
4790 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4791 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.action_taken));
4792 0 : if (value == NULL) {
4793 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.action_taken");
4794 0 : return -1;
4795 : }
4796 0 : if (value == Py_None) {
4797 0 : object->out.action_taken = NULL;
4798 : } else {
4799 0 : object->out.action_taken = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.action_taken);
4800 0 : if (object->out.action_taken == NULL) {
4801 0 : PyErr_NoMemory();
4802 0 : return -1;
4803 : }
4804 : {
4805 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.action_taken));
4806 0 : if (PyLong_Check(value)) {
4807 : unsigned long long test_var;
4808 0 : test_var = PyLong_AsUnsignedLongLong(value);
4809 0 : if (PyErr_Occurred() != NULL) {
4810 0 : return -1;
4811 : }
4812 0 : if (test_var > uint_max) {
4813 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4814 : PyLong_Type.tp_name, uint_max, test_var);
4815 0 : return -1;
4816 : }
4817 0 : *object->out.action_taken = test_var;
4818 : } else {
4819 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4820 : PyLong_Type.tp_name);
4821 0 : return -1;
4822 : }
4823 : }
4824 : }
4825 0 : return 0;
4826 : }
4827 :
4828 0 : static PyObject *py_winreg_CreateKey_get_result(PyObject *obj, void *closure)
4829 : {
4830 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(obj);
4831 : PyObject *py_result;
4832 0 : py_result = PyErr_FromWERROR(object->out.result);
4833 0 : return py_result;
4834 : }
4835 :
4836 0 : static int py_winreg_CreateKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
4837 : {
4838 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4839 0 : if (value == NULL) {
4840 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
4841 0 : return -1;
4842 : }
4843 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
4844 0 : return 0;
4845 : }
4846 :
4847 : static PyGetSetDef py_winreg_CreateKey_getsetters[] = {
4848 : {
4849 : .name = discard_const_p(char, "in_handle"),
4850 : .get = py_winreg_CreateKey_in_get_handle,
4851 : .set = py_winreg_CreateKey_in_set_handle,
4852 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4853 : },
4854 : {
4855 : .name = discard_const_p(char, "in_name"),
4856 : .get = py_winreg_CreateKey_in_get_name,
4857 : .set = py_winreg_CreateKey_in_set_name,
4858 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
4859 : },
4860 : {
4861 : .name = discard_const_p(char, "in_keyclass"),
4862 : .get = py_winreg_CreateKey_in_get_keyclass,
4863 : .set = py_winreg_CreateKey_in_set_keyclass,
4864 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
4865 : },
4866 : {
4867 : .name = discard_const_p(char, "in_options"),
4868 : .get = py_winreg_CreateKey_in_get_options,
4869 : .set = py_winreg_CreateKey_in_set_options,
4870 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_KeyOptions")
4871 : },
4872 : {
4873 : .name = discard_const_p(char, "in_access_mask"),
4874 : .get = py_winreg_CreateKey_in_get_access_mask,
4875 : .set = py_winreg_CreateKey_in_set_access_mask,
4876 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
4877 : },
4878 : {
4879 : .name = discard_const_p(char, "in_secdesc"),
4880 : .get = py_winreg_CreateKey_in_get_secdesc,
4881 : .set = py_winreg_CreateKey_in_set_secdesc,
4882 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_SecBuf")
4883 : },
4884 : {
4885 : .name = discard_const_p(char, "out_new_handle"),
4886 : .get = py_winreg_CreateKey_out_get_new_handle,
4887 : .set = py_winreg_CreateKey_out_set_new_handle,
4888 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4889 : },
4890 : {
4891 : .name = discard_const_p(char, "in_action_taken"),
4892 : .get = py_winreg_CreateKey_in_get_action_taken,
4893 : .set = py_winreg_CreateKey_in_set_action_taken,
4894 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_CreateAction")
4895 : },
4896 : {
4897 : .name = discard_const_p(char, "out_action_taken"),
4898 : .get = py_winreg_CreateKey_out_get_action_taken,
4899 : .set = py_winreg_CreateKey_out_set_action_taken,
4900 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_CreateAction")
4901 : },
4902 : {
4903 : .name = discard_const_p(char, "result"),
4904 : .get = py_winreg_CreateKey_get_result,
4905 : .set = py_winreg_CreateKey_set_result,
4906 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
4907 : },
4908 : { .name = NULL }
4909 : };
4910 :
4911 0 : static PyObject *py_winreg_CreateKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4912 : {
4913 0 : PyObject *self = pytalloc_new(struct winreg_CreateKey, type);
4914 0 : struct winreg_CreateKey *_self = (struct winreg_CreateKey *)pytalloc_get_ptr(self);
4915 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
4916 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
4917 0 : _self->out.new_handle = talloc_zero(mem_ctx, struct policy_handle);
4918 0 : return self;
4919 : }
4920 :
4921 0 : static PyObject *py_winreg_CreateKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
4922 : {
4923 :
4924 :
4925 0 : return PyLong_FromLong(6);
4926 : }
4927 :
4928 0 : static PyObject *py_winreg_CreateKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
4929 : {
4930 0 : const struct ndr_interface_call *call = NULL;
4931 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
4932 0 : PyObject *ret = NULL;
4933 0 : struct ndr_push *push = NULL;
4934 : DATA_BLOB blob;
4935 : enum ndr_err_code err;
4936 :
4937 0 : if (ndr_table_winreg.num_calls < 7) {
4938 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CreateKey_ndr_pack");
4939 0 : return NULL;
4940 : }
4941 0 : call = &ndr_table_winreg.calls[6];
4942 :
4943 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
4944 0 : if (push == NULL) {
4945 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4946 0 : return NULL;
4947 : }
4948 :
4949 0 : push->flags |= ndr_push_flags;
4950 :
4951 0 : err = call->ndr_push(push, ndr_inout_flags, object);
4952 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4953 0 : TALLOC_FREE(push);
4954 0 : PyErr_SetNdrError(err);
4955 0 : return NULL;
4956 : }
4957 0 : blob = ndr_push_blob(push);
4958 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4959 0 : TALLOC_FREE(push);
4960 0 : return ret;
4961 : }
4962 :
4963 0 : static PyObject *py_winreg_CreateKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4964 : {
4965 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4966 0 : PyObject *bigendian_obj = NULL;
4967 0 : PyObject *ndr64_obj = NULL;
4968 0 : libndr_flags ndr_push_flags = 0;
4969 :
4970 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
4971 : discard_const_p(char *, kwnames),
4972 : &bigendian_obj,
4973 : &ndr64_obj)) {
4974 0 : return NULL;
4975 : }
4976 :
4977 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4978 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
4979 : }
4980 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4981 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
4982 : }
4983 :
4984 0 : return py_winreg_CreateKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
4985 : }
4986 :
4987 0 : static PyObject *py_winreg_CreateKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4988 : {
4989 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4990 0 : PyObject *bigendian_obj = NULL;
4991 0 : PyObject *ndr64_obj = NULL;
4992 0 : libndr_flags ndr_push_flags = 0;
4993 :
4994 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
4995 : discard_const_p(char *, kwnames),
4996 : &bigendian_obj,
4997 : &ndr64_obj)) {
4998 0 : return NULL;
4999 : }
5000 :
5001 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5002 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5003 : }
5004 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5005 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5006 : }
5007 :
5008 0 : return py_winreg_CreateKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
5009 : }
5010 :
5011 0 : static PyObject *py_winreg_CreateKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
5012 : {
5013 0 : const struct ndr_interface_call *call = NULL;
5014 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
5015 0 : struct ndr_pull *pull = NULL;
5016 : enum ndr_err_code err;
5017 :
5018 0 : if (ndr_table_winreg.num_calls < 7) {
5019 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CreateKey_ndr_unpack");
5020 0 : return NULL;
5021 : }
5022 0 : call = &ndr_table_winreg.calls[6];
5023 :
5024 0 : pull = ndr_pull_init_blob(blob, object);
5025 0 : if (pull == NULL) {
5026 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5027 0 : return NULL;
5028 : }
5029 :
5030 0 : pull->flags |= ndr_pull_flags;
5031 :
5032 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
5033 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5034 0 : TALLOC_FREE(pull);
5035 0 : PyErr_SetNdrError(err);
5036 0 : return NULL;
5037 : }
5038 0 : if (!allow_remaining) {
5039 : uint32_t highest_ofs;
5040 :
5041 0 : if (pull->offset > pull->relative_highest_offset) {
5042 0 : highest_ofs = pull->offset;
5043 : } else {
5044 0 : highest_ofs = pull->relative_highest_offset;
5045 : }
5046 0 : if (highest_ofs < pull->data_size) {
5047 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
5048 : "not all bytes consumed ofs[%u] size[%u]",
5049 : highest_ofs, pull->data_size);
5050 0 : TALLOC_FREE(pull);
5051 0 : PyErr_SetNdrError(err);
5052 0 : return NULL;
5053 : }
5054 : }
5055 :
5056 0 : TALLOC_FREE(pull);
5057 0 : Py_RETURN_NONE;
5058 : }
5059 :
5060 0 : static PyObject *py_winreg_CreateKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5061 : {
5062 : DATA_BLOB blob;
5063 0 : Py_ssize_t blob_length = 0;
5064 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5065 0 : PyObject *bigendian_obj = NULL;
5066 0 : PyObject *ndr64_obj = NULL;
5067 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5068 0 : PyObject *allow_remaining_obj = NULL;
5069 0 : bool allow_remaining = false;
5070 :
5071 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
5072 : discard_const_p(char *, kwnames),
5073 : &blob.data, &blob_length,
5074 : &bigendian_obj,
5075 : &ndr64_obj,
5076 : &allow_remaining_obj)) {
5077 0 : return NULL;
5078 : }
5079 0 : blob.length = blob_length;
5080 :
5081 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5082 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5083 : }
5084 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5085 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5086 : }
5087 :
5088 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5089 0 : allow_remaining = true;
5090 : }
5091 :
5092 0 : return py_winreg_CreateKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
5093 : }
5094 :
5095 0 : static PyObject *py_winreg_CreateKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5096 : {
5097 : DATA_BLOB blob;
5098 0 : Py_ssize_t blob_length = 0;
5099 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5100 0 : PyObject *bigendian_obj = NULL;
5101 0 : PyObject *ndr64_obj = NULL;
5102 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5103 0 : PyObject *allow_remaining_obj = NULL;
5104 0 : bool allow_remaining = false;
5105 :
5106 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
5107 : discard_const_p(char *, kwnames),
5108 : &blob.data, &blob_length,
5109 : &bigendian_obj,
5110 : &ndr64_obj,
5111 : &allow_remaining_obj)) {
5112 0 : return NULL;
5113 : }
5114 0 : blob.length = blob_length;
5115 :
5116 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5117 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5118 : }
5119 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5120 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5121 : }
5122 :
5123 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5124 0 : allow_remaining = true;
5125 : }
5126 :
5127 0 : return py_winreg_CreateKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
5128 : }
5129 :
5130 0 : static PyObject *py_winreg_CreateKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
5131 : {
5132 0 : const struct ndr_interface_call *call = NULL;
5133 0 : struct winreg_CreateKey *object = pytalloc_get_ptr(py_obj);
5134 : PyObject *ret;
5135 : char *retstr;
5136 :
5137 0 : if (ndr_table_winreg.num_calls < 7) {
5138 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CreateKey_ndr_print");
5139 0 : return NULL;
5140 : }
5141 0 : call = &ndr_table_winreg.calls[6];
5142 :
5143 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
5144 0 : ret = PyUnicode_FromString(retstr);
5145 0 : TALLOC_FREE(retstr);
5146 :
5147 0 : return ret;
5148 : }
5149 :
5150 0 : static PyObject *py_winreg_CreateKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5151 : {
5152 0 : return py_winreg_CreateKey_ndr_print(py_obj, "winreg_CreateKey_in", NDR_IN);
5153 : }
5154 :
5155 0 : static PyObject *py_winreg_CreateKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5156 : {
5157 0 : return py_winreg_CreateKey_ndr_print(py_obj, "winreg_CreateKey_out", NDR_OUT);
5158 : }
5159 :
5160 : static PyMethodDef py_winreg_CreateKey_methods[] = {
5161 : { "opnum", (PyCFunction)py_winreg_CreateKey_ndr_opnum, METH_NOARGS|METH_CLASS,
5162 : "winreg.CreateKey.opnum() -> 6 (0x06) " },
5163 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
5164 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
5165 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
5166 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
5167 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
5168 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
5169 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
5170 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
5171 : { "__ndr_print_in__", (PyCFunction)py_winreg_CreateKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
5172 : { "__ndr_print_out__", (PyCFunction)py_winreg_CreateKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
5173 : { NULL, NULL, 0, NULL }
5174 : };
5175 :
5176 :
5177 : static PyTypeObject winreg_CreateKey_Type = {
5178 : PyVarObject_HEAD_INIT(NULL, 0)
5179 : .tp_name = "winreg.CreateKey",
5180 : .tp_getset = py_winreg_CreateKey_getsetters,
5181 : .tp_methods = py_winreg_CreateKey_methods,
5182 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5183 : .tp_new = py_winreg_CreateKey_new,
5184 : };
5185 :
5186 0 : static bool pack_py_winreg_CreateKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_CreateKey *r)
5187 : {
5188 : PyObject *py_handle;
5189 : PyObject *py_name;
5190 : PyObject *py_keyclass;
5191 : PyObject *py_options;
5192 : PyObject *py_access_mask;
5193 : PyObject *py_secdesc;
5194 : PyObject *py_action_taken;
5195 0 : const char *kwnames[] = {
5196 : "handle", "name", "keyclass", "options", "access_mask", "secdesc", "action_taken", NULL
5197 : };
5198 :
5199 0 : 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)) {
5200 0 : return false;
5201 : }
5202 :
5203 0 : if (py_handle == NULL) {
5204 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
5205 0 : return false;
5206 : }
5207 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
5208 0 : if (r->in.handle == NULL) {
5209 0 : PyErr_NoMemory();
5210 0 : return false;
5211 : }
5212 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
5213 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
5214 0 : PyErr_NoMemory();
5215 0 : return false;
5216 : }
5217 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
5218 0 : if (py_name == NULL) {
5219 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.name");
5220 0 : return false;
5221 : }
5222 0 : PY_CHECK_TYPE(&winreg_String_Type, py_name, return false;);
5223 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
5224 0 : PyErr_NoMemory();
5225 0 : return false;
5226 : }
5227 0 : r->in.name = *(struct winreg_String *)pytalloc_get_ptr(py_name);
5228 0 : if (py_keyclass == NULL) {
5229 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.keyclass");
5230 0 : return false;
5231 : }
5232 0 : PY_CHECK_TYPE(&winreg_String_Type, py_keyclass, return false;);
5233 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyclass)) == NULL) {
5234 0 : PyErr_NoMemory();
5235 0 : return false;
5236 : }
5237 0 : r->in.keyclass = *(struct winreg_String *)pytalloc_get_ptr(py_keyclass);
5238 0 : if (py_options == NULL) {
5239 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.options");
5240 0 : return false;
5241 : }
5242 : {
5243 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.options));
5244 0 : if (PyLong_Check(py_options)) {
5245 : unsigned long long test_var;
5246 0 : test_var = PyLong_AsUnsignedLongLong(py_options);
5247 0 : if (PyErr_Occurred() != NULL) {
5248 0 : return false;
5249 : }
5250 0 : if (test_var > uint_max) {
5251 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5252 : PyLong_Type.tp_name, uint_max, test_var);
5253 0 : return false;
5254 : }
5255 0 : r->in.options = test_var;
5256 : } else {
5257 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5258 : PyLong_Type.tp_name);
5259 0 : return false;
5260 : }
5261 : }
5262 0 : if (py_access_mask == NULL) {
5263 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
5264 0 : return false;
5265 : }
5266 : {
5267 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
5268 0 : if (PyLong_Check(py_access_mask)) {
5269 : unsigned long long test_var;
5270 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
5271 0 : if (PyErr_Occurred() != NULL) {
5272 0 : return false;
5273 : }
5274 0 : if (test_var > uint_max) {
5275 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5276 : PyLong_Type.tp_name, uint_max, test_var);
5277 0 : return false;
5278 : }
5279 0 : r->in.access_mask = test_var;
5280 : } else {
5281 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5282 : PyLong_Type.tp_name);
5283 0 : return false;
5284 : }
5285 : }
5286 0 : if (py_secdesc == NULL) {
5287 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.secdesc");
5288 0 : return false;
5289 : }
5290 0 : if (py_secdesc == Py_None) {
5291 0 : r->in.secdesc = NULL;
5292 : } else {
5293 0 : r->in.secdesc = NULL;
5294 0 : PY_CHECK_TYPE(&winreg_SecBuf_Type, py_secdesc, return false;);
5295 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_secdesc)) == NULL) {
5296 0 : PyErr_NoMemory();
5297 0 : return false;
5298 : }
5299 0 : r->in.secdesc = (struct winreg_SecBuf *)pytalloc_get_ptr(py_secdesc);
5300 : }
5301 0 : if (py_action_taken == NULL) {
5302 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.action_taken");
5303 0 : return false;
5304 : }
5305 0 : if (py_action_taken == Py_None) {
5306 0 : r->in.action_taken = NULL;
5307 : } else {
5308 0 : r->in.action_taken = talloc_ptrtype(r, r->in.action_taken);
5309 0 : if (r->in.action_taken == NULL) {
5310 0 : PyErr_NoMemory();
5311 0 : return false;
5312 : }
5313 : {
5314 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.action_taken));
5315 0 : if (PyLong_Check(py_action_taken)) {
5316 : unsigned long long test_var;
5317 0 : test_var = PyLong_AsUnsignedLongLong(py_action_taken);
5318 0 : if (PyErr_Occurred() != NULL) {
5319 0 : return false;
5320 : }
5321 0 : if (test_var > uint_max) {
5322 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5323 : PyLong_Type.tp_name, uint_max, test_var);
5324 0 : return false;
5325 : }
5326 0 : *r->in.action_taken = test_var;
5327 : } else {
5328 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5329 : PyLong_Type.tp_name);
5330 0 : return false;
5331 : }
5332 : }
5333 : }
5334 0 : return true;
5335 : }
5336 :
5337 0 : static PyObject *unpack_py_winreg_CreateKey_args_out(struct winreg_CreateKey *r)
5338 : {
5339 : PyObject *result;
5340 : PyObject *py_new_handle;
5341 : PyObject *py_action_taken;
5342 0 : result = PyTuple_New(2);
5343 0 : py_new_handle = pytalloc_reference_ex(policy_handle_Type, r->out.new_handle, r->out.new_handle);
5344 0 : PyTuple_SetItem(result, 0, py_new_handle);
5345 0 : if (r->out.action_taken == NULL) {
5346 0 : py_action_taken = Py_None;
5347 0 : Py_INCREF(py_action_taken);
5348 : } else {
5349 0 : py_action_taken = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.action_taken));
5350 : }
5351 0 : PyTuple_SetItem(result, 1, py_action_taken);
5352 0 : if (!W_ERROR_IS_OK(r->out.result)) {
5353 0 : PyErr_SetWERROR(r->out.result);
5354 0 : return NULL;
5355 : }
5356 :
5357 0 : return result;
5358 : }
5359 :
5360 :
5361 0 : static PyObject *py_winreg_DeleteKey_in_get_handle(PyObject *obj, void *closure)
5362 : {
5363 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(obj);
5364 : PyObject *py_handle;
5365 0 : if (object->in.handle == NULL) {
5366 0 : Py_RETURN_NONE;
5367 : }
5368 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
5369 0 : return py_handle;
5370 : }
5371 :
5372 0 : static int py_winreg_DeleteKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
5373 : {
5374 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(py_obj);
5375 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
5376 0 : if (value == NULL) {
5377 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
5378 0 : return -1;
5379 : }
5380 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
5381 0 : if (object->in.handle == NULL) {
5382 0 : PyErr_NoMemory();
5383 0 : return -1;
5384 : }
5385 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
5386 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5387 0 : PyErr_NoMemory();
5388 0 : return -1;
5389 : }
5390 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
5391 0 : return 0;
5392 : }
5393 :
5394 0 : static PyObject *py_winreg_DeleteKey_in_get_key(PyObject *obj, void *closure)
5395 : {
5396 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(obj);
5397 : PyObject *py_key;
5398 0 : py_key = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.key);
5399 0 : return py_key;
5400 : }
5401 :
5402 0 : static int py_winreg_DeleteKey_in_set_key(PyObject *py_obj, PyObject *value, void *closure)
5403 : {
5404 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(py_obj);
5405 0 : if (value == NULL) {
5406 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.key");
5407 0 : return -1;
5408 : }
5409 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
5410 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5411 0 : PyErr_NoMemory();
5412 0 : return -1;
5413 : }
5414 0 : object->in.key = *(struct winreg_String *)pytalloc_get_ptr(value);
5415 0 : return 0;
5416 : }
5417 :
5418 0 : static PyObject *py_winreg_DeleteKey_get_result(PyObject *obj, void *closure)
5419 : {
5420 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(obj);
5421 : PyObject *py_result;
5422 0 : py_result = PyErr_FromWERROR(object->out.result);
5423 0 : return py_result;
5424 : }
5425 :
5426 0 : static int py_winreg_DeleteKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
5427 : {
5428 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(py_obj);
5429 0 : if (value == NULL) {
5430 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
5431 0 : return -1;
5432 : }
5433 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
5434 0 : return 0;
5435 : }
5436 :
5437 : static PyGetSetDef py_winreg_DeleteKey_getsetters[] = {
5438 : {
5439 : .name = discard_const_p(char, "in_handle"),
5440 : .get = py_winreg_DeleteKey_in_get_handle,
5441 : .set = py_winreg_DeleteKey_in_set_handle,
5442 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
5443 : },
5444 : {
5445 : .name = discard_const_p(char, "in_key"),
5446 : .get = py_winreg_DeleteKey_in_get_key,
5447 : .set = py_winreg_DeleteKey_in_set_key,
5448 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
5449 : },
5450 : {
5451 : .name = discard_const_p(char, "result"),
5452 : .get = py_winreg_DeleteKey_get_result,
5453 : .set = py_winreg_DeleteKey_set_result,
5454 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
5455 : },
5456 : { .name = NULL }
5457 : };
5458 :
5459 0 : static PyObject *py_winreg_DeleteKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5460 : {
5461 0 : PyObject *self = pytalloc_new(struct winreg_DeleteKey, type);
5462 0 : struct winreg_DeleteKey *_self = (struct winreg_DeleteKey *)pytalloc_get_ptr(self);
5463 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
5464 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
5465 0 : return self;
5466 : }
5467 :
5468 0 : static PyObject *py_winreg_DeleteKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
5469 : {
5470 :
5471 :
5472 0 : return PyLong_FromLong(7);
5473 : }
5474 :
5475 0 : static PyObject *py_winreg_DeleteKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
5476 : {
5477 0 : const struct ndr_interface_call *call = NULL;
5478 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(py_obj);
5479 0 : PyObject *ret = NULL;
5480 0 : struct ndr_push *push = NULL;
5481 : DATA_BLOB blob;
5482 : enum ndr_err_code err;
5483 :
5484 0 : if (ndr_table_winreg.num_calls < 8) {
5485 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKey_ndr_pack");
5486 0 : return NULL;
5487 : }
5488 0 : call = &ndr_table_winreg.calls[7];
5489 :
5490 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
5491 0 : if (push == NULL) {
5492 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5493 0 : return NULL;
5494 : }
5495 :
5496 0 : push->flags |= ndr_push_flags;
5497 :
5498 0 : err = call->ndr_push(push, ndr_inout_flags, object);
5499 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5500 0 : TALLOC_FREE(push);
5501 0 : PyErr_SetNdrError(err);
5502 0 : return NULL;
5503 : }
5504 0 : blob = ndr_push_blob(push);
5505 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5506 0 : TALLOC_FREE(push);
5507 0 : return ret;
5508 : }
5509 :
5510 0 : static PyObject *py_winreg_DeleteKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5511 : {
5512 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5513 0 : PyObject *bigendian_obj = NULL;
5514 0 : PyObject *ndr64_obj = NULL;
5515 0 : libndr_flags ndr_push_flags = 0;
5516 :
5517 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
5518 : discard_const_p(char *, kwnames),
5519 : &bigendian_obj,
5520 : &ndr64_obj)) {
5521 0 : return NULL;
5522 : }
5523 :
5524 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5525 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5526 : }
5527 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5528 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5529 : }
5530 :
5531 0 : return py_winreg_DeleteKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
5532 : }
5533 :
5534 0 : static PyObject *py_winreg_DeleteKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5535 : {
5536 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5537 0 : PyObject *bigendian_obj = NULL;
5538 0 : PyObject *ndr64_obj = NULL;
5539 0 : libndr_flags ndr_push_flags = 0;
5540 :
5541 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
5542 : discard_const_p(char *, kwnames),
5543 : &bigendian_obj,
5544 : &ndr64_obj)) {
5545 0 : return NULL;
5546 : }
5547 :
5548 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5549 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5550 : }
5551 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5552 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5553 : }
5554 :
5555 0 : return py_winreg_DeleteKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
5556 : }
5557 :
5558 0 : static PyObject *py_winreg_DeleteKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
5559 : {
5560 0 : const struct ndr_interface_call *call = NULL;
5561 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(py_obj);
5562 0 : struct ndr_pull *pull = NULL;
5563 : enum ndr_err_code err;
5564 :
5565 0 : if (ndr_table_winreg.num_calls < 8) {
5566 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKey_ndr_unpack");
5567 0 : return NULL;
5568 : }
5569 0 : call = &ndr_table_winreg.calls[7];
5570 :
5571 0 : pull = ndr_pull_init_blob(blob, object);
5572 0 : if (pull == NULL) {
5573 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5574 0 : return NULL;
5575 : }
5576 :
5577 0 : pull->flags |= ndr_pull_flags;
5578 :
5579 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
5580 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5581 0 : TALLOC_FREE(pull);
5582 0 : PyErr_SetNdrError(err);
5583 0 : return NULL;
5584 : }
5585 0 : if (!allow_remaining) {
5586 : uint32_t highest_ofs;
5587 :
5588 0 : if (pull->offset > pull->relative_highest_offset) {
5589 0 : highest_ofs = pull->offset;
5590 : } else {
5591 0 : highest_ofs = pull->relative_highest_offset;
5592 : }
5593 0 : if (highest_ofs < pull->data_size) {
5594 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
5595 : "not all bytes consumed ofs[%u] size[%u]",
5596 : highest_ofs, pull->data_size);
5597 0 : TALLOC_FREE(pull);
5598 0 : PyErr_SetNdrError(err);
5599 0 : return NULL;
5600 : }
5601 : }
5602 :
5603 0 : TALLOC_FREE(pull);
5604 0 : Py_RETURN_NONE;
5605 : }
5606 :
5607 0 : static PyObject *py_winreg_DeleteKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5608 : {
5609 : DATA_BLOB blob;
5610 0 : Py_ssize_t blob_length = 0;
5611 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5612 0 : PyObject *bigendian_obj = NULL;
5613 0 : PyObject *ndr64_obj = NULL;
5614 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5615 0 : PyObject *allow_remaining_obj = NULL;
5616 0 : bool allow_remaining = false;
5617 :
5618 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
5619 : discard_const_p(char *, kwnames),
5620 : &blob.data, &blob_length,
5621 : &bigendian_obj,
5622 : &ndr64_obj,
5623 : &allow_remaining_obj)) {
5624 0 : return NULL;
5625 : }
5626 0 : blob.length = blob_length;
5627 :
5628 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5629 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5630 : }
5631 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5632 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5633 : }
5634 :
5635 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5636 0 : allow_remaining = true;
5637 : }
5638 :
5639 0 : return py_winreg_DeleteKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
5640 : }
5641 :
5642 0 : static PyObject *py_winreg_DeleteKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5643 : {
5644 : DATA_BLOB blob;
5645 0 : Py_ssize_t blob_length = 0;
5646 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5647 0 : PyObject *bigendian_obj = NULL;
5648 0 : PyObject *ndr64_obj = NULL;
5649 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5650 0 : PyObject *allow_remaining_obj = NULL;
5651 0 : bool allow_remaining = false;
5652 :
5653 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
5654 : discard_const_p(char *, kwnames),
5655 : &blob.data, &blob_length,
5656 : &bigendian_obj,
5657 : &ndr64_obj,
5658 : &allow_remaining_obj)) {
5659 0 : return NULL;
5660 : }
5661 0 : blob.length = blob_length;
5662 :
5663 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5664 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5665 : }
5666 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5667 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5668 : }
5669 :
5670 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5671 0 : allow_remaining = true;
5672 : }
5673 :
5674 0 : return py_winreg_DeleteKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
5675 : }
5676 :
5677 0 : static PyObject *py_winreg_DeleteKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
5678 : {
5679 0 : const struct ndr_interface_call *call = NULL;
5680 0 : struct winreg_DeleteKey *object = pytalloc_get_ptr(py_obj);
5681 : PyObject *ret;
5682 : char *retstr;
5683 :
5684 0 : if (ndr_table_winreg.num_calls < 8) {
5685 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKey_ndr_print");
5686 0 : return NULL;
5687 : }
5688 0 : call = &ndr_table_winreg.calls[7];
5689 :
5690 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
5691 0 : ret = PyUnicode_FromString(retstr);
5692 0 : TALLOC_FREE(retstr);
5693 :
5694 0 : return ret;
5695 : }
5696 :
5697 0 : static PyObject *py_winreg_DeleteKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5698 : {
5699 0 : return py_winreg_DeleteKey_ndr_print(py_obj, "winreg_DeleteKey_in", NDR_IN);
5700 : }
5701 :
5702 0 : static PyObject *py_winreg_DeleteKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5703 : {
5704 0 : return py_winreg_DeleteKey_ndr_print(py_obj, "winreg_DeleteKey_out", NDR_OUT);
5705 : }
5706 :
5707 : static PyMethodDef py_winreg_DeleteKey_methods[] = {
5708 : { "opnum", (PyCFunction)py_winreg_DeleteKey_ndr_opnum, METH_NOARGS|METH_CLASS,
5709 : "winreg.DeleteKey.opnum() -> 7 (0x07) " },
5710 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
5711 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
5712 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
5713 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
5714 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
5715 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
5716 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
5717 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
5718 : { "__ndr_print_in__", (PyCFunction)py_winreg_DeleteKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
5719 : { "__ndr_print_out__", (PyCFunction)py_winreg_DeleteKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
5720 : { NULL, NULL, 0, NULL }
5721 : };
5722 :
5723 :
5724 : static PyTypeObject winreg_DeleteKey_Type = {
5725 : PyVarObject_HEAD_INIT(NULL, 0)
5726 : .tp_name = "winreg.DeleteKey",
5727 : .tp_getset = py_winreg_DeleteKey_getsetters,
5728 : .tp_methods = py_winreg_DeleteKey_methods,
5729 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5730 : .tp_new = py_winreg_DeleteKey_new,
5731 : };
5732 :
5733 0 : static bool pack_py_winreg_DeleteKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteKey *r)
5734 : {
5735 : PyObject *py_handle;
5736 : PyObject *py_key;
5737 0 : const char *kwnames[] = {
5738 : "handle", "key", NULL
5739 : };
5740 :
5741 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_DeleteKey", discard_const_p(char *, kwnames), &py_handle, &py_key)) {
5742 0 : return false;
5743 : }
5744 :
5745 0 : if (py_handle == NULL) {
5746 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
5747 0 : return false;
5748 : }
5749 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
5750 0 : if (r->in.handle == NULL) {
5751 0 : PyErr_NoMemory();
5752 0 : return false;
5753 : }
5754 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
5755 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
5756 0 : PyErr_NoMemory();
5757 0 : return false;
5758 : }
5759 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
5760 0 : if (py_key == NULL) {
5761 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.key");
5762 0 : return false;
5763 : }
5764 0 : PY_CHECK_TYPE(&winreg_String_Type, py_key, return false;);
5765 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key)) == NULL) {
5766 0 : PyErr_NoMemory();
5767 0 : return false;
5768 : }
5769 0 : r->in.key = *(struct winreg_String *)pytalloc_get_ptr(py_key);
5770 0 : return true;
5771 : }
5772 :
5773 0 : static PyObject *unpack_py_winreg_DeleteKey_args_out(struct winreg_DeleteKey *r)
5774 : {
5775 : PyObject *result;
5776 0 : result = Py_None;
5777 0 : Py_INCREF(result);
5778 0 : if (!W_ERROR_IS_OK(r->out.result)) {
5779 0 : PyErr_SetWERROR(r->out.result);
5780 0 : return NULL;
5781 : }
5782 :
5783 0 : return result;
5784 : }
5785 :
5786 :
5787 0 : static PyObject *py_winreg_DeleteValue_in_get_handle(PyObject *obj, void *closure)
5788 : {
5789 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(obj);
5790 : PyObject *py_handle;
5791 0 : if (object->in.handle == NULL) {
5792 0 : Py_RETURN_NONE;
5793 : }
5794 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
5795 0 : return py_handle;
5796 : }
5797 :
5798 0 : static int py_winreg_DeleteValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
5799 : {
5800 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(py_obj);
5801 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
5802 0 : if (value == NULL) {
5803 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
5804 0 : return -1;
5805 : }
5806 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
5807 0 : if (object->in.handle == NULL) {
5808 0 : PyErr_NoMemory();
5809 0 : return -1;
5810 : }
5811 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
5812 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5813 0 : PyErr_NoMemory();
5814 0 : return -1;
5815 : }
5816 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
5817 0 : return 0;
5818 : }
5819 :
5820 0 : static PyObject *py_winreg_DeleteValue_in_get_value(PyObject *obj, void *closure)
5821 : {
5822 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(obj);
5823 : PyObject *py_value;
5824 0 : py_value = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.value);
5825 0 : return py_value;
5826 : }
5827 :
5828 0 : static int py_winreg_DeleteValue_in_set_value(PyObject *py_obj, PyObject *value, void *closure)
5829 : {
5830 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(py_obj);
5831 0 : if (value == NULL) {
5832 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.value");
5833 0 : return -1;
5834 : }
5835 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
5836 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5837 0 : PyErr_NoMemory();
5838 0 : return -1;
5839 : }
5840 0 : object->in.value = *(struct winreg_String *)pytalloc_get_ptr(value);
5841 0 : return 0;
5842 : }
5843 :
5844 0 : static PyObject *py_winreg_DeleteValue_get_result(PyObject *obj, void *closure)
5845 : {
5846 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(obj);
5847 : PyObject *py_result;
5848 0 : py_result = PyErr_FromWERROR(object->out.result);
5849 0 : return py_result;
5850 : }
5851 :
5852 0 : static int py_winreg_DeleteValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
5853 : {
5854 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(py_obj);
5855 0 : if (value == NULL) {
5856 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
5857 0 : return -1;
5858 : }
5859 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
5860 0 : return 0;
5861 : }
5862 :
5863 : static PyGetSetDef py_winreg_DeleteValue_getsetters[] = {
5864 : {
5865 : .name = discard_const_p(char, "in_handle"),
5866 : .get = py_winreg_DeleteValue_in_get_handle,
5867 : .set = py_winreg_DeleteValue_in_set_handle,
5868 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
5869 : },
5870 : {
5871 : .name = discard_const_p(char, "in_value"),
5872 : .get = py_winreg_DeleteValue_in_get_value,
5873 : .set = py_winreg_DeleteValue_in_set_value,
5874 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
5875 : },
5876 : {
5877 : .name = discard_const_p(char, "result"),
5878 : .get = py_winreg_DeleteValue_get_result,
5879 : .set = py_winreg_DeleteValue_set_result,
5880 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
5881 : },
5882 : { .name = NULL }
5883 : };
5884 :
5885 0 : static PyObject *py_winreg_DeleteValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5886 : {
5887 0 : PyObject *self = pytalloc_new(struct winreg_DeleteValue, type);
5888 0 : struct winreg_DeleteValue *_self = (struct winreg_DeleteValue *)pytalloc_get_ptr(self);
5889 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
5890 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
5891 0 : return self;
5892 : }
5893 :
5894 0 : static PyObject *py_winreg_DeleteValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
5895 : {
5896 :
5897 :
5898 0 : return PyLong_FromLong(8);
5899 : }
5900 :
5901 0 : static PyObject *py_winreg_DeleteValue_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
5902 : {
5903 0 : const struct ndr_interface_call *call = NULL;
5904 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(py_obj);
5905 0 : PyObject *ret = NULL;
5906 0 : struct ndr_push *push = NULL;
5907 : DATA_BLOB blob;
5908 : enum ndr_err_code err;
5909 :
5910 0 : if (ndr_table_winreg.num_calls < 9) {
5911 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteValue_ndr_pack");
5912 0 : return NULL;
5913 : }
5914 0 : call = &ndr_table_winreg.calls[8];
5915 :
5916 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
5917 0 : if (push == NULL) {
5918 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5919 0 : return NULL;
5920 : }
5921 :
5922 0 : push->flags |= ndr_push_flags;
5923 :
5924 0 : err = call->ndr_push(push, ndr_inout_flags, object);
5925 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5926 0 : TALLOC_FREE(push);
5927 0 : PyErr_SetNdrError(err);
5928 0 : return NULL;
5929 : }
5930 0 : blob = ndr_push_blob(push);
5931 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5932 0 : TALLOC_FREE(push);
5933 0 : return ret;
5934 : }
5935 :
5936 0 : static PyObject *py_winreg_DeleteValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5937 : {
5938 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5939 0 : PyObject *bigendian_obj = NULL;
5940 0 : PyObject *ndr64_obj = NULL;
5941 0 : libndr_flags ndr_push_flags = 0;
5942 :
5943 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
5944 : discard_const_p(char *, kwnames),
5945 : &bigendian_obj,
5946 : &ndr64_obj)) {
5947 0 : return NULL;
5948 : }
5949 :
5950 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5951 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5952 : }
5953 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5954 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5955 : }
5956 :
5957 0 : return py_winreg_DeleteValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
5958 : }
5959 :
5960 0 : static PyObject *py_winreg_DeleteValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5961 : {
5962 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5963 0 : PyObject *bigendian_obj = NULL;
5964 0 : PyObject *ndr64_obj = NULL;
5965 0 : libndr_flags ndr_push_flags = 0;
5966 :
5967 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
5968 : discard_const_p(char *, kwnames),
5969 : &bigendian_obj,
5970 : &ndr64_obj)) {
5971 0 : return NULL;
5972 : }
5973 :
5974 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5975 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5976 : }
5977 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5978 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5979 : }
5980 :
5981 0 : return py_winreg_DeleteValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
5982 : }
5983 :
5984 0 : static PyObject *py_winreg_DeleteValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
5985 : {
5986 0 : const struct ndr_interface_call *call = NULL;
5987 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(py_obj);
5988 0 : struct ndr_pull *pull = NULL;
5989 : enum ndr_err_code err;
5990 :
5991 0 : if (ndr_table_winreg.num_calls < 9) {
5992 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteValue_ndr_unpack");
5993 0 : return NULL;
5994 : }
5995 0 : call = &ndr_table_winreg.calls[8];
5996 :
5997 0 : pull = ndr_pull_init_blob(blob, object);
5998 0 : if (pull == NULL) {
5999 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
6000 0 : return NULL;
6001 : }
6002 :
6003 0 : pull->flags |= ndr_pull_flags;
6004 :
6005 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
6006 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6007 0 : TALLOC_FREE(pull);
6008 0 : PyErr_SetNdrError(err);
6009 0 : return NULL;
6010 : }
6011 0 : if (!allow_remaining) {
6012 : uint32_t highest_ofs;
6013 :
6014 0 : if (pull->offset > pull->relative_highest_offset) {
6015 0 : highest_ofs = pull->offset;
6016 : } else {
6017 0 : highest_ofs = pull->relative_highest_offset;
6018 : }
6019 0 : if (highest_ofs < pull->data_size) {
6020 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
6021 : "not all bytes consumed ofs[%u] size[%u]",
6022 : highest_ofs, pull->data_size);
6023 0 : TALLOC_FREE(pull);
6024 0 : PyErr_SetNdrError(err);
6025 0 : return NULL;
6026 : }
6027 : }
6028 :
6029 0 : TALLOC_FREE(pull);
6030 0 : Py_RETURN_NONE;
6031 : }
6032 :
6033 0 : static PyObject *py_winreg_DeleteValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6034 : {
6035 : DATA_BLOB blob;
6036 0 : Py_ssize_t blob_length = 0;
6037 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6038 0 : PyObject *bigendian_obj = NULL;
6039 0 : PyObject *ndr64_obj = NULL;
6040 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6041 0 : PyObject *allow_remaining_obj = NULL;
6042 0 : bool allow_remaining = false;
6043 :
6044 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
6045 : discard_const_p(char *, kwnames),
6046 : &blob.data, &blob_length,
6047 : &bigendian_obj,
6048 : &ndr64_obj,
6049 : &allow_remaining_obj)) {
6050 0 : return NULL;
6051 : }
6052 0 : blob.length = blob_length;
6053 :
6054 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6055 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6056 : }
6057 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6058 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6059 : }
6060 :
6061 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6062 0 : allow_remaining = true;
6063 : }
6064 :
6065 0 : return py_winreg_DeleteValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
6066 : }
6067 :
6068 0 : static PyObject *py_winreg_DeleteValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6069 : {
6070 : DATA_BLOB blob;
6071 0 : Py_ssize_t blob_length = 0;
6072 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6073 0 : PyObject *bigendian_obj = NULL;
6074 0 : PyObject *ndr64_obj = NULL;
6075 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6076 0 : PyObject *allow_remaining_obj = NULL;
6077 0 : bool allow_remaining = false;
6078 :
6079 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
6080 : discard_const_p(char *, kwnames),
6081 : &blob.data, &blob_length,
6082 : &bigendian_obj,
6083 : &ndr64_obj,
6084 : &allow_remaining_obj)) {
6085 0 : return NULL;
6086 : }
6087 0 : blob.length = blob_length;
6088 :
6089 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6090 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6091 : }
6092 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6093 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6094 : }
6095 :
6096 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6097 0 : allow_remaining = true;
6098 : }
6099 :
6100 0 : return py_winreg_DeleteValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
6101 : }
6102 :
6103 0 : static PyObject *py_winreg_DeleteValue_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
6104 : {
6105 0 : const struct ndr_interface_call *call = NULL;
6106 0 : struct winreg_DeleteValue *object = pytalloc_get_ptr(py_obj);
6107 : PyObject *ret;
6108 : char *retstr;
6109 :
6110 0 : if (ndr_table_winreg.num_calls < 9) {
6111 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteValue_ndr_print");
6112 0 : return NULL;
6113 : }
6114 0 : call = &ndr_table_winreg.calls[8];
6115 :
6116 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
6117 0 : ret = PyUnicode_FromString(retstr);
6118 0 : TALLOC_FREE(retstr);
6119 :
6120 0 : return ret;
6121 : }
6122 :
6123 0 : static PyObject *py_winreg_DeleteValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6124 : {
6125 0 : return py_winreg_DeleteValue_ndr_print(py_obj, "winreg_DeleteValue_in", NDR_IN);
6126 : }
6127 :
6128 0 : static PyObject *py_winreg_DeleteValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6129 : {
6130 0 : return py_winreg_DeleteValue_ndr_print(py_obj, "winreg_DeleteValue_out", NDR_OUT);
6131 : }
6132 :
6133 : static PyMethodDef py_winreg_DeleteValue_methods[] = {
6134 : { "opnum", (PyCFunction)py_winreg_DeleteValue_ndr_opnum, METH_NOARGS|METH_CLASS,
6135 : "winreg.DeleteValue.opnum() -> 8 (0x08) " },
6136 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
6137 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
6138 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
6139 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
6140 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
6141 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
6142 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
6143 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
6144 : { "__ndr_print_in__", (PyCFunction)py_winreg_DeleteValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
6145 : { "__ndr_print_out__", (PyCFunction)py_winreg_DeleteValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
6146 : { NULL, NULL, 0, NULL }
6147 : };
6148 :
6149 :
6150 : static PyTypeObject winreg_DeleteValue_Type = {
6151 : PyVarObject_HEAD_INIT(NULL, 0)
6152 : .tp_name = "winreg.DeleteValue",
6153 : .tp_getset = py_winreg_DeleteValue_getsetters,
6154 : .tp_methods = py_winreg_DeleteValue_methods,
6155 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6156 : .tp_new = py_winreg_DeleteValue_new,
6157 : };
6158 :
6159 0 : static bool pack_py_winreg_DeleteValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteValue *r)
6160 : {
6161 : PyObject *py_handle;
6162 : PyObject *py_value;
6163 0 : const char *kwnames[] = {
6164 : "handle", "value", NULL
6165 : };
6166 :
6167 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_DeleteValue", discard_const_p(char *, kwnames), &py_handle, &py_value)) {
6168 0 : return false;
6169 : }
6170 :
6171 0 : if (py_handle == NULL) {
6172 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
6173 0 : return false;
6174 : }
6175 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
6176 0 : if (r->in.handle == NULL) {
6177 0 : PyErr_NoMemory();
6178 0 : return false;
6179 : }
6180 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
6181 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
6182 0 : PyErr_NoMemory();
6183 0 : return false;
6184 : }
6185 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
6186 0 : if (py_value == NULL) {
6187 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.value");
6188 0 : return false;
6189 : }
6190 0 : PY_CHECK_TYPE(&winreg_String_Type, py_value, return false;);
6191 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_value)) == NULL) {
6192 0 : PyErr_NoMemory();
6193 0 : return false;
6194 : }
6195 0 : r->in.value = *(struct winreg_String *)pytalloc_get_ptr(py_value);
6196 0 : return true;
6197 : }
6198 :
6199 0 : static PyObject *unpack_py_winreg_DeleteValue_args_out(struct winreg_DeleteValue *r)
6200 : {
6201 : PyObject *result;
6202 0 : result = Py_None;
6203 0 : Py_INCREF(result);
6204 0 : if (!W_ERROR_IS_OK(r->out.result)) {
6205 0 : PyErr_SetWERROR(r->out.result);
6206 0 : return NULL;
6207 : }
6208 :
6209 0 : return result;
6210 : }
6211 :
6212 :
6213 0 : static PyObject *py_winreg_EnumKey_in_get_handle(PyObject *obj, void *closure)
6214 : {
6215 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6216 : PyObject *py_handle;
6217 0 : if (object->in.handle == NULL) {
6218 0 : Py_RETURN_NONE;
6219 : }
6220 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
6221 0 : return py_handle;
6222 : }
6223 :
6224 0 : static int py_winreg_EnumKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
6225 : {
6226 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6227 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
6228 0 : if (value == NULL) {
6229 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
6230 0 : return -1;
6231 : }
6232 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
6233 0 : if (object->in.handle == NULL) {
6234 0 : PyErr_NoMemory();
6235 0 : return -1;
6236 : }
6237 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
6238 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6239 0 : PyErr_NoMemory();
6240 0 : return -1;
6241 : }
6242 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
6243 0 : return 0;
6244 : }
6245 :
6246 0 : static PyObject *py_winreg_EnumKey_in_get_enum_index(PyObject *obj, void *closure)
6247 : {
6248 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6249 : PyObject *py_enum_index;
6250 0 : py_enum_index = PyLong_FromUnsignedLongLong((uint32_t)(object->in.enum_index));
6251 0 : return py_enum_index;
6252 : }
6253 :
6254 0 : static int py_winreg_EnumKey_in_set_enum_index(PyObject *py_obj, PyObject *value, void *closure)
6255 : {
6256 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6257 0 : if (value == NULL) {
6258 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.enum_index");
6259 0 : return -1;
6260 : }
6261 : {
6262 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.enum_index));
6263 0 : if (PyLong_Check(value)) {
6264 : unsigned long long test_var;
6265 0 : test_var = PyLong_AsUnsignedLongLong(value);
6266 0 : if (PyErr_Occurred() != NULL) {
6267 0 : return -1;
6268 : }
6269 0 : if (test_var > uint_max) {
6270 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6271 : PyLong_Type.tp_name, uint_max, test_var);
6272 0 : return -1;
6273 : }
6274 0 : object->in.enum_index = test_var;
6275 : } else {
6276 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6277 : PyLong_Type.tp_name);
6278 0 : return -1;
6279 : }
6280 : }
6281 0 : return 0;
6282 : }
6283 :
6284 0 : static PyObject *py_winreg_EnumKey_in_get_name(PyObject *obj, void *closure)
6285 : {
6286 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6287 : PyObject *py_name;
6288 0 : if (object->in.name == NULL) {
6289 0 : Py_RETURN_NONE;
6290 : }
6291 0 : py_name = pytalloc_reference_ex(&winreg_StringBuf_Type, object->in.name, object->in.name);
6292 0 : return py_name;
6293 : }
6294 :
6295 0 : static int py_winreg_EnumKey_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
6296 : {
6297 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6298 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.name));
6299 0 : if (value == NULL) {
6300 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.name");
6301 0 : return -1;
6302 : }
6303 0 : object->in.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.name);
6304 0 : if (object->in.name == NULL) {
6305 0 : PyErr_NoMemory();
6306 0 : return -1;
6307 : }
6308 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6309 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6310 0 : PyErr_NoMemory();
6311 0 : return -1;
6312 : }
6313 0 : object->in.name = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6314 0 : return 0;
6315 : }
6316 :
6317 0 : static PyObject *py_winreg_EnumKey_out_get_name(PyObject *obj, void *closure)
6318 : {
6319 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6320 : PyObject *py_name;
6321 0 : if (object->out.name == NULL) {
6322 0 : Py_RETURN_NONE;
6323 : }
6324 0 : py_name = pytalloc_reference_ex(&winreg_StringBuf_Type, object->out.name, object->out.name);
6325 0 : return py_name;
6326 : }
6327 :
6328 0 : static int py_winreg_EnumKey_out_set_name(PyObject *py_obj, PyObject *value, void *closure)
6329 : {
6330 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6331 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.name));
6332 0 : if (value == NULL) {
6333 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.name");
6334 0 : return -1;
6335 : }
6336 0 : object->out.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.name);
6337 0 : if (object->out.name == NULL) {
6338 0 : PyErr_NoMemory();
6339 0 : return -1;
6340 : }
6341 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6342 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6343 0 : PyErr_NoMemory();
6344 0 : return -1;
6345 : }
6346 0 : object->out.name = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6347 0 : return 0;
6348 : }
6349 :
6350 0 : static PyObject *py_winreg_EnumKey_in_get_keyclass(PyObject *obj, void *closure)
6351 : {
6352 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6353 : PyObject *py_keyclass;
6354 0 : if (object->in.keyclass == NULL) {
6355 0 : Py_RETURN_NONE;
6356 : }
6357 0 : if (object->in.keyclass == NULL) {
6358 0 : py_keyclass = Py_None;
6359 0 : Py_INCREF(py_keyclass);
6360 : } else {
6361 0 : py_keyclass = pytalloc_reference_ex(&winreg_StringBuf_Type, object->in.keyclass, object->in.keyclass);
6362 : }
6363 0 : return py_keyclass;
6364 : }
6365 :
6366 0 : static int py_winreg_EnumKey_in_set_keyclass(PyObject *py_obj, PyObject *value, void *closure)
6367 : {
6368 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6369 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.keyclass));
6370 0 : if (value == NULL) {
6371 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.keyclass");
6372 0 : return -1;
6373 : }
6374 0 : if (value == Py_None) {
6375 0 : object->in.keyclass = NULL;
6376 : } else {
6377 0 : object->in.keyclass = NULL;
6378 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6379 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6380 0 : PyErr_NoMemory();
6381 0 : return -1;
6382 : }
6383 0 : object->in.keyclass = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6384 : }
6385 0 : return 0;
6386 : }
6387 :
6388 0 : static PyObject *py_winreg_EnumKey_out_get_keyclass(PyObject *obj, void *closure)
6389 : {
6390 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6391 : PyObject *py_keyclass;
6392 0 : if (object->out.keyclass == NULL) {
6393 0 : Py_RETURN_NONE;
6394 : }
6395 0 : if (object->out.keyclass == NULL) {
6396 0 : py_keyclass = Py_None;
6397 0 : Py_INCREF(py_keyclass);
6398 : } else {
6399 0 : py_keyclass = pytalloc_reference_ex(&winreg_StringBuf_Type, object->out.keyclass, object->out.keyclass);
6400 : }
6401 0 : return py_keyclass;
6402 : }
6403 :
6404 0 : static int py_winreg_EnumKey_out_set_keyclass(PyObject *py_obj, PyObject *value, void *closure)
6405 : {
6406 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6407 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.keyclass));
6408 0 : if (value == NULL) {
6409 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.keyclass");
6410 0 : return -1;
6411 : }
6412 0 : if (value == Py_None) {
6413 0 : object->out.keyclass = NULL;
6414 : } else {
6415 0 : object->out.keyclass = NULL;
6416 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6417 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6418 0 : PyErr_NoMemory();
6419 0 : return -1;
6420 : }
6421 0 : object->out.keyclass = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6422 : }
6423 0 : return 0;
6424 : }
6425 :
6426 0 : static PyObject *py_winreg_EnumKey_in_get_last_changed_time(PyObject *obj, void *closure)
6427 : {
6428 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6429 : PyObject *py_last_changed_time;
6430 0 : if (object->in.last_changed_time == NULL) {
6431 0 : Py_RETURN_NONE;
6432 : }
6433 0 : if (object->in.last_changed_time == NULL) {
6434 0 : py_last_changed_time = Py_None;
6435 0 : Py_INCREF(py_last_changed_time);
6436 : } else {
6437 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*object->in.last_changed_time);
6438 : }
6439 0 : return py_last_changed_time;
6440 : }
6441 :
6442 0 : static int py_winreg_EnumKey_in_set_last_changed_time(PyObject *py_obj, PyObject *value, void *closure)
6443 : {
6444 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6445 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.last_changed_time));
6446 0 : if (value == NULL) {
6447 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.last_changed_time");
6448 0 : return -1;
6449 : }
6450 0 : if (value == Py_None) {
6451 0 : object->in.last_changed_time = NULL;
6452 : } else {
6453 0 : object->in.last_changed_time = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.last_changed_time);
6454 0 : if (object->in.last_changed_time == NULL) {
6455 0 : PyErr_NoMemory();
6456 0 : return -1;
6457 : }
6458 : {
6459 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.last_changed_time));
6460 0 : if (PyLong_Check(value)) {
6461 : unsigned long long test_var;
6462 0 : test_var = PyLong_AsUnsignedLongLong(value);
6463 0 : if (PyErr_Occurred() != NULL) {
6464 0 : return -1;
6465 : }
6466 0 : if (test_var > uint_max) {
6467 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6468 : PyLong_Type.tp_name, uint_max, test_var);
6469 0 : return -1;
6470 : }
6471 0 : *object->in.last_changed_time = test_var;
6472 : } else {
6473 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6474 : PyLong_Type.tp_name);
6475 0 : return -1;
6476 : }
6477 : }
6478 : }
6479 0 : return 0;
6480 : }
6481 :
6482 0 : static PyObject *py_winreg_EnumKey_out_get_last_changed_time(PyObject *obj, void *closure)
6483 : {
6484 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6485 : PyObject *py_last_changed_time;
6486 0 : if (object->out.last_changed_time == NULL) {
6487 0 : Py_RETURN_NONE;
6488 : }
6489 0 : if (object->out.last_changed_time == NULL) {
6490 0 : py_last_changed_time = Py_None;
6491 0 : Py_INCREF(py_last_changed_time);
6492 : } else {
6493 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*object->out.last_changed_time);
6494 : }
6495 0 : return py_last_changed_time;
6496 : }
6497 :
6498 0 : static int py_winreg_EnumKey_out_set_last_changed_time(PyObject *py_obj, PyObject *value, void *closure)
6499 : {
6500 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6501 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.last_changed_time));
6502 0 : if (value == NULL) {
6503 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.last_changed_time");
6504 0 : return -1;
6505 : }
6506 0 : if (value == Py_None) {
6507 0 : object->out.last_changed_time = NULL;
6508 : } else {
6509 0 : object->out.last_changed_time = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.last_changed_time);
6510 0 : if (object->out.last_changed_time == NULL) {
6511 0 : PyErr_NoMemory();
6512 0 : return -1;
6513 : }
6514 : {
6515 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.last_changed_time));
6516 0 : if (PyLong_Check(value)) {
6517 : unsigned long long test_var;
6518 0 : test_var = PyLong_AsUnsignedLongLong(value);
6519 0 : if (PyErr_Occurred() != NULL) {
6520 0 : return -1;
6521 : }
6522 0 : if (test_var > uint_max) {
6523 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6524 : PyLong_Type.tp_name, uint_max, test_var);
6525 0 : return -1;
6526 : }
6527 0 : *object->out.last_changed_time = test_var;
6528 : } else {
6529 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6530 : PyLong_Type.tp_name);
6531 0 : return -1;
6532 : }
6533 : }
6534 : }
6535 0 : return 0;
6536 : }
6537 :
6538 0 : static PyObject *py_winreg_EnumKey_get_result(PyObject *obj, void *closure)
6539 : {
6540 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(obj);
6541 : PyObject *py_result;
6542 0 : py_result = PyErr_FromWERROR(object->out.result);
6543 0 : return py_result;
6544 : }
6545 :
6546 0 : static int py_winreg_EnumKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
6547 : {
6548 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6549 0 : if (value == NULL) {
6550 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
6551 0 : return -1;
6552 : }
6553 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
6554 0 : return 0;
6555 : }
6556 :
6557 : static PyGetSetDef py_winreg_EnumKey_getsetters[] = {
6558 : {
6559 : .name = discard_const_p(char, "in_handle"),
6560 : .get = py_winreg_EnumKey_in_get_handle,
6561 : .set = py_winreg_EnumKey_in_set_handle,
6562 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
6563 : },
6564 : {
6565 : .name = discard_const_p(char, "in_enum_index"),
6566 : .get = py_winreg_EnumKey_in_get_enum_index,
6567 : .set = py_winreg_EnumKey_in_set_enum_index,
6568 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
6569 : },
6570 : {
6571 : .name = discard_const_p(char, "in_name"),
6572 : .get = py_winreg_EnumKey_in_get_name,
6573 : .set = py_winreg_EnumKey_in_set_name,
6574 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6575 : },
6576 : {
6577 : .name = discard_const_p(char, "out_name"),
6578 : .get = py_winreg_EnumKey_out_get_name,
6579 : .set = py_winreg_EnumKey_out_set_name,
6580 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6581 : },
6582 : {
6583 : .name = discard_const_p(char, "in_keyclass"),
6584 : .get = py_winreg_EnumKey_in_get_keyclass,
6585 : .set = py_winreg_EnumKey_in_set_keyclass,
6586 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6587 : },
6588 : {
6589 : .name = discard_const_p(char, "out_keyclass"),
6590 : .get = py_winreg_EnumKey_out_get_keyclass,
6591 : .set = py_winreg_EnumKey_out_set_keyclass,
6592 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6593 : },
6594 : {
6595 : .name = discard_const_p(char, "in_last_changed_time"),
6596 : .get = py_winreg_EnumKey_in_get_last_changed_time,
6597 : .set = py_winreg_EnumKey_in_set_last_changed_time,
6598 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
6599 : },
6600 : {
6601 : .name = discard_const_p(char, "out_last_changed_time"),
6602 : .get = py_winreg_EnumKey_out_get_last_changed_time,
6603 : .set = py_winreg_EnumKey_out_set_last_changed_time,
6604 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
6605 : },
6606 : {
6607 : .name = discard_const_p(char, "result"),
6608 : .get = py_winreg_EnumKey_get_result,
6609 : .set = py_winreg_EnumKey_set_result,
6610 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
6611 : },
6612 : { .name = NULL }
6613 : };
6614 :
6615 0 : static PyObject *py_winreg_EnumKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
6616 : {
6617 0 : PyObject *self = pytalloc_new(struct winreg_EnumKey, type);
6618 0 : struct winreg_EnumKey *_self = (struct winreg_EnumKey *)pytalloc_get_ptr(self);
6619 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
6620 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
6621 0 : _self->in.name = talloc_zero(mem_ctx, struct winreg_StringBuf);
6622 0 : _self->out.name = talloc_zero(mem_ctx, struct winreg_StringBuf);
6623 0 : return self;
6624 : }
6625 :
6626 0 : static PyObject *py_winreg_EnumKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
6627 : {
6628 :
6629 :
6630 0 : return PyLong_FromLong(9);
6631 : }
6632 :
6633 0 : static PyObject *py_winreg_EnumKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
6634 : {
6635 0 : const struct ndr_interface_call *call = NULL;
6636 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6637 0 : PyObject *ret = NULL;
6638 0 : struct ndr_push *push = NULL;
6639 : DATA_BLOB blob;
6640 : enum ndr_err_code err;
6641 :
6642 0 : if (ndr_table_winreg.num_calls < 10) {
6643 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumKey_ndr_pack");
6644 0 : return NULL;
6645 : }
6646 0 : call = &ndr_table_winreg.calls[9];
6647 :
6648 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
6649 0 : if (push == NULL) {
6650 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
6651 0 : return NULL;
6652 : }
6653 :
6654 0 : push->flags |= ndr_push_flags;
6655 :
6656 0 : err = call->ndr_push(push, ndr_inout_flags, object);
6657 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6658 0 : TALLOC_FREE(push);
6659 0 : PyErr_SetNdrError(err);
6660 0 : return NULL;
6661 : }
6662 0 : blob = ndr_push_blob(push);
6663 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
6664 0 : TALLOC_FREE(push);
6665 0 : return ret;
6666 : }
6667 :
6668 0 : static PyObject *py_winreg_EnumKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6669 : {
6670 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
6671 0 : PyObject *bigendian_obj = NULL;
6672 0 : PyObject *ndr64_obj = NULL;
6673 0 : libndr_flags ndr_push_flags = 0;
6674 :
6675 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
6676 : discard_const_p(char *, kwnames),
6677 : &bigendian_obj,
6678 : &ndr64_obj)) {
6679 0 : return NULL;
6680 : }
6681 :
6682 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6683 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
6684 : }
6685 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6686 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
6687 : }
6688 :
6689 0 : return py_winreg_EnumKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
6690 : }
6691 :
6692 0 : static PyObject *py_winreg_EnumKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6693 : {
6694 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
6695 0 : PyObject *bigendian_obj = NULL;
6696 0 : PyObject *ndr64_obj = NULL;
6697 0 : libndr_flags ndr_push_flags = 0;
6698 :
6699 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
6700 : discard_const_p(char *, kwnames),
6701 : &bigendian_obj,
6702 : &ndr64_obj)) {
6703 0 : return NULL;
6704 : }
6705 :
6706 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6707 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
6708 : }
6709 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6710 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
6711 : }
6712 :
6713 0 : return py_winreg_EnumKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
6714 : }
6715 :
6716 0 : static PyObject *py_winreg_EnumKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
6717 : {
6718 0 : const struct ndr_interface_call *call = NULL;
6719 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6720 0 : struct ndr_pull *pull = NULL;
6721 : enum ndr_err_code err;
6722 :
6723 0 : if (ndr_table_winreg.num_calls < 10) {
6724 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumKey_ndr_unpack");
6725 0 : return NULL;
6726 : }
6727 0 : call = &ndr_table_winreg.calls[9];
6728 :
6729 0 : pull = ndr_pull_init_blob(blob, object);
6730 0 : if (pull == NULL) {
6731 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
6732 0 : return NULL;
6733 : }
6734 :
6735 0 : pull->flags |= ndr_pull_flags;
6736 :
6737 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
6738 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6739 0 : TALLOC_FREE(pull);
6740 0 : PyErr_SetNdrError(err);
6741 0 : return NULL;
6742 : }
6743 0 : if (!allow_remaining) {
6744 : uint32_t highest_ofs;
6745 :
6746 0 : if (pull->offset > pull->relative_highest_offset) {
6747 0 : highest_ofs = pull->offset;
6748 : } else {
6749 0 : highest_ofs = pull->relative_highest_offset;
6750 : }
6751 0 : if (highest_ofs < pull->data_size) {
6752 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
6753 : "not all bytes consumed ofs[%u] size[%u]",
6754 : highest_ofs, pull->data_size);
6755 0 : TALLOC_FREE(pull);
6756 0 : PyErr_SetNdrError(err);
6757 0 : return NULL;
6758 : }
6759 : }
6760 :
6761 0 : TALLOC_FREE(pull);
6762 0 : Py_RETURN_NONE;
6763 : }
6764 :
6765 0 : static PyObject *py_winreg_EnumKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6766 : {
6767 : DATA_BLOB blob;
6768 0 : Py_ssize_t blob_length = 0;
6769 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6770 0 : PyObject *bigendian_obj = NULL;
6771 0 : PyObject *ndr64_obj = NULL;
6772 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6773 0 : PyObject *allow_remaining_obj = NULL;
6774 0 : bool allow_remaining = false;
6775 :
6776 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
6777 : discard_const_p(char *, kwnames),
6778 : &blob.data, &blob_length,
6779 : &bigendian_obj,
6780 : &ndr64_obj,
6781 : &allow_remaining_obj)) {
6782 0 : return NULL;
6783 : }
6784 0 : blob.length = blob_length;
6785 :
6786 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6787 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6788 : }
6789 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6790 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6791 : }
6792 :
6793 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6794 0 : allow_remaining = true;
6795 : }
6796 :
6797 0 : return py_winreg_EnumKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
6798 : }
6799 :
6800 0 : static PyObject *py_winreg_EnumKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6801 : {
6802 : DATA_BLOB blob;
6803 0 : Py_ssize_t blob_length = 0;
6804 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6805 0 : PyObject *bigendian_obj = NULL;
6806 0 : PyObject *ndr64_obj = NULL;
6807 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6808 0 : PyObject *allow_remaining_obj = NULL;
6809 0 : bool allow_remaining = false;
6810 :
6811 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
6812 : discard_const_p(char *, kwnames),
6813 : &blob.data, &blob_length,
6814 : &bigendian_obj,
6815 : &ndr64_obj,
6816 : &allow_remaining_obj)) {
6817 0 : return NULL;
6818 : }
6819 0 : blob.length = blob_length;
6820 :
6821 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6822 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6823 : }
6824 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6825 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6826 : }
6827 :
6828 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6829 0 : allow_remaining = true;
6830 : }
6831 :
6832 0 : return py_winreg_EnumKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
6833 : }
6834 :
6835 0 : static PyObject *py_winreg_EnumKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
6836 : {
6837 0 : const struct ndr_interface_call *call = NULL;
6838 0 : struct winreg_EnumKey *object = pytalloc_get_ptr(py_obj);
6839 : PyObject *ret;
6840 : char *retstr;
6841 :
6842 0 : if (ndr_table_winreg.num_calls < 10) {
6843 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumKey_ndr_print");
6844 0 : return NULL;
6845 : }
6846 0 : call = &ndr_table_winreg.calls[9];
6847 :
6848 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
6849 0 : ret = PyUnicode_FromString(retstr);
6850 0 : TALLOC_FREE(retstr);
6851 :
6852 0 : return ret;
6853 : }
6854 :
6855 0 : static PyObject *py_winreg_EnumKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6856 : {
6857 0 : return py_winreg_EnumKey_ndr_print(py_obj, "winreg_EnumKey_in", NDR_IN);
6858 : }
6859 :
6860 0 : static PyObject *py_winreg_EnumKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6861 : {
6862 0 : return py_winreg_EnumKey_ndr_print(py_obj, "winreg_EnumKey_out", NDR_OUT);
6863 : }
6864 :
6865 : static PyMethodDef py_winreg_EnumKey_methods[] = {
6866 : { "opnum", (PyCFunction)py_winreg_EnumKey_ndr_opnum, METH_NOARGS|METH_CLASS,
6867 : "winreg.EnumKey.opnum() -> 9 (0x09) " },
6868 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
6869 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
6870 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
6871 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
6872 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
6873 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
6874 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
6875 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
6876 : { "__ndr_print_in__", (PyCFunction)py_winreg_EnumKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
6877 : { "__ndr_print_out__", (PyCFunction)py_winreg_EnumKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
6878 : { NULL, NULL, 0, NULL }
6879 : };
6880 :
6881 :
6882 : static PyTypeObject winreg_EnumKey_Type = {
6883 : PyVarObject_HEAD_INIT(NULL, 0)
6884 : .tp_name = "winreg.EnumKey",
6885 : .tp_getset = py_winreg_EnumKey_getsetters,
6886 : .tp_methods = py_winreg_EnumKey_methods,
6887 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6888 : .tp_new = py_winreg_EnumKey_new,
6889 : };
6890 :
6891 0 : static bool pack_py_winreg_EnumKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_EnumKey *r)
6892 : {
6893 : PyObject *py_handle;
6894 : PyObject *py_enum_index;
6895 : PyObject *py_name;
6896 : PyObject *py_keyclass;
6897 : PyObject *py_last_changed_time;
6898 0 : const char *kwnames[] = {
6899 : "handle", "enum_index", "name", "keyclass", "last_changed_time", NULL
6900 : };
6901 :
6902 0 : 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)) {
6903 0 : return false;
6904 : }
6905 :
6906 0 : if (py_handle == NULL) {
6907 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
6908 0 : return false;
6909 : }
6910 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
6911 0 : if (r->in.handle == NULL) {
6912 0 : PyErr_NoMemory();
6913 0 : return false;
6914 : }
6915 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
6916 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
6917 0 : PyErr_NoMemory();
6918 0 : return false;
6919 : }
6920 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
6921 0 : if (py_enum_index == NULL) {
6922 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.enum_index");
6923 0 : return false;
6924 : }
6925 : {
6926 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.enum_index));
6927 0 : if (PyLong_Check(py_enum_index)) {
6928 : unsigned long long test_var;
6929 0 : test_var = PyLong_AsUnsignedLongLong(py_enum_index);
6930 0 : if (PyErr_Occurred() != NULL) {
6931 0 : return false;
6932 : }
6933 0 : if (test_var > uint_max) {
6934 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6935 : PyLong_Type.tp_name, uint_max, test_var);
6936 0 : return false;
6937 : }
6938 0 : r->in.enum_index = test_var;
6939 : } else {
6940 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6941 : PyLong_Type.tp_name);
6942 0 : return false;
6943 : }
6944 : }
6945 0 : if (py_name == NULL) {
6946 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.name");
6947 0 : return false;
6948 : }
6949 0 : r->in.name = talloc_ptrtype(r, r->in.name);
6950 0 : if (r->in.name == NULL) {
6951 0 : PyErr_NoMemory();
6952 0 : return false;
6953 : }
6954 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, py_name, return false;);
6955 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
6956 0 : PyErr_NoMemory();
6957 0 : return false;
6958 : }
6959 0 : r->in.name = (struct winreg_StringBuf *)pytalloc_get_ptr(py_name);
6960 0 : if (py_keyclass == NULL) {
6961 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.keyclass");
6962 0 : return false;
6963 : }
6964 0 : if (py_keyclass == Py_None) {
6965 0 : r->in.keyclass = NULL;
6966 : } else {
6967 0 : r->in.keyclass = NULL;
6968 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, py_keyclass, return false;);
6969 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyclass)) == NULL) {
6970 0 : PyErr_NoMemory();
6971 0 : return false;
6972 : }
6973 0 : r->in.keyclass = (struct winreg_StringBuf *)pytalloc_get_ptr(py_keyclass);
6974 : }
6975 0 : if (py_last_changed_time == NULL) {
6976 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.last_changed_time");
6977 0 : return false;
6978 : }
6979 0 : if (py_last_changed_time == Py_None) {
6980 0 : r->in.last_changed_time = NULL;
6981 : } else {
6982 0 : r->in.last_changed_time = talloc_ptrtype(r, r->in.last_changed_time);
6983 0 : if (r->in.last_changed_time == NULL) {
6984 0 : PyErr_NoMemory();
6985 0 : return false;
6986 : }
6987 : {
6988 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.last_changed_time));
6989 0 : if (PyLong_Check(py_last_changed_time)) {
6990 : unsigned long long test_var;
6991 0 : test_var = PyLong_AsUnsignedLongLong(py_last_changed_time);
6992 0 : if (PyErr_Occurred() != NULL) {
6993 0 : return false;
6994 : }
6995 0 : if (test_var > uint_max) {
6996 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6997 : PyLong_Type.tp_name, uint_max, test_var);
6998 0 : return false;
6999 : }
7000 0 : *r->in.last_changed_time = test_var;
7001 : } else {
7002 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7003 : PyLong_Type.tp_name);
7004 0 : return false;
7005 : }
7006 : }
7007 : }
7008 0 : return true;
7009 : }
7010 :
7011 0 : static PyObject *unpack_py_winreg_EnumKey_args_out(struct winreg_EnumKey *r)
7012 : {
7013 : PyObject *result;
7014 : PyObject *py_name;
7015 : PyObject *py_keyclass;
7016 : PyObject *py_last_changed_time;
7017 0 : result = PyTuple_New(3);
7018 0 : py_name = pytalloc_reference_ex(&winreg_StringBuf_Type, r->out.name, r->out.name);
7019 0 : PyTuple_SetItem(result, 0, py_name);
7020 0 : if (r->out.keyclass == NULL) {
7021 0 : py_keyclass = Py_None;
7022 0 : Py_INCREF(py_keyclass);
7023 : } else {
7024 0 : py_keyclass = pytalloc_reference_ex(&winreg_StringBuf_Type, r->out.keyclass, r->out.keyclass);
7025 : }
7026 0 : PyTuple_SetItem(result, 1, py_keyclass);
7027 0 : if (r->out.last_changed_time == NULL) {
7028 0 : py_last_changed_time = Py_None;
7029 0 : Py_INCREF(py_last_changed_time);
7030 : } else {
7031 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*r->out.last_changed_time);
7032 : }
7033 0 : PyTuple_SetItem(result, 2, py_last_changed_time);
7034 0 : if (!W_ERROR_IS_OK(r->out.result)) {
7035 0 : PyErr_SetWERROR(r->out.result);
7036 0 : return NULL;
7037 : }
7038 :
7039 0 : return result;
7040 : }
7041 :
7042 :
7043 0 : static PyObject *py_winreg_EnumValue_in_get_handle(PyObject *obj, void *closure)
7044 : {
7045 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7046 : PyObject *py_handle;
7047 0 : if (object->in.handle == NULL) {
7048 0 : Py_RETURN_NONE;
7049 : }
7050 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
7051 0 : return py_handle;
7052 : }
7053 :
7054 0 : static int py_winreg_EnumValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
7055 : {
7056 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7057 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
7058 0 : if (value == NULL) {
7059 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
7060 0 : return -1;
7061 : }
7062 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
7063 0 : if (object->in.handle == NULL) {
7064 0 : PyErr_NoMemory();
7065 0 : return -1;
7066 : }
7067 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
7068 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
7069 0 : PyErr_NoMemory();
7070 0 : return -1;
7071 : }
7072 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
7073 0 : return 0;
7074 : }
7075 :
7076 0 : static PyObject *py_winreg_EnumValue_in_get_enum_index(PyObject *obj, void *closure)
7077 : {
7078 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7079 : PyObject *py_enum_index;
7080 0 : py_enum_index = PyLong_FromUnsignedLongLong((uint32_t)(object->in.enum_index));
7081 0 : return py_enum_index;
7082 : }
7083 :
7084 0 : static int py_winreg_EnumValue_in_set_enum_index(PyObject *py_obj, PyObject *value, void *closure)
7085 : {
7086 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7087 0 : if (value == NULL) {
7088 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.enum_index");
7089 0 : return -1;
7090 : }
7091 : {
7092 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.enum_index));
7093 0 : if (PyLong_Check(value)) {
7094 : unsigned long long test_var;
7095 0 : test_var = PyLong_AsUnsignedLongLong(value);
7096 0 : if (PyErr_Occurred() != NULL) {
7097 0 : return -1;
7098 : }
7099 0 : if (test_var > uint_max) {
7100 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7101 : PyLong_Type.tp_name, uint_max, test_var);
7102 0 : return -1;
7103 : }
7104 0 : object->in.enum_index = test_var;
7105 : } else {
7106 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7107 : PyLong_Type.tp_name);
7108 0 : return -1;
7109 : }
7110 : }
7111 0 : return 0;
7112 : }
7113 :
7114 0 : static PyObject *py_winreg_EnumValue_in_get_name(PyObject *obj, void *closure)
7115 : {
7116 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7117 : PyObject *py_name;
7118 0 : if (object->in.name == NULL) {
7119 0 : Py_RETURN_NONE;
7120 : }
7121 0 : py_name = pytalloc_reference_ex(&winreg_ValNameBuf_Type, object->in.name, object->in.name);
7122 0 : return py_name;
7123 : }
7124 :
7125 0 : static int py_winreg_EnumValue_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
7126 : {
7127 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7128 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.name));
7129 0 : if (value == NULL) {
7130 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.name");
7131 0 : return -1;
7132 : }
7133 0 : object->in.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.name);
7134 0 : if (object->in.name == NULL) {
7135 0 : PyErr_NoMemory();
7136 0 : return -1;
7137 : }
7138 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, value, return -1;);
7139 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
7140 0 : PyErr_NoMemory();
7141 0 : return -1;
7142 : }
7143 0 : object->in.name = (struct winreg_ValNameBuf *)pytalloc_get_ptr(value);
7144 0 : return 0;
7145 : }
7146 :
7147 0 : static PyObject *py_winreg_EnumValue_out_get_name(PyObject *obj, void *closure)
7148 : {
7149 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7150 : PyObject *py_name;
7151 0 : if (object->out.name == NULL) {
7152 0 : Py_RETURN_NONE;
7153 : }
7154 0 : py_name = pytalloc_reference_ex(&winreg_ValNameBuf_Type, object->out.name, object->out.name);
7155 0 : return py_name;
7156 : }
7157 :
7158 0 : static int py_winreg_EnumValue_out_set_name(PyObject *py_obj, PyObject *value, void *closure)
7159 : {
7160 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7161 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.name));
7162 0 : if (value == NULL) {
7163 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.name");
7164 0 : return -1;
7165 : }
7166 0 : object->out.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.name);
7167 0 : if (object->out.name == NULL) {
7168 0 : PyErr_NoMemory();
7169 0 : return -1;
7170 : }
7171 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, value, return -1;);
7172 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
7173 0 : PyErr_NoMemory();
7174 0 : return -1;
7175 : }
7176 0 : object->out.name = (struct winreg_ValNameBuf *)pytalloc_get_ptr(value);
7177 0 : return 0;
7178 : }
7179 :
7180 0 : static PyObject *py_winreg_EnumValue_in_get_type(PyObject *obj, void *closure)
7181 : {
7182 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7183 : PyObject *py_type;
7184 0 : if (object->in.type == NULL) {
7185 0 : Py_RETURN_NONE;
7186 : }
7187 0 : if (object->in.type == NULL) {
7188 0 : py_type = Py_None;
7189 0 : Py_INCREF(py_type);
7190 : } else {
7191 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.type));
7192 : }
7193 0 : return py_type;
7194 : }
7195 :
7196 0 : static int py_winreg_EnumValue_in_set_type(PyObject *py_obj, PyObject *value, void *closure)
7197 : {
7198 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7199 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.type));
7200 0 : if (value == NULL) {
7201 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.type");
7202 0 : return -1;
7203 : }
7204 0 : if (value == Py_None) {
7205 0 : object->in.type = NULL;
7206 : } else {
7207 0 : object->in.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.type);
7208 0 : if (object->in.type == NULL) {
7209 0 : PyErr_NoMemory();
7210 0 : return -1;
7211 : }
7212 : {
7213 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.type));
7214 0 : if (PyLong_Check(value)) {
7215 : unsigned long long test_var;
7216 0 : test_var = PyLong_AsUnsignedLongLong(value);
7217 0 : if (PyErr_Occurred() != NULL) {
7218 0 : return -1;
7219 : }
7220 0 : if (test_var > uint_max) {
7221 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7222 : PyLong_Type.tp_name, uint_max, test_var);
7223 0 : return -1;
7224 : }
7225 0 : *object->in.type = test_var;
7226 : } else {
7227 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7228 : PyLong_Type.tp_name);
7229 0 : return -1;
7230 : }
7231 : }
7232 : }
7233 0 : return 0;
7234 : }
7235 :
7236 0 : static PyObject *py_winreg_EnumValue_out_get_type(PyObject *obj, void *closure)
7237 : {
7238 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7239 : PyObject *py_type;
7240 0 : if (object->out.type == NULL) {
7241 0 : Py_RETURN_NONE;
7242 : }
7243 0 : if (object->out.type == NULL) {
7244 0 : py_type = Py_None;
7245 0 : Py_INCREF(py_type);
7246 : } else {
7247 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.type));
7248 : }
7249 0 : return py_type;
7250 : }
7251 :
7252 0 : static int py_winreg_EnumValue_out_set_type(PyObject *py_obj, PyObject *value, void *closure)
7253 : {
7254 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7255 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.type));
7256 0 : if (value == NULL) {
7257 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.type");
7258 0 : return -1;
7259 : }
7260 0 : if (value == Py_None) {
7261 0 : object->out.type = NULL;
7262 : } else {
7263 0 : object->out.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.type);
7264 0 : if (object->out.type == NULL) {
7265 0 : PyErr_NoMemory();
7266 0 : return -1;
7267 : }
7268 : {
7269 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.type));
7270 0 : if (PyLong_Check(value)) {
7271 : unsigned long long test_var;
7272 0 : test_var = PyLong_AsUnsignedLongLong(value);
7273 0 : if (PyErr_Occurred() != NULL) {
7274 0 : return -1;
7275 : }
7276 0 : if (test_var > uint_max) {
7277 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7278 : PyLong_Type.tp_name, uint_max, test_var);
7279 0 : return -1;
7280 : }
7281 0 : *object->out.type = test_var;
7282 : } else {
7283 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7284 : PyLong_Type.tp_name);
7285 0 : return -1;
7286 : }
7287 : }
7288 : }
7289 0 : return 0;
7290 : }
7291 :
7292 0 : static PyObject *py_winreg_EnumValue_in_get_value(PyObject *obj, void *closure)
7293 : {
7294 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7295 : PyObject *py_value;
7296 0 : if (object->in.value == NULL) {
7297 0 : Py_RETURN_NONE;
7298 : }
7299 0 : if (object->in.value == NULL) {
7300 0 : py_value = Py_None;
7301 0 : Py_INCREF(py_value);
7302 : } else {
7303 0 : py_value = PyList_New(object->in.length?*object->in.length:0);
7304 0 : if (py_value == NULL) {
7305 0 : return NULL;
7306 : }
7307 : {
7308 : int value_cntr_1;
7309 0 : for (value_cntr_1 = 0; value_cntr_1 < (object->in.length?*object->in.length:0); value_cntr_1++) {
7310 : PyObject *py_value_1;
7311 0 : py_value_1 = PyLong_FromLong((uint16_t)((object->in.value)[value_cntr_1]));
7312 0 : PyList_SetItem(py_value, value_cntr_1, py_value_1);
7313 : }
7314 : }
7315 : }
7316 0 : return py_value;
7317 : }
7318 :
7319 0 : static int py_winreg_EnumValue_in_set_value(PyObject *py_obj, PyObject *value, void *closure)
7320 : {
7321 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7322 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.value));
7323 0 : if (value == NULL) {
7324 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.value");
7325 0 : return -1;
7326 : }
7327 0 : if (value == Py_None) {
7328 0 : object->in.value = NULL;
7329 : } else {
7330 0 : object->in.value = NULL;
7331 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
7332 : {
7333 : int value_cntr_1;
7334 0 : object->in.value = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.value, PyList_GET_SIZE(value));
7335 0 : if (!object->in.value) { return -1; }
7336 0 : talloc_set_name_const(object->in.value, "ARRAY: object->in.value");
7337 0 : for (value_cntr_1 = 0; value_cntr_1 < PyList_GET_SIZE(value); value_cntr_1++) {
7338 0 : if (PyList_GET_ITEM(value, value_cntr_1) == NULL) {
7339 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.value)[value_cntr_1]");
7340 0 : return -1;
7341 : }
7342 : {
7343 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->in.value)[value_cntr_1]));
7344 0 : if (PyLong_Check(PyList_GET_ITEM(value, value_cntr_1))) {
7345 : unsigned long long test_var;
7346 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, value_cntr_1));
7347 0 : if (PyErr_Occurred() != NULL) {
7348 0 : return -1;
7349 : }
7350 0 : if (test_var > uint_max) {
7351 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7352 : PyLong_Type.tp_name, uint_max, test_var);
7353 0 : return -1;
7354 : }
7355 0 : (object->in.value)[value_cntr_1] = test_var;
7356 : } else {
7357 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7358 : PyLong_Type.tp_name);
7359 0 : return -1;
7360 : }
7361 : }
7362 : }
7363 : }
7364 : }
7365 0 : return 0;
7366 : }
7367 :
7368 0 : static PyObject *py_winreg_EnumValue_out_get_value(PyObject *obj, void *closure)
7369 : {
7370 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7371 : PyObject *py_value;
7372 0 : if (object->out.value == NULL) {
7373 0 : Py_RETURN_NONE;
7374 : }
7375 0 : if (object->out.value == NULL) {
7376 0 : py_value = Py_None;
7377 0 : Py_INCREF(py_value);
7378 : } else {
7379 0 : py_value = PyList_New(object->out.length?*object->out.length:0);
7380 0 : if (py_value == NULL) {
7381 0 : return NULL;
7382 : }
7383 : {
7384 : int value_cntr_1;
7385 0 : for (value_cntr_1 = 0; value_cntr_1 < (object->out.length?*object->out.length:0); value_cntr_1++) {
7386 : PyObject *py_value_1;
7387 0 : py_value_1 = PyLong_FromLong((uint16_t)((object->out.value)[value_cntr_1]));
7388 0 : PyList_SetItem(py_value, value_cntr_1, py_value_1);
7389 : }
7390 : }
7391 : }
7392 0 : return py_value;
7393 : }
7394 :
7395 0 : static int py_winreg_EnumValue_out_set_value(PyObject *py_obj, PyObject *value, void *closure)
7396 : {
7397 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7398 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.value));
7399 0 : if (value == NULL) {
7400 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.value");
7401 0 : return -1;
7402 : }
7403 0 : if (value == Py_None) {
7404 0 : object->out.value = NULL;
7405 : } else {
7406 0 : object->out.value = NULL;
7407 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
7408 : {
7409 : int value_cntr_1;
7410 0 : object->out.value = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.value, PyList_GET_SIZE(value));
7411 0 : if (!object->out.value) { return -1; }
7412 0 : talloc_set_name_const(object->out.value, "ARRAY: object->out.value");
7413 0 : for (value_cntr_1 = 0; value_cntr_1 < PyList_GET_SIZE(value); value_cntr_1++) {
7414 0 : if (PyList_GET_ITEM(value, value_cntr_1) == NULL) {
7415 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->out.value)[value_cntr_1]");
7416 0 : return -1;
7417 : }
7418 : {
7419 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->out.value)[value_cntr_1]));
7420 0 : if (PyLong_Check(PyList_GET_ITEM(value, value_cntr_1))) {
7421 : unsigned long long test_var;
7422 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, value_cntr_1));
7423 0 : if (PyErr_Occurred() != NULL) {
7424 0 : return -1;
7425 : }
7426 0 : if (test_var > uint_max) {
7427 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7428 : PyLong_Type.tp_name, uint_max, test_var);
7429 0 : return -1;
7430 : }
7431 0 : (object->out.value)[value_cntr_1] = test_var;
7432 : } else {
7433 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7434 : PyLong_Type.tp_name);
7435 0 : return -1;
7436 : }
7437 : }
7438 : }
7439 : }
7440 : }
7441 0 : return 0;
7442 : }
7443 :
7444 0 : static PyObject *py_winreg_EnumValue_in_get_size(PyObject *obj, void *closure)
7445 : {
7446 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7447 : PyObject *py_size;
7448 0 : if (object->in.size == NULL) {
7449 0 : Py_RETURN_NONE;
7450 : }
7451 0 : if (object->in.size == NULL) {
7452 0 : py_size = Py_None;
7453 0 : Py_INCREF(py_size);
7454 : } else {
7455 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.size));
7456 : }
7457 0 : return py_size;
7458 : }
7459 :
7460 0 : static int py_winreg_EnumValue_in_set_size(PyObject *py_obj, PyObject *value, void *closure)
7461 : {
7462 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7463 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.size));
7464 0 : if (value == NULL) {
7465 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.size");
7466 0 : return -1;
7467 : }
7468 0 : if (value == Py_None) {
7469 0 : object->in.size = NULL;
7470 : } else {
7471 0 : object->in.size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.size);
7472 0 : if (object->in.size == NULL) {
7473 0 : PyErr_NoMemory();
7474 0 : return -1;
7475 : }
7476 : {
7477 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.size));
7478 0 : if (PyLong_Check(value)) {
7479 : unsigned long long test_var;
7480 0 : test_var = PyLong_AsUnsignedLongLong(value);
7481 0 : if (PyErr_Occurred() != NULL) {
7482 0 : return -1;
7483 : }
7484 0 : if (test_var > uint_max) {
7485 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7486 : PyLong_Type.tp_name, uint_max, test_var);
7487 0 : return -1;
7488 : }
7489 0 : *object->in.size = test_var;
7490 : } else {
7491 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7492 : PyLong_Type.tp_name);
7493 0 : return -1;
7494 : }
7495 : }
7496 : }
7497 0 : return 0;
7498 : }
7499 :
7500 0 : static PyObject *py_winreg_EnumValue_out_get_size(PyObject *obj, void *closure)
7501 : {
7502 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7503 : PyObject *py_size;
7504 0 : if (object->out.size == NULL) {
7505 0 : Py_RETURN_NONE;
7506 : }
7507 0 : if (object->out.size == NULL) {
7508 0 : py_size = Py_None;
7509 0 : Py_INCREF(py_size);
7510 : } else {
7511 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.size));
7512 : }
7513 0 : return py_size;
7514 : }
7515 :
7516 0 : static int py_winreg_EnumValue_out_set_size(PyObject *py_obj, PyObject *value, void *closure)
7517 : {
7518 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7519 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.size));
7520 0 : if (value == NULL) {
7521 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.size");
7522 0 : return -1;
7523 : }
7524 0 : if (value == Py_None) {
7525 0 : object->out.size = NULL;
7526 : } else {
7527 0 : object->out.size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.size);
7528 0 : if (object->out.size == NULL) {
7529 0 : PyErr_NoMemory();
7530 0 : return -1;
7531 : }
7532 : {
7533 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.size));
7534 0 : if (PyLong_Check(value)) {
7535 : unsigned long long test_var;
7536 0 : test_var = PyLong_AsUnsignedLongLong(value);
7537 0 : if (PyErr_Occurred() != NULL) {
7538 0 : return -1;
7539 : }
7540 0 : if (test_var > uint_max) {
7541 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7542 : PyLong_Type.tp_name, uint_max, test_var);
7543 0 : return -1;
7544 : }
7545 0 : *object->out.size = test_var;
7546 : } else {
7547 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7548 : PyLong_Type.tp_name);
7549 0 : return -1;
7550 : }
7551 : }
7552 : }
7553 0 : return 0;
7554 : }
7555 :
7556 0 : static PyObject *py_winreg_EnumValue_in_get_length(PyObject *obj, void *closure)
7557 : {
7558 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7559 : PyObject *py_length;
7560 0 : if (object->in.length == NULL) {
7561 0 : Py_RETURN_NONE;
7562 : }
7563 0 : if (object->in.length == NULL) {
7564 0 : py_length = Py_None;
7565 0 : Py_INCREF(py_length);
7566 : } else {
7567 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.length));
7568 : }
7569 0 : return py_length;
7570 : }
7571 :
7572 0 : static int py_winreg_EnumValue_in_set_length(PyObject *py_obj, PyObject *value, void *closure)
7573 : {
7574 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7575 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.length));
7576 0 : if (value == NULL) {
7577 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.length");
7578 0 : return -1;
7579 : }
7580 0 : if (value == Py_None) {
7581 0 : object->in.length = NULL;
7582 : } else {
7583 0 : object->in.length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.length);
7584 0 : if (object->in.length == NULL) {
7585 0 : PyErr_NoMemory();
7586 0 : return -1;
7587 : }
7588 : {
7589 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.length));
7590 0 : if (PyLong_Check(value)) {
7591 : unsigned long long test_var;
7592 0 : test_var = PyLong_AsUnsignedLongLong(value);
7593 0 : if (PyErr_Occurred() != NULL) {
7594 0 : return -1;
7595 : }
7596 0 : if (test_var > uint_max) {
7597 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7598 : PyLong_Type.tp_name, uint_max, test_var);
7599 0 : return -1;
7600 : }
7601 0 : *object->in.length = test_var;
7602 : } else {
7603 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7604 : PyLong_Type.tp_name);
7605 0 : return -1;
7606 : }
7607 : }
7608 : }
7609 0 : return 0;
7610 : }
7611 :
7612 0 : static PyObject *py_winreg_EnumValue_out_get_length(PyObject *obj, void *closure)
7613 : {
7614 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7615 : PyObject *py_length;
7616 0 : if (object->out.length == NULL) {
7617 0 : Py_RETURN_NONE;
7618 : }
7619 0 : if (object->out.length == NULL) {
7620 0 : py_length = Py_None;
7621 0 : Py_INCREF(py_length);
7622 : } else {
7623 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.length));
7624 : }
7625 0 : return py_length;
7626 : }
7627 :
7628 0 : static int py_winreg_EnumValue_out_set_length(PyObject *py_obj, PyObject *value, void *closure)
7629 : {
7630 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7631 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.length));
7632 0 : if (value == NULL) {
7633 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.length");
7634 0 : return -1;
7635 : }
7636 0 : if (value == Py_None) {
7637 0 : object->out.length = NULL;
7638 : } else {
7639 0 : object->out.length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.length);
7640 0 : if (object->out.length == NULL) {
7641 0 : PyErr_NoMemory();
7642 0 : return -1;
7643 : }
7644 : {
7645 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.length));
7646 0 : if (PyLong_Check(value)) {
7647 : unsigned long long test_var;
7648 0 : test_var = PyLong_AsUnsignedLongLong(value);
7649 0 : if (PyErr_Occurred() != NULL) {
7650 0 : return -1;
7651 : }
7652 0 : if (test_var > uint_max) {
7653 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7654 : PyLong_Type.tp_name, uint_max, test_var);
7655 0 : return -1;
7656 : }
7657 0 : *object->out.length = test_var;
7658 : } else {
7659 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7660 : PyLong_Type.tp_name);
7661 0 : return -1;
7662 : }
7663 : }
7664 : }
7665 0 : return 0;
7666 : }
7667 :
7668 0 : static PyObject *py_winreg_EnumValue_get_result(PyObject *obj, void *closure)
7669 : {
7670 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(obj);
7671 : PyObject *py_result;
7672 0 : py_result = PyErr_FromWERROR(object->out.result);
7673 0 : return py_result;
7674 : }
7675 :
7676 0 : static int py_winreg_EnumValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
7677 : {
7678 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7679 0 : if (value == NULL) {
7680 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
7681 0 : return -1;
7682 : }
7683 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
7684 0 : return 0;
7685 : }
7686 :
7687 : static PyGetSetDef py_winreg_EnumValue_getsetters[] = {
7688 : {
7689 : .name = discard_const_p(char, "in_handle"),
7690 : .get = py_winreg_EnumValue_in_get_handle,
7691 : .set = py_winreg_EnumValue_in_set_handle,
7692 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
7693 : },
7694 : {
7695 : .name = discard_const_p(char, "in_enum_index"),
7696 : .get = py_winreg_EnumValue_in_get_enum_index,
7697 : .set = py_winreg_EnumValue_in_set_enum_index,
7698 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7699 : },
7700 : {
7701 : .name = discard_const_p(char, "in_name"),
7702 : .get = py_winreg_EnumValue_in_get_name,
7703 : .set = py_winreg_EnumValue_in_set_name,
7704 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_ValNameBuf")
7705 : },
7706 : {
7707 : .name = discard_const_p(char, "out_name"),
7708 : .get = py_winreg_EnumValue_out_get_name,
7709 : .set = py_winreg_EnumValue_out_set_name,
7710 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_ValNameBuf")
7711 : },
7712 : {
7713 : .name = discard_const_p(char, "in_type"),
7714 : .get = py_winreg_EnumValue_in_get_type,
7715 : .set = py_winreg_EnumValue_in_set_type,
7716 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
7717 : },
7718 : {
7719 : .name = discard_const_p(char, "out_type"),
7720 : .get = py_winreg_EnumValue_out_get_type,
7721 : .set = py_winreg_EnumValue_out_set_type,
7722 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
7723 : },
7724 : {
7725 : .name = discard_const_p(char, "in_value"),
7726 : .get = py_winreg_EnumValue_in_get_value,
7727 : .set = py_winreg_EnumValue_in_set_value,
7728 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
7729 : },
7730 : {
7731 : .name = discard_const_p(char, "out_value"),
7732 : .get = py_winreg_EnumValue_out_get_value,
7733 : .set = py_winreg_EnumValue_out_set_value,
7734 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
7735 : },
7736 : {
7737 : .name = discard_const_p(char, "in_size"),
7738 : .get = py_winreg_EnumValue_in_get_size,
7739 : .set = py_winreg_EnumValue_in_set_size,
7740 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7741 : },
7742 : {
7743 : .name = discard_const_p(char, "out_size"),
7744 : .get = py_winreg_EnumValue_out_get_size,
7745 : .set = py_winreg_EnumValue_out_set_size,
7746 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7747 : },
7748 : {
7749 : .name = discard_const_p(char, "in_length"),
7750 : .get = py_winreg_EnumValue_in_get_length,
7751 : .set = py_winreg_EnumValue_in_set_length,
7752 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7753 : },
7754 : {
7755 : .name = discard_const_p(char, "out_length"),
7756 : .get = py_winreg_EnumValue_out_get_length,
7757 : .set = py_winreg_EnumValue_out_set_length,
7758 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7759 : },
7760 : {
7761 : .name = discard_const_p(char, "result"),
7762 : .get = py_winreg_EnumValue_get_result,
7763 : .set = py_winreg_EnumValue_set_result,
7764 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
7765 : },
7766 : { .name = NULL }
7767 : };
7768 :
7769 0 : static PyObject *py_winreg_EnumValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
7770 : {
7771 0 : PyObject *self = pytalloc_new(struct winreg_EnumValue, type);
7772 0 : struct winreg_EnumValue *_self = (struct winreg_EnumValue *)pytalloc_get_ptr(self);
7773 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
7774 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
7775 0 : _self->in.name = talloc_zero(mem_ctx, struct winreg_ValNameBuf);
7776 0 : _self->out.name = talloc_zero(mem_ctx, struct winreg_ValNameBuf);
7777 0 : return self;
7778 : }
7779 :
7780 0 : static PyObject *py_winreg_EnumValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
7781 : {
7782 :
7783 :
7784 0 : return PyLong_FromLong(10);
7785 : }
7786 :
7787 0 : static PyObject *py_winreg_EnumValue_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
7788 : {
7789 0 : const struct ndr_interface_call *call = NULL;
7790 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7791 0 : PyObject *ret = NULL;
7792 0 : struct ndr_push *push = NULL;
7793 : DATA_BLOB blob;
7794 : enum ndr_err_code err;
7795 :
7796 0 : if (ndr_table_winreg.num_calls < 11) {
7797 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumValue_ndr_pack");
7798 0 : return NULL;
7799 : }
7800 0 : call = &ndr_table_winreg.calls[10];
7801 :
7802 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
7803 0 : if (push == NULL) {
7804 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
7805 0 : return NULL;
7806 : }
7807 :
7808 0 : push->flags |= ndr_push_flags;
7809 :
7810 0 : err = call->ndr_push(push, ndr_inout_flags, object);
7811 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
7812 0 : TALLOC_FREE(push);
7813 0 : PyErr_SetNdrError(err);
7814 0 : return NULL;
7815 : }
7816 0 : blob = ndr_push_blob(push);
7817 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
7818 0 : TALLOC_FREE(push);
7819 0 : return ret;
7820 : }
7821 :
7822 0 : static PyObject *py_winreg_EnumValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7823 : {
7824 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
7825 0 : PyObject *bigendian_obj = NULL;
7826 0 : PyObject *ndr64_obj = NULL;
7827 0 : libndr_flags ndr_push_flags = 0;
7828 :
7829 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
7830 : discard_const_p(char *, kwnames),
7831 : &bigendian_obj,
7832 : &ndr64_obj)) {
7833 0 : return NULL;
7834 : }
7835 :
7836 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7837 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
7838 : }
7839 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7840 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
7841 : }
7842 :
7843 0 : return py_winreg_EnumValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
7844 : }
7845 :
7846 0 : static PyObject *py_winreg_EnumValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7847 : {
7848 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
7849 0 : PyObject *bigendian_obj = NULL;
7850 0 : PyObject *ndr64_obj = NULL;
7851 0 : libndr_flags ndr_push_flags = 0;
7852 :
7853 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
7854 : discard_const_p(char *, kwnames),
7855 : &bigendian_obj,
7856 : &ndr64_obj)) {
7857 0 : return NULL;
7858 : }
7859 :
7860 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7861 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
7862 : }
7863 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7864 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
7865 : }
7866 :
7867 0 : return py_winreg_EnumValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
7868 : }
7869 :
7870 0 : static PyObject *py_winreg_EnumValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
7871 : {
7872 0 : const struct ndr_interface_call *call = NULL;
7873 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7874 0 : struct ndr_pull *pull = NULL;
7875 : enum ndr_err_code err;
7876 :
7877 0 : if (ndr_table_winreg.num_calls < 11) {
7878 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumValue_ndr_unpack");
7879 0 : return NULL;
7880 : }
7881 0 : call = &ndr_table_winreg.calls[10];
7882 :
7883 0 : pull = ndr_pull_init_blob(blob, object);
7884 0 : if (pull == NULL) {
7885 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
7886 0 : return NULL;
7887 : }
7888 :
7889 0 : pull->flags |= ndr_pull_flags;
7890 :
7891 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
7892 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
7893 0 : TALLOC_FREE(pull);
7894 0 : PyErr_SetNdrError(err);
7895 0 : return NULL;
7896 : }
7897 0 : if (!allow_remaining) {
7898 : uint32_t highest_ofs;
7899 :
7900 0 : if (pull->offset > pull->relative_highest_offset) {
7901 0 : highest_ofs = pull->offset;
7902 : } else {
7903 0 : highest_ofs = pull->relative_highest_offset;
7904 : }
7905 0 : if (highest_ofs < pull->data_size) {
7906 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
7907 : "not all bytes consumed ofs[%u] size[%u]",
7908 : highest_ofs, pull->data_size);
7909 0 : TALLOC_FREE(pull);
7910 0 : PyErr_SetNdrError(err);
7911 0 : return NULL;
7912 : }
7913 : }
7914 :
7915 0 : TALLOC_FREE(pull);
7916 0 : Py_RETURN_NONE;
7917 : }
7918 :
7919 0 : static PyObject *py_winreg_EnumValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7920 : {
7921 : DATA_BLOB blob;
7922 0 : Py_ssize_t blob_length = 0;
7923 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
7924 0 : PyObject *bigendian_obj = NULL;
7925 0 : PyObject *ndr64_obj = NULL;
7926 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
7927 0 : PyObject *allow_remaining_obj = NULL;
7928 0 : bool allow_remaining = false;
7929 :
7930 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
7931 : discard_const_p(char *, kwnames),
7932 : &blob.data, &blob_length,
7933 : &bigendian_obj,
7934 : &ndr64_obj,
7935 : &allow_remaining_obj)) {
7936 0 : return NULL;
7937 : }
7938 0 : blob.length = blob_length;
7939 :
7940 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7941 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
7942 : }
7943 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7944 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
7945 : }
7946 :
7947 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
7948 0 : allow_remaining = true;
7949 : }
7950 :
7951 0 : return py_winreg_EnumValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
7952 : }
7953 :
7954 0 : static PyObject *py_winreg_EnumValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7955 : {
7956 : DATA_BLOB blob;
7957 0 : Py_ssize_t blob_length = 0;
7958 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
7959 0 : PyObject *bigendian_obj = NULL;
7960 0 : PyObject *ndr64_obj = NULL;
7961 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
7962 0 : PyObject *allow_remaining_obj = NULL;
7963 0 : bool allow_remaining = false;
7964 :
7965 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
7966 : discard_const_p(char *, kwnames),
7967 : &blob.data, &blob_length,
7968 : &bigendian_obj,
7969 : &ndr64_obj,
7970 : &allow_remaining_obj)) {
7971 0 : return NULL;
7972 : }
7973 0 : blob.length = blob_length;
7974 :
7975 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7976 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
7977 : }
7978 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7979 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
7980 : }
7981 :
7982 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
7983 0 : allow_remaining = true;
7984 : }
7985 :
7986 0 : return py_winreg_EnumValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
7987 : }
7988 :
7989 0 : static PyObject *py_winreg_EnumValue_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
7990 : {
7991 0 : const struct ndr_interface_call *call = NULL;
7992 0 : struct winreg_EnumValue *object = pytalloc_get_ptr(py_obj);
7993 : PyObject *ret;
7994 : char *retstr;
7995 :
7996 0 : if (ndr_table_winreg.num_calls < 11) {
7997 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumValue_ndr_print");
7998 0 : return NULL;
7999 : }
8000 0 : call = &ndr_table_winreg.calls[10];
8001 :
8002 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
8003 0 : ret = PyUnicode_FromString(retstr);
8004 0 : TALLOC_FREE(retstr);
8005 :
8006 0 : return ret;
8007 : }
8008 :
8009 0 : static PyObject *py_winreg_EnumValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8010 : {
8011 0 : return py_winreg_EnumValue_ndr_print(py_obj, "winreg_EnumValue_in", NDR_IN);
8012 : }
8013 :
8014 0 : static PyObject *py_winreg_EnumValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8015 : {
8016 0 : return py_winreg_EnumValue_ndr_print(py_obj, "winreg_EnumValue_out", NDR_OUT);
8017 : }
8018 :
8019 : static PyMethodDef py_winreg_EnumValue_methods[] = {
8020 : { "opnum", (PyCFunction)py_winreg_EnumValue_ndr_opnum, METH_NOARGS|METH_CLASS,
8021 : "winreg.EnumValue.opnum() -> 10 (0x0a) " },
8022 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
8023 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
8024 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
8025 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
8026 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
8027 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
8028 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
8029 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
8030 : { "__ndr_print_in__", (PyCFunction)py_winreg_EnumValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
8031 : { "__ndr_print_out__", (PyCFunction)py_winreg_EnumValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
8032 : { NULL, NULL, 0, NULL }
8033 : };
8034 :
8035 :
8036 : static PyTypeObject winreg_EnumValue_Type = {
8037 : PyVarObject_HEAD_INIT(NULL, 0)
8038 : .tp_name = "winreg.EnumValue",
8039 : .tp_getset = py_winreg_EnumValue_getsetters,
8040 : .tp_methods = py_winreg_EnumValue_methods,
8041 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
8042 : .tp_new = py_winreg_EnumValue_new,
8043 : };
8044 :
8045 0 : static bool pack_py_winreg_EnumValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_EnumValue *r)
8046 : {
8047 : PyObject *py_handle;
8048 : PyObject *py_enum_index;
8049 : PyObject *py_name;
8050 : PyObject *py_type;
8051 : PyObject *py_value;
8052 : PyObject *py_size;
8053 : PyObject *py_length;
8054 0 : const char *kwnames[] = {
8055 : "handle", "enum_index", "name", "type", "value", "size", "length", NULL
8056 : };
8057 :
8058 0 : 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)) {
8059 0 : return false;
8060 : }
8061 :
8062 0 : if (py_handle == NULL) {
8063 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
8064 0 : return false;
8065 : }
8066 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
8067 0 : if (r->in.handle == NULL) {
8068 0 : PyErr_NoMemory();
8069 0 : return false;
8070 : }
8071 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
8072 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
8073 0 : PyErr_NoMemory();
8074 0 : return false;
8075 : }
8076 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
8077 0 : if (py_enum_index == NULL) {
8078 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.enum_index");
8079 0 : return false;
8080 : }
8081 : {
8082 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.enum_index));
8083 0 : if (PyLong_Check(py_enum_index)) {
8084 : unsigned long long test_var;
8085 0 : test_var = PyLong_AsUnsignedLongLong(py_enum_index);
8086 0 : if (PyErr_Occurred() != NULL) {
8087 0 : return false;
8088 : }
8089 0 : if (test_var > uint_max) {
8090 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8091 : PyLong_Type.tp_name, uint_max, test_var);
8092 0 : return false;
8093 : }
8094 0 : r->in.enum_index = test_var;
8095 : } else {
8096 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8097 : PyLong_Type.tp_name);
8098 0 : return false;
8099 : }
8100 : }
8101 0 : if (py_name == NULL) {
8102 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.name");
8103 0 : return false;
8104 : }
8105 0 : r->in.name = talloc_ptrtype(r, r->in.name);
8106 0 : if (r->in.name == NULL) {
8107 0 : PyErr_NoMemory();
8108 0 : return false;
8109 : }
8110 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, py_name, return false;);
8111 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
8112 0 : PyErr_NoMemory();
8113 0 : return false;
8114 : }
8115 0 : r->in.name = (struct winreg_ValNameBuf *)pytalloc_get_ptr(py_name);
8116 0 : if (py_type == NULL) {
8117 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.type");
8118 0 : return false;
8119 : }
8120 0 : if (py_type == Py_None) {
8121 0 : r->in.type = NULL;
8122 : } else {
8123 0 : r->in.type = talloc_ptrtype(r, r->in.type);
8124 0 : if (r->in.type == NULL) {
8125 0 : PyErr_NoMemory();
8126 0 : return false;
8127 : }
8128 : {
8129 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.type));
8130 0 : if (PyLong_Check(py_type)) {
8131 : unsigned long long test_var;
8132 0 : test_var = PyLong_AsUnsignedLongLong(py_type);
8133 0 : if (PyErr_Occurred() != NULL) {
8134 0 : return false;
8135 : }
8136 0 : if (test_var > uint_max) {
8137 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8138 : PyLong_Type.tp_name, uint_max, test_var);
8139 0 : return false;
8140 : }
8141 0 : *r->in.type = test_var;
8142 : } else {
8143 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8144 : PyLong_Type.tp_name);
8145 0 : return false;
8146 : }
8147 : }
8148 : }
8149 0 : if (py_value == NULL) {
8150 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.value");
8151 0 : return false;
8152 : }
8153 0 : if (py_value == Py_None) {
8154 0 : r->in.value = NULL;
8155 : } else {
8156 0 : r->in.value = NULL;
8157 0 : PY_CHECK_TYPE(&PyList_Type, py_value, return false;);
8158 : {
8159 : int value_cntr_1;
8160 0 : r->in.value = talloc_array_ptrtype(r, r->in.value, PyList_GET_SIZE(py_value));
8161 0 : if (!r->in.value) { return false; }
8162 0 : talloc_set_name_const(r->in.value, "ARRAY: r->in.value");
8163 0 : for (value_cntr_1 = 0; value_cntr_1 < PyList_GET_SIZE(py_value); value_cntr_1++) {
8164 0 : if (PyList_GET_ITEM(py_value, value_cntr_1) == NULL) {
8165 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.value)[value_cntr_1]");
8166 0 : return false;
8167 : }
8168 : {
8169 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((r->in.value)[value_cntr_1]));
8170 0 : if (PyLong_Check(PyList_GET_ITEM(py_value, value_cntr_1))) {
8171 : unsigned long long test_var;
8172 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_value, value_cntr_1));
8173 0 : if (PyErr_Occurred() != NULL) {
8174 0 : return false;
8175 : }
8176 0 : if (test_var > uint_max) {
8177 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8178 : PyLong_Type.tp_name, uint_max, test_var);
8179 0 : return false;
8180 : }
8181 0 : (r->in.value)[value_cntr_1] = test_var;
8182 : } else {
8183 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8184 : PyLong_Type.tp_name);
8185 0 : return false;
8186 : }
8187 : }
8188 : }
8189 : }
8190 : }
8191 0 : if (py_size == NULL) {
8192 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.size");
8193 0 : return false;
8194 : }
8195 0 : if (py_size == Py_None) {
8196 0 : r->in.size = NULL;
8197 : } else {
8198 0 : r->in.size = talloc_ptrtype(r, r->in.size);
8199 0 : if (r->in.size == NULL) {
8200 0 : PyErr_NoMemory();
8201 0 : return false;
8202 : }
8203 : {
8204 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.size));
8205 0 : if (PyLong_Check(py_size)) {
8206 : unsigned long long test_var;
8207 0 : test_var = PyLong_AsUnsignedLongLong(py_size);
8208 0 : if (PyErr_Occurred() != NULL) {
8209 0 : return false;
8210 : }
8211 0 : if (test_var > uint_max) {
8212 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8213 : PyLong_Type.tp_name, uint_max, test_var);
8214 0 : return false;
8215 : }
8216 0 : *r->in.size = test_var;
8217 : } else {
8218 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8219 : PyLong_Type.tp_name);
8220 0 : return false;
8221 : }
8222 : }
8223 : }
8224 0 : if (py_length == NULL) {
8225 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.length");
8226 0 : return false;
8227 : }
8228 0 : if (py_length == Py_None) {
8229 0 : r->in.length = NULL;
8230 : } else {
8231 0 : r->in.length = talloc_ptrtype(r, r->in.length);
8232 0 : if (r->in.length == NULL) {
8233 0 : PyErr_NoMemory();
8234 0 : return false;
8235 : }
8236 : {
8237 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.length));
8238 0 : if (PyLong_Check(py_length)) {
8239 : unsigned long long test_var;
8240 0 : test_var = PyLong_AsUnsignedLongLong(py_length);
8241 0 : if (PyErr_Occurred() != NULL) {
8242 0 : return false;
8243 : }
8244 0 : if (test_var > uint_max) {
8245 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8246 : PyLong_Type.tp_name, uint_max, test_var);
8247 0 : return false;
8248 : }
8249 0 : *r->in.length = test_var;
8250 : } else {
8251 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8252 : PyLong_Type.tp_name);
8253 0 : return false;
8254 : }
8255 : }
8256 : }
8257 0 : return true;
8258 : }
8259 :
8260 0 : static PyObject *unpack_py_winreg_EnumValue_args_out(struct winreg_EnumValue *r)
8261 : {
8262 : PyObject *result;
8263 : PyObject *py_name;
8264 : PyObject *py_type;
8265 : PyObject *py_value;
8266 : PyObject *py_size;
8267 : PyObject *py_length;
8268 0 : result = PyTuple_New(5);
8269 0 : py_name = pytalloc_reference_ex(&winreg_ValNameBuf_Type, r->out.name, r->out.name);
8270 0 : PyTuple_SetItem(result, 0, py_name);
8271 0 : if (r->out.type == NULL) {
8272 0 : py_type = Py_None;
8273 0 : Py_INCREF(py_type);
8274 : } else {
8275 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.type));
8276 : }
8277 0 : PyTuple_SetItem(result, 1, py_type);
8278 0 : if (r->out.value == NULL) {
8279 0 : py_value = Py_None;
8280 0 : Py_INCREF(py_value);
8281 : } else {
8282 0 : py_value = PyList_New(r->out.length?*r->out.length:0);
8283 0 : if (py_value == NULL) {
8284 0 : return NULL;
8285 : }
8286 : {
8287 : int value_cntr_1;
8288 0 : for (value_cntr_1 = 0; value_cntr_1 < (r->out.length?*r->out.length:0); value_cntr_1++) {
8289 : PyObject *py_value_1;
8290 0 : py_value_1 = PyLong_FromLong((uint16_t)((r->out.value)[value_cntr_1]));
8291 0 : PyList_SetItem(py_value, value_cntr_1, py_value_1);
8292 : }
8293 : }
8294 : }
8295 0 : PyTuple_SetItem(result, 2, py_value);
8296 0 : if (r->out.size == NULL) {
8297 0 : py_size = Py_None;
8298 0 : Py_INCREF(py_size);
8299 : } else {
8300 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.size));
8301 : }
8302 0 : PyTuple_SetItem(result, 3, py_size);
8303 0 : if (r->out.length == NULL) {
8304 0 : py_length = Py_None;
8305 0 : Py_INCREF(py_length);
8306 : } else {
8307 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.length));
8308 : }
8309 0 : PyTuple_SetItem(result, 4, py_length);
8310 0 : if (!W_ERROR_IS_OK(r->out.result)) {
8311 0 : PyErr_SetWERROR(r->out.result);
8312 0 : return NULL;
8313 : }
8314 :
8315 0 : return result;
8316 : }
8317 :
8318 :
8319 0 : static PyObject *py_winreg_FlushKey_in_get_handle(PyObject *obj, void *closure)
8320 : {
8321 0 : struct winreg_FlushKey *object = pytalloc_get_ptr(obj);
8322 : PyObject *py_handle;
8323 0 : if (object->in.handle == NULL) {
8324 0 : Py_RETURN_NONE;
8325 : }
8326 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
8327 0 : return py_handle;
8328 : }
8329 :
8330 0 : static int py_winreg_FlushKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
8331 : {
8332 0 : struct winreg_FlushKey *object = pytalloc_get_ptr(py_obj);
8333 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
8334 0 : if (value == NULL) {
8335 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
8336 0 : return -1;
8337 : }
8338 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
8339 0 : if (object->in.handle == NULL) {
8340 0 : PyErr_NoMemory();
8341 0 : return -1;
8342 : }
8343 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
8344 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8345 0 : PyErr_NoMemory();
8346 0 : return -1;
8347 : }
8348 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
8349 0 : return 0;
8350 : }
8351 :
8352 0 : static PyObject *py_winreg_FlushKey_get_result(PyObject *obj, void *closure)
8353 : {
8354 0 : struct winreg_FlushKey *object = pytalloc_get_ptr(obj);
8355 : PyObject *py_result;
8356 0 : py_result = PyErr_FromWERROR(object->out.result);
8357 0 : return py_result;
8358 : }
8359 :
8360 0 : static int py_winreg_FlushKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
8361 : {
8362 0 : struct winreg_FlushKey *object = pytalloc_get_ptr(py_obj);
8363 0 : if (value == NULL) {
8364 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
8365 0 : return -1;
8366 : }
8367 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
8368 0 : return 0;
8369 : }
8370 :
8371 : static PyGetSetDef py_winreg_FlushKey_getsetters[] = {
8372 : {
8373 : .name = discard_const_p(char, "in_handle"),
8374 : .get = py_winreg_FlushKey_in_get_handle,
8375 : .set = py_winreg_FlushKey_in_set_handle,
8376 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
8377 : },
8378 : {
8379 : .name = discard_const_p(char, "result"),
8380 : .get = py_winreg_FlushKey_get_result,
8381 : .set = py_winreg_FlushKey_set_result,
8382 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
8383 : },
8384 : { .name = NULL }
8385 : };
8386 :
8387 0 : static PyObject *py_winreg_FlushKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
8388 : {
8389 0 : PyObject *self = pytalloc_new(struct winreg_FlushKey, type);
8390 0 : struct winreg_FlushKey *_self = (struct winreg_FlushKey *)pytalloc_get_ptr(self);
8391 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
8392 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
8393 0 : return self;
8394 : }
8395 :
8396 0 : static PyObject *py_winreg_FlushKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
8397 : {
8398 :
8399 :
8400 0 : return PyLong_FromLong(11);
8401 : }
8402 :
8403 0 : static PyObject *py_winreg_FlushKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
8404 : {
8405 0 : const struct ndr_interface_call *call = NULL;
8406 0 : struct winreg_FlushKey *object = pytalloc_get_ptr(py_obj);
8407 0 : PyObject *ret = NULL;
8408 0 : struct ndr_push *push = NULL;
8409 : DATA_BLOB blob;
8410 : enum ndr_err_code err;
8411 :
8412 0 : if (ndr_table_winreg.num_calls < 12) {
8413 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_FlushKey_ndr_pack");
8414 0 : return NULL;
8415 : }
8416 0 : call = &ndr_table_winreg.calls[11];
8417 :
8418 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
8419 0 : if (push == NULL) {
8420 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
8421 0 : return NULL;
8422 : }
8423 :
8424 0 : push->flags |= ndr_push_flags;
8425 :
8426 0 : err = call->ndr_push(push, ndr_inout_flags, object);
8427 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
8428 0 : TALLOC_FREE(push);
8429 0 : PyErr_SetNdrError(err);
8430 0 : return NULL;
8431 : }
8432 0 : blob = ndr_push_blob(push);
8433 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
8434 0 : TALLOC_FREE(push);
8435 0 : return ret;
8436 : }
8437 :
8438 0 : static PyObject *py_winreg_FlushKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8439 : {
8440 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8441 0 : PyObject *bigendian_obj = NULL;
8442 0 : PyObject *ndr64_obj = NULL;
8443 0 : libndr_flags ndr_push_flags = 0;
8444 :
8445 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
8446 : discard_const_p(char *, kwnames),
8447 : &bigendian_obj,
8448 : &ndr64_obj)) {
8449 0 : return NULL;
8450 : }
8451 :
8452 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8453 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8454 : }
8455 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8456 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8457 : }
8458 :
8459 0 : return py_winreg_FlushKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
8460 : }
8461 :
8462 0 : static PyObject *py_winreg_FlushKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8463 : {
8464 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8465 0 : PyObject *bigendian_obj = NULL;
8466 0 : PyObject *ndr64_obj = NULL;
8467 0 : libndr_flags ndr_push_flags = 0;
8468 :
8469 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
8470 : discard_const_p(char *, kwnames),
8471 : &bigendian_obj,
8472 : &ndr64_obj)) {
8473 0 : return NULL;
8474 : }
8475 :
8476 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8477 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8478 : }
8479 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8480 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8481 : }
8482 :
8483 0 : return py_winreg_FlushKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
8484 : }
8485 :
8486 0 : static PyObject *py_winreg_FlushKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
8487 : {
8488 0 : const struct ndr_interface_call *call = NULL;
8489 0 : struct winreg_FlushKey *object = pytalloc_get_ptr(py_obj);
8490 0 : struct ndr_pull *pull = NULL;
8491 : enum ndr_err_code err;
8492 :
8493 0 : if (ndr_table_winreg.num_calls < 12) {
8494 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_FlushKey_ndr_unpack");
8495 0 : return NULL;
8496 : }
8497 0 : call = &ndr_table_winreg.calls[11];
8498 :
8499 0 : pull = ndr_pull_init_blob(blob, object);
8500 0 : if (pull == NULL) {
8501 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
8502 0 : return NULL;
8503 : }
8504 :
8505 0 : pull->flags |= ndr_pull_flags;
8506 :
8507 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
8508 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
8509 0 : TALLOC_FREE(pull);
8510 0 : PyErr_SetNdrError(err);
8511 0 : return NULL;
8512 : }
8513 0 : if (!allow_remaining) {
8514 : uint32_t highest_ofs;
8515 :
8516 0 : if (pull->offset > pull->relative_highest_offset) {
8517 0 : highest_ofs = pull->offset;
8518 : } else {
8519 0 : highest_ofs = pull->relative_highest_offset;
8520 : }
8521 0 : if (highest_ofs < pull->data_size) {
8522 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
8523 : "not all bytes consumed ofs[%u] size[%u]",
8524 : highest_ofs, pull->data_size);
8525 0 : TALLOC_FREE(pull);
8526 0 : PyErr_SetNdrError(err);
8527 0 : return NULL;
8528 : }
8529 : }
8530 :
8531 0 : TALLOC_FREE(pull);
8532 0 : Py_RETURN_NONE;
8533 : }
8534 :
8535 0 : static PyObject *py_winreg_FlushKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8536 : {
8537 : DATA_BLOB blob;
8538 0 : Py_ssize_t blob_length = 0;
8539 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
8540 0 : PyObject *bigendian_obj = NULL;
8541 0 : PyObject *ndr64_obj = NULL;
8542 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
8543 0 : PyObject *allow_remaining_obj = NULL;
8544 0 : bool allow_remaining = false;
8545 :
8546 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
8547 : discard_const_p(char *, kwnames),
8548 : &blob.data, &blob_length,
8549 : &bigendian_obj,
8550 : &ndr64_obj,
8551 : &allow_remaining_obj)) {
8552 0 : return NULL;
8553 : }
8554 0 : blob.length = blob_length;
8555 :
8556 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8557 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
8558 : }
8559 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8560 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
8561 : }
8562 :
8563 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
8564 0 : allow_remaining = true;
8565 : }
8566 :
8567 0 : return py_winreg_FlushKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
8568 : }
8569 :
8570 0 : static PyObject *py_winreg_FlushKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8571 : {
8572 : DATA_BLOB blob;
8573 0 : Py_ssize_t blob_length = 0;
8574 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
8575 0 : PyObject *bigendian_obj = NULL;
8576 0 : PyObject *ndr64_obj = NULL;
8577 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
8578 0 : PyObject *allow_remaining_obj = NULL;
8579 0 : bool allow_remaining = false;
8580 :
8581 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
8582 : discard_const_p(char *, kwnames),
8583 : &blob.data, &blob_length,
8584 : &bigendian_obj,
8585 : &ndr64_obj,
8586 : &allow_remaining_obj)) {
8587 0 : return NULL;
8588 : }
8589 0 : blob.length = blob_length;
8590 :
8591 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8592 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
8593 : }
8594 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8595 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
8596 : }
8597 :
8598 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
8599 0 : allow_remaining = true;
8600 : }
8601 :
8602 0 : return py_winreg_FlushKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
8603 : }
8604 :
8605 0 : static PyObject *py_winreg_FlushKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
8606 : {
8607 0 : const struct ndr_interface_call *call = NULL;
8608 0 : struct winreg_FlushKey *object = pytalloc_get_ptr(py_obj);
8609 : PyObject *ret;
8610 : char *retstr;
8611 :
8612 0 : if (ndr_table_winreg.num_calls < 12) {
8613 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_FlushKey_ndr_print");
8614 0 : return NULL;
8615 : }
8616 0 : call = &ndr_table_winreg.calls[11];
8617 :
8618 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
8619 0 : ret = PyUnicode_FromString(retstr);
8620 0 : TALLOC_FREE(retstr);
8621 :
8622 0 : return ret;
8623 : }
8624 :
8625 0 : static PyObject *py_winreg_FlushKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8626 : {
8627 0 : return py_winreg_FlushKey_ndr_print(py_obj, "winreg_FlushKey_in", NDR_IN);
8628 : }
8629 :
8630 0 : static PyObject *py_winreg_FlushKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8631 : {
8632 0 : return py_winreg_FlushKey_ndr_print(py_obj, "winreg_FlushKey_out", NDR_OUT);
8633 : }
8634 :
8635 : static PyMethodDef py_winreg_FlushKey_methods[] = {
8636 : { "opnum", (PyCFunction)py_winreg_FlushKey_ndr_opnum, METH_NOARGS|METH_CLASS,
8637 : "winreg.FlushKey.opnum() -> 11 (0x0b) " },
8638 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
8639 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
8640 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
8641 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
8642 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
8643 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
8644 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
8645 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
8646 : { "__ndr_print_in__", (PyCFunction)py_winreg_FlushKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
8647 : { "__ndr_print_out__", (PyCFunction)py_winreg_FlushKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
8648 : { NULL, NULL, 0, NULL }
8649 : };
8650 :
8651 :
8652 : static PyTypeObject winreg_FlushKey_Type = {
8653 : PyVarObject_HEAD_INIT(NULL, 0)
8654 : .tp_name = "winreg.FlushKey",
8655 : .tp_getset = py_winreg_FlushKey_getsetters,
8656 : .tp_methods = py_winreg_FlushKey_methods,
8657 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
8658 : .tp_new = py_winreg_FlushKey_new,
8659 : };
8660 :
8661 0 : static bool pack_py_winreg_FlushKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_FlushKey *r)
8662 : {
8663 : PyObject *py_handle;
8664 0 : const char *kwnames[] = {
8665 : "handle", NULL
8666 : };
8667 :
8668 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_FlushKey", discard_const_p(char *, kwnames), &py_handle)) {
8669 0 : return false;
8670 : }
8671 :
8672 0 : if (py_handle == NULL) {
8673 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
8674 0 : return false;
8675 : }
8676 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
8677 0 : if (r->in.handle == NULL) {
8678 0 : PyErr_NoMemory();
8679 0 : return false;
8680 : }
8681 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
8682 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
8683 0 : PyErr_NoMemory();
8684 0 : return false;
8685 : }
8686 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
8687 0 : return true;
8688 : }
8689 :
8690 0 : static PyObject *unpack_py_winreg_FlushKey_args_out(struct winreg_FlushKey *r)
8691 : {
8692 : PyObject *result;
8693 0 : result = Py_None;
8694 0 : Py_INCREF(result);
8695 0 : if (!W_ERROR_IS_OK(r->out.result)) {
8696 0 : PyErr_SetWERROR(r->out.result);
8697 0 : return NULL;
8698 : }
8699 :
8700 0 : return result;
8701 : }
8702 :
8703 :
8704 0 : static PyObject *py_winreg_GetKeySecurity_in_get_handle(PyObject *obj, void *closure)
8705 : {
8706 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(obj);
8707 : PyObject *py_handle;
8708 0 : if (object->in.handle == NULL) {
8709 0 : Py_RETURN_NONE;
8710 : }
8711 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
8712 0 : return py_handle;
8713 : }
8714 :
8715 0 : static int py_winreg_GetKeySecurity_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
8716 : {
8717 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
8718 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
8719 0 : if (value == NULL) {
8720 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
8721 0 : return -1;
8722 : }
8723 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
8724 0 : if (object->in.handle == NULL) {
8725 0 : PyErr_NoMemory();
8726 0 : return -1;
8727 : }
8728 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
8729 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8730 0 : PyErr_NoMemory();
8731 0 : return -1;
8732 : }
8733 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
8734 0 : return 0;
8735 : }
8736 :
8737 0 : static PyObject *py_winreg_GetKeySecurity_in_get_sec_info(PyObject *obj, void *closure)
8738 : {
8739 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(obj);
8740 : PyObject *py_sec_info;
8741 0 : py_sec_info = PyLong_FromUnsignedLongLong((uint32_t)(object->in.sec_info));
8742 0 : return py_sec_info;
8743 : }
8744 :
8745 0 : static int py_winreg_GetKeySecurity_in_set_sec_info(PyObject *py_obj, PyObject *value, void *closure)
8746 : {
8747 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
8748 0 : if (value == NULL) {
8749 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.sec_info");
8750 0 : return -1;
8751 : }
8752 : {
8753 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.sec_info));
8754 0 : if (PyLong_Check(value)) {
8755 : unsigned long long test_var;
8756 0 : test_var = PyLong_AsUnsignedLongLong(value);
8757 0 : if (PyErr_Occurred() != NULL) {
8758 0 : return -1;
8759 : }
8760 0 : if (test_var > uint_max) {
8761 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8762 : PyLong_Type.tp_name, uint_max, test_var);
8763 0 : return -1;
8764 : }
8765 0 : object->in.sec_info = test_var;
8766 : } else {
8767 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8768 : PyLong_Type.tp_name);
8769 0 : return -1;
8770 : }
8771 : }
8772 0 : return 0;
8773 : }
8774 :
8775 0 : static PyObject *py_winreg_GetKeySecurity_in_get_sd(PyObject *obj, void *closure)
8776 : {
8777 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(obj);
8778 : PyObject *py_sd;
8779 0 : if (object->in.sd == NULL) {
8780 0 : Py_RETURN_NONE;
8781 : }
8782 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, object->in.sd, object->in.sd);
8783 0 : return py_sd;
8784 : }
8785 :
8786 0 : static int py_winreg_GetKeySecurity_in_set_sd(PyObject *py_obj, PyObject *value, void *closure)
8787 : {
8788 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
8789 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sd));
8790 0 : if (value == NULL) {
8791 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.sd");
8792 0 : return -1;
8793 : }
8794 0 : object->in.sd = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.sd);
8795 0 : if (object->in.sd == NULL) {
8796 0 : PyErr_NoMemory();
8797 0 : return -1;
8798 : }
8799 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
8800 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8801 0 : PyErr_NoMemory();
8802 0 : return -1;
8803 : }
8804 0 : object->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(value);
8805 0 : return 0;
8806 : }
8807 :
8808 0 : static PyObject *py_winreg_GetKeySecurity_out_get_sd(PyObject *obj, void *closure)
8809 : {
8810 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(obj);
8811 : PyObject *py_sd;
8812 0 : if (object->out.sd == NULL) {
8813 0 : Py_RETURN_NONE;
8814 : }
8815 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, object->out.sd, object->out.sd);
8816 0 : return py_sd;
8817 : }
8818 :
8819 0 : static int py_winreg_GetKeySecurity_out_set_sd(PyObject *py_obj, PyObject *value, void *closure)
8820 : {
8821 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
8822 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.sd));
8823 0 : if (value == NULL) {
8824 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.sd");
8825 0 : return -1;
8826 : }
8827 0 : object->out.sd = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.sd);
8828 0 : if (object->out.sd == NULL) {
8829 0 : PyErr_NoMemory();
8830 0 : return -1;
8831 : }
8832 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
8833 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8834 0 : PyErr_NoMemory();
8835 0 : return -1;
8836 : }
8837 0 : object->out.sd = (struct KeySecurityData *)pytalloc_get_ptr(value);
8838 0 : return 0;
8839 : }
8840 :
8841 0 : static PyObject *py_winreg_GetKeySecurity_get_result(PyObject *obj, void *closure)
8842 : {
8843 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(obj);
8844 : PyObject *py_result;
8845 0 : py_result = PyErr_FromWERROR(object->out.result);
8846 0 : return py_result;
8847 : }
8848 :
8849 0 : static int py_winreg_GetKeySecurity_set_result(PyObject *py_obj, PyObject *value, void *closure)
8850 : {
8851 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
8852 0 : if (value == NULL) {
8853 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
8854 0 : return -1;
8855 : }
8856 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
8857 0 : return 0;
8858 : }
8859 :
8860 : static PyGetSetDef py_winreg_GetKeySecurity_getsetters[] = {
8861 : {
8862 : .name = discard_const_p(char, "in_handle"),
8863 : .get = py_winreg_GetKeySecurity_in_get_handle,
8864 : .set = py_winreg_GetKeySecurity_in_set_handle,
8865 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
8866 : },
8867 : {
8868 : .name = discard_const_p(char, "in_sec_info"),
8869 : .get = py_winreg_GetKeySecurity_in_get_sec_info,
8870 : .set = py_winreg_GetKeySecurity_in_set_sec_info,
8871 : .doc = discard_const_p(char, "PIDL-generated element of base type security_secinfo")
8872 : },
8873 : {
8874 : .name = discard_const_p(char, "in_sd"),
8875 : .get = py_winreg_GetKeySecurity_in_get_sd,
8876 : .set = py_winreg_GetKeySecurity_in_set_sd,
8877 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
8878 : },
8879 : {
8880 : .name = discard_const_p(char, "out_sd"),
8881 : .get = py_winreg_GetKeySecurity_out_get_sd,
8882 : .set = py_winreg_GetKeySecurity_out_set_sd,
8883 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
8884 : },
8885 : {
8886 : .name = discard_const_p(char, "result"),
8887 : .get = py_winreg_GetKeySecurity_get_result,
8888 : .set = py_winreg_GetKeySecurity_set_result,
8889 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
8890 : },
8891 : { .name = NULL }
8892 : };
8893 :
8894 0 : static PyObject *py_winreg_GetKeySecurity_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
8895 : {
8896 0 : PyObject *self = pytalloc_new(struct winreg_GetKeySecurity, type);
8897 0 : struct winreg_GetKeySecurity *_self = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(self);
8898 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
8899 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
8900 0 : _self->in.sd = talloc_zero(mem_ctx, struct KeySecurityData);
8901 0 : _self->out.sd = talloc_zero(mem_ctx, struct KeySecurityData);
8902 0 : return self;
8903 : }
8904 :
8905 0 : static PyObject *py_winreg_GetKeySecurity_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
8906 : {
8907 :
8908 :
8909 0 : return PyLong_FromLong(12);
8910 : }
8911 :
8912 0 : static PyObject *py_winreg_GetKeySecurity_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
8913 : {
8914 0 : const struct ndr_interface_call *call = NULL;
8915 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
8916 0 : PyObject *ret = NULL;
8917 0 : struct ndr_push *push = NULL;
8918 : DATA_BLOB blob;
8919 : enum ndr_err_code err;
8920 :
8921 0 : if (ndr_table_winreg.num_calls < 13) {
8922 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetKeySecurity_ndr_pack");
8923 0 : return NULL;
8924 : }
8925 0 : call = &ndr_table_winreg.calls[12];
8926 :
8927 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
8928 0 : if (push == NULL) {
8929 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
8930 0 : return NULL;
8931 : }
8932 :
8933 0 : push->flags |= ndr_push_flags;
8934 :
8935 0 : err = call->ndr_push(push, ndr_inout_flags, object);
8936 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
8937 0 : TALLOC_FREE(push);
8938 0 : PyErr_SetNdrError(err);
8939 0 : return NULL;
8940 : }
8941 0 : blob = ndr_push_blob(push);
8942 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
8943 0 : TALLOC_FREE(push);
8944 0 : return ret;
8945 : }
8946 :
8947 0 : static PyObject *py_winreg_GetKeySecurity_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8948 : {
8949 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8950 0 : PyObject *bigendian_obj = NULL;
8951 0 : PyObject *ndr64_obj = NULL;
8952 0 : libndr_flags ndr_push_flags = 0;
8953 :
8954 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
8955 : discard_const_p(char *, kwnames),
8956 : &bigendian_obj,
8957 : &ndr64_obj)) {
8958 0 : return NULL;
8959 : }
8960 :
8961 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8962 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8963 : }
8964 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8965 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8966 : }
8967 :
8968 0 : return py_winreg_GetKeySecurity_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
8969 : }
8970 :
8971 0 : static PyObject *py_winreg_GetKeySecurity_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8972 : {
8973 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8974 0 : PyObject *bigendian_obj = NULL;
8975 0 : PyObject *ndr64_obj = NULL;
8976 0 : libndr_flags ndr_push_flags = 0;
8977 :
8978 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
8979 : discard_const_p(char *, kwnames),
8980 : &bigendian_obj,
8981 : &ndr64_obj)) {
8982 0 : return NULL;
8983 : }
8984 :
8985 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8986 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8987 : }
8988 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8989 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8990 : }
8991 :
8992 0 : return py_winreg_GetKeySecurity_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
8993 : }
8994 :
8995 0 : static PyObject *py_winreg_GetKeySecurity_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
8996 : {
8997 0 : const struct ndr_interface_call *call = NULL;
8998 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
8999 0 : struct ndr_pull *pull = NULL;
9000 : enum ndr_err_code err;
9001 :
9002 0 : if (ndr_table_winreg.num_calls < 13) {
9003 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetKeySecurity_ndr_unpack");
9004 0 : return NULL;
9005 : }
9006 0 : call = &ndr_table_winreg.calls[12];
9007 :
9008 0 : pull = ndr_pull_init_blob(blob, object);
9009 0 : if (pull == NULL) {
9010 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
9011 0 : return NULL;
9012 : }
9013 :
9014 0 : pull->flags |= ndr_pull_flags;
9015 :
9016 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
9017 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
9018 0 : TALLOC_FREE(pull);
9019 0 : PyErr_SetNdrError(err);
9020 0 : return NULL;
9021 : }
9022 0 : if (!allow_remaining) {
9023 : uint32_t highest_ofs;
9024 :
9025 0 : if (pull->offset > pull->relative_highest_offset) {
9026 0 : highest_ofs = pull->offset;
9027 : } else {
9028 0 : highest_ofs = pull->relative_highest_offset;
9029 : }
9030 0 : if (highest_ofs < pull->data_size) {
9031 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
9032 : "not all bytes consumed ofs[%u] size[%u]",
9033 : highest_ofs, pull->data_size);
9034 0 : TALLOC_FREE(pull);
9035 0 : PyErr_SetNdrError(err);
9036 0 : return NULL;
9037 : }
9038 : }
9039 :
9040 0 : TALLOC_FREE(pull);
9041 0 : Py_RETURN_NONE;
9042 : }
9043 :
9044 0 : static PyObject *py_winreg_GetKeySecurity_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9045 : {
9046 : DATA_BLOB blob;
9047 0 : Py_ssize_t blob_length = 0;
9048 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9049 0 : PyObject *bigendian_obj = NULL;
9050 0 : PyObject *ndr64_obj = NULL;
9051 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9052 0 : PyObject *allow_remaining_obj = NULL;
9053 0 : bool allow_remaining = false;
9054 :
9055 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
9056 : discard_const_p(char *, kwnames),
9057 : &blob.data, &blob_length,
9058 : &bigendian_obj,
9059 : &ndr64_obj,
9060 : &allow_remaining_obj)) {
9061 0 : return NULL;
9062 : }
9063 0 : blob.length = blob_length;
9064 :
9065 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9066 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9067 : }
9068 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9069 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9070 : }
9071 :
9072 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9073 0 : allow_remaining = true;
9074 : }
9075 :
9076 0 : return py_winreg_GetKeySecurity_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
9077 : }
9078 :
9079 0 : static PyObject *py_winreg_GetKeySecurity_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9080 : {
9081 : DATA_BLOB blob;
9082 0 : Py_ssize_t blob_length = 0;
9083 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9084 0 : PyObject *bigendian_obj = NULL;
9085 0 : PyObject *ndr64_obj = NULL;
9086 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9087 0 : PyObject *allow_remaining_obj = NULL;
9088 0 : bool allow_remaining = false;
9089 :
9090 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
9091 : discard_const_p(char *, kwnames),
9092 : &blob.data, &blob_length,
9093 : &bigendian_obj,
9094 : &ndr64_obj,
9095 : &allow_remaining_obj)) {
9096 0 : return NULL;
9097 : }
9098 0 : blob.length = blob_length;
9099 :
9100 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9101 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9102 : }
9103 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9104 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9105 : }
9106 :
9107 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9108 0 : allow_remaining = true;
9109 : }
9110 :
9111 0 : return py_winreg_GetKeySecurity_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
9112 : }
9113 :
9114 0 : static PyObject *py_winreg_GetKeySecurity_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
9115 : {
9116 0 : const struct ndr_interface_call *call = NULL;
9117 0 : struct winreg_GetKeySecurity *object = pytalloc_get_ptr(py_obj);
9118 : PyObject *ret;
9119 : char *retstr;
9120 :
9121 0 : if (ndr_table_winreg.num_calls < 13) {
9122 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetKeySecurity_ndr_print");
9123 0 : return NULL;
9124 : }
9125 0 : call = &ndr_table_winreg.calls[12];
9126 :
9127 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
9128 0 : ret = PyUnicode_FromString(retstr);
9129 0 : TALLOC_FREE(retstr);
9130 :
9131 0 : return ret;
9132 : }
9133 :
9134 0 : static PyObject *py_winreg_GetKeySecurity_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9135 : {
9136 0 : return py_winreg_GetKeySecurity_ndr_print(py_obj, "winreg_GetKeySecurity_in", NDR_IN);
9137 : }
9138 :
9139 0 : static PyObject *py_winreg_GetKeySecurity_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9140 : {
9141 0 : return py_winreg_GetKeySecurity_ndr_print(py_obj, "winreg_GetKeySecurity_out", NDR_OUT);
9142 : }
9143 :
9144 : static PyMethodDef py_winreg_GetKeySecurity_methods[] = {
9145 : { "opnum", (PyCFunction)py_winreg_GetKeySecurity_ndr_opnum, METH_NOARGS|METH_CLASS,
9146 : "winreg.GetKeySecurity.opnum() -> 12 (0x0c) " },
9147 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
9148 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
9149 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
9150 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
9151 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
9152 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
9153 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
9154 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
9155 : { "__ndr_print_in__", (PyCFunction)py_winreg_GetKeySecurity_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
9156 : { "__ndr_print_out__", (PyCFunction)py_winreg_GetKeySecurity_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
9157 : { NULL, NULL, 0, NULL }
9158 : };
9159 :
9160 :
9161 : static PyTypeObject winreg_GetKeySecurity_Type = {
9162 : PyVarObject_HEAD_INIT(NULL, 0)
9163 : .tp_name = "winreg.GetKeySecurity",
9164 : .tp_getset = py_winreg_GetKeySecurity_getsetters,
9165 : .tp_methods = py_winreg_GetKeySecurity_methods,
9166 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
9167 : .tp_new = py_winreg_GetKeySecurity_new,
9168 : };
9169 :
9170 0 : static bool pack_py_winreg_GetKeySecurity_args_in(PyObject *args, PyObject *kwargs, struct winreg_GetKeySecurity *r)
9171 : {
9172 : PyObject *py_handle;
9173 : PyObject *py_sec_info;
9174 : PyObject *py_sd;
9175 0 : const char *kwnames[] = {
9176 : "handle", "sec_info", "sd", NULL
9177 : };
9178 :
9179 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_GetKeySecurity", discard_const_p(char *, kwnames), &py_handle, &py_sec_info, &py_sd)) {
9180 0 : return false;
9181 : }
9182 :
9183 0 : if (py_handle == NULL) {
9184 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
9185 0 : return false;
9186 : }
9187 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
9188 0 : if (r->in.handle == NULL) {
9189 0 : PyErr_NoMemory();
9190 0 : return false;
9191 : }
9192 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
9193 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
9194 0 : PyErr_NoMemory();
9195 0 : return false;
9196 : }
9197 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
9198 0 : if (py_sec_info == NULL) {
9199 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.sec_info");
9200 0 : return false;
9201 : }
9202 : {
9203 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.sec_info));
9204 0 : if (PyLong_Check(py_sec_info)) {
9205 : unsigned long long test_var;
9206 0 : test_var = PyLong_AsUnsignedLongLong(py_sec_info);
9207 0 : if (PyErr_Occurred() != NULL) {
9208 0 : return false;
9209 : }
9210 0 : if (test_var > uint_max) {
9211 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9212 : PyLong_Type.tp_name, uint_max, test_var);
9213 0 : return false;
9214 : }
9215 0 : r->in.sec_info = test_var;
9216 : } else {
9217 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9218 : PyLong_Type.tp_name);
9219 0 : return false;
9220 : }
9221 : }
9222 0 : if (py_sd == NULL) {
9223 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.sd");
9224 0 : return false;
9225 : }
9226 0 : r->in.sd = talloc_ptrtype(r, r->in.sd);
9227 0 : if (r->in.sd == NULL) {
9228 0 : PyErr_NoMemory();
9229 0 : return false;
9230 : }
9231 0 : PY_CHECK_TYPE(&KeySecurityData_Type, py_sd, return false;);
9232 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sd)) == NULL) {
9233 0 : PyErr_NoMemory();
9234 0 : return false;
9235 : }
9236 0 : r->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(py_sd);
9237 0 : return true;
9238 : }
9239 :
9240 0 : static PyObject *unpack_py_winreg_GetKeySecurity_args_out(struct winreg_GetKeySecurity *r)
9241 : {
9242 : PyObject *result;
9243 : PyObject *py_sd;
9244 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, r->out.sd, r->out.sd);
9245 0 : result = py_sd;
9246 0 : if (!W_ERROR_IS_OK(r->out.result)) {
9247 0 : PyErr_SetWERROR(r->out.result);
9248 0 : return NULL;
9249 : }
9250 :
9251 0 : return result;
9252 : }
9253 :
9254 :
9255 0 : static PyObject *py_winreg_LoadKey_in_get_handle(PyObject *obj, void *closure)
9256 : {
9257 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(obj);
9258 : PyObject *py_handle;
9259 0 : if (object->in.handle == NULL) {
9260 0 : Py_RETURN_NONE;
9261 : }
9262 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
9263 0 : return py_handle;
9264 : }
9265 :
9266 0 : static int py_winreg_LoadKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
9267 : {
9268 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(py_obj);
9269 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
9270 0 : if (value == NULL) {
9271 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
9272 0 : return -1;
9273 : }
9274 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
9275 0 : if (object->in.handle == NULL) {
9276 0 : PyErr_NoMemory();
9277 0 : return -1;
9278 : }
9279 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
9280 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9281 0 : PyErr_NoMemory();
9282 0 : return -1;
9283 : }
9284 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
9285 0 : return 0;
9286 : }
9287 :
9288 0 : static PyObject *py_winreg_LoadKey_in_get_keyname(PyObject *obj, void *closure)
9289 : {
9290 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(obj);
9291 : PyObject *py_keyname;
9292 0 : if (object->in.keyname == NULL) {
9293 0 : Py_RETURN_NONE;
9294 : }
9295 0 : if (object->in.keyname == NULL) {
9296 0 : py_keyname = Py_None;
9297 0 : Py_INCREF(py_keyname);
9298 : } else {
9299 0 : py_keyname = pytalloc_reference_ex(&winreg_String_Type, object->in.keyname, object->in.keyname);
9300 : }
9301 0 : return py_keyname;
9302 : }
9303 :
9304 0 : static int py_winreg_LoadKey_in_set_keyname(PyObject *py_obj, PyObject *value, void *closure)
9305 : {
9306 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(py_obj);
9307 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.keyname));
9308 0 : if (value == NULL) {
9309 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.keyname");
9310 0 : return -1;
9311 : }
9312 0 : if (value == Py_None) {
9313 0 : object->in.keyname = NULL;
9314 : } else {
9315 0 : object->in.keyname = NULL;
9316 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9317 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9318 0 : PyErr_NoMemory();
9319 0 : return -1;
9320 : }
9321 0 : object->in.keyname = (struct winreg_String *)pytalloc_get_ptr(value);
9322 : }
9323 0 : return 0;
9324 : }
9325 :
9326 0 : static PyObject *py_winreg_LoadKey_in_get_filename(PyObject *obj, void *closure)
9327 : {
9328 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(obj);
9329 : PyObject *py_filename;
9330 0 : if (object->in.filename == NULL) {
9331 0 : Py_RETURN_NONE;
9332 : }
9333 0 : if (object->in.filename == NULL) {
9334 0 : py_filename = Py_None;
9335 0 : Py_INCREF(py_filename);
9336 : } else {
9337 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
9338 : }
9339 0 : return py_filename;
9340 : }
9341 :
9342 0 : static int py_winreg_LoadKey_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
9343 : {
9344 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(py_obj);
9345 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
9346 0 : if (value == NULL) {
9347 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.filename");
9348 0 : return -1;
9349 : }
9350 0 : if (value == Py_None) {
9351 0 : object->in.filename = NULL;
9352 : } else {
9353 0 : object->in.filename = NULL;
9354 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9355 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9356 0 : PyErr_NoMemory();
9357 0 : return -1;
9358 : }
9359 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
9360 : }
9361 0 : return 0;
9362 : }
9363 :
9364 0 : static PyObject *py_winreg_LoadKey_get_result(PyObject *obj, void *closure)
9365 : {
9366 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(obj);
9367 : PyObject *py_result;
9368 0 : py_result = PyErr_FromWERROR(object->out.result);
9369 0 : return py_result;
9370 : }
9371 :
9372 0 : static int py_winreg_LoadKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
9373 : {
9374 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(py_obj);
9375 0 : if (value == NULL) {
9376 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
9377 0 : return -1;
9378 : }
9379 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
9380 0 : return 0;
9381 : }
9382 :
9383 : static PyGetSetDef py_winreg_LoadKey_getsetters[] = {
9384 : {
9385 : .name = discard_const_p(char, "in_handle"),
9386 : .get = py_winreg_LoadKey_in_get_handle,
9387 : .set = py_winreg_LoadKey_in_set_handle,
9388 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
9389 : },
9390 : {
9391 : .name = discard_const_p(char, "in_keyname"),
9392 : .get = py_winreg_LoadKey_in_get_keyname,
9393 : .set = py_winreg_LoadKey_in_set_keyname,
9394 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
9395 : },
9396 : {
9397 : .name = discard_const_p(char, "in_filename"),
9398 : .get = py_winreg_LoadKey_in_get_filename,
9399 : .set = py_winreg_LoadKey_in_set_filename,
9400 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
9401 : },
9402 : {
9403 : .name = discard_const_p(char, "result"),
9404 : .get = py_winreg_LoadKey_get_result,
9405 : .set = py_winreg_LoadKey_set_result,
9406 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
9407 : },
9408 : { .name = NULL }
9409 : };
9410 :
9411 0 : static PyObject *py_winreg_LoadKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
9412 : {
9413 0 : PyObject *self = pytalloc_new(struct winreg_LoadKey, type);
9414 0 : struct winreg_LoadKey *_self = (struct winreg_LoadKey *)pytalloc_get_ptr(self);
9415 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
9416 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
9417 0 : return self;
9418 : }
9419 :
9420 0 : static PyObject *py_winreg_LoadKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
9421 : {
9422 :
9423 :
9424 0 : return PyLong_FromLong(13);
9425 : }
9426 :
9427 0 : static PyObject *py_winreg_LoadKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
9428 : {
9429 0 : const struct ndr_interface_call *call = NULL;
9430 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(py_obj);
9431 0 : PyObject *ret = NULL;
9432 0 : struct ndr_push *push = NULL;
9433 : DATA_BLOB blob;
9434 : enum ndr_err_code err;
9435 :
9436 0 : if (ndr_table_winreg.num_calls < 14) {
9437 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_LoadKey_ndr_pack");
9438 0 : return NULL;
9439 : }
9440 0 : call = &ndr_table_winreg.calls[13];
9441 :
9442 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
9443 0 : if (push == NULL) {
9444 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
9445 0 : return NULL;
9446 : }
9447 :
9448 0 : push->flags |= ndr_push_flags;
9449 :
9450 0 : err = call->ndr_push(push, ndr_inout_flags, object);
9451 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
9452 0 : TALLOC_FREE(push);
9453 0 : PyErr_SetNdrError(err);
9454 0 : return NULL;
9455 : }
9456 0 : blob = ndr_push_blob(push);
9457 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
9458 0 : TALLOC_FREE(push);
9459 0 : return ret;
9460 : }
9461 :
9462 0 : static PyObject *py_winreg_LoadKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9463 : {
9464 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
9465 0 : PyObject *bigendian_obj = NULL;
9466 0 : PyObject *ndr64_obj = NULL;
9467 0 : libndr_flags ndr_push_flags = 0;
9468 :
9469 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
9470 : discard_const_p(char *, kwnames),
9471 : &bigendian_obj,
9472 : &ndr64_obj)) {
9473 0 : return NULL;
9474 : }
9475 :
9476 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9477 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
9478 : }
9479 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9480 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
9481 : }
9482 :
9483 0 : return py_winreg_LoadKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
9484 : }
9485 :
9486 0 : static PyObject *py_winreg_LoadKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9487 : {
9488 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
9489 0 : PyObject *bigendian_obj = NULL;
9490 0 : PyObject *ndr64_obj = NULL;
9491 0 : libndr_flags ndr_push_flags = 0;
9492 :
9493 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
9494 : discard_const_p(char *, kwnames),
9495 : &bigendian_obj,
9496 : &ndr64_obj)) {
9497 0 : return NULL;
9498 : }
9499 :
9500 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9501 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
9502 : }
9503 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9504 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
9505 : }
9506 :
9507 0 : return py_winreg_LoadKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
9508 : }
9509 :
9510 0 : static PyObject *py_winreg_LoadKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
9511 : {
9512 0 : const struct ndr_interface_call *call = NULL;
9513 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(py_obj);
9514 0 : struct ndr_pull *pull = NULL;
9515 : enum ndr_err_code err;
9516 :
9517 0 : if (ndr_table_winreg.num_calls < 14) {
9518 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_LoadKey_ndr_unpack");
9519 0 : return NULL;
9520 : }
9521 0 : call = &ndr_table_winreg.calls[13];
9522 :
9523 0 : pull = ndr_pull_init_blob(blob, object);
9524 0 : if (pull == NULL) {
9525 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
9526 0 : return NULL;
9527 : }
9528 :
9529 0 : pull->flags |= ndr_pull_flags;
9530 :
9531 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
9532 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
9533 0 : TALLOC_FREE(pull);
9534 0 : PyErr_SetNdrError(err);
9535 0 : return NULL;
9536 : }
9537 0 : if (!allow_remaining) {
9538 : uint32_t highest_ofs;
9539 :
9540 0 : if (pull->offset > pull->relative_highest_offset) {
9541 0 : highest_ofs = pull->offset;
9542 : } else {
9543 0 : highest_ofs = pull->relative_highest_offset;
9544 : }
9545 0 : if (highest_ofs < pull->data_size) {
9546 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
9547 : "not all bytes consumed ofs[%u] size[%u]",
9548 : highest_ofs, pull->data_size);
9549 0 : TALLOC_FREE(pull);
9550 0 : PyErr_SetNdrError(err);
9551 0 : return NULL;
9552 : }
9553 : }
9554 :
9555 0 : TALLOC_FREE(pull);
9556 0 : Py_RETURN_NONE;
9557 : }
9558 :
9559 0 : static PyObject *py_winreg_LoadKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9560 : {
9561 : DATA_BLOB blob;
9562 0 : Py_ssize_t blob_length = 0;
9563 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9564 0 : PyObject *bigendian_obj = NULL;
9565 0 : PyObject *ndr64_obj = NULL;
9566 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9567 0 : PyObject *allow_remaining_obj = NULL;
9568 0 : bool allow_remaining = false;
9569 :
9570 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
9571 : discard_const_p(char *, kwnames),
9572 : &blob.data, &blob_length,
9573 : &bigendian_obj,
9574 : &ndr64_obj,
9575 : &allow_remaining_obj)) {
9576 0 : return NULL;
9577 : }
9578 0 : blob.length = blob_length;
9579 :
9580 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9581 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9582 : }
9583 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9584 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9585 : }
9586 :
9587 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9588 0 : allow_remaining = true;
9589 : }
9590 :
9591 0 : return py_winreg_LoadKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
9592 : }
9593 :
9594 0 : static PyObject *py_winreg_LoadKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9595 : {
9596 : DATA_BLOB blob;
9597 0 : Py_ssize_t blob_length = 0;
9598 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9599 0 : PyObject *bigendian_obj = NULL;
9600 0 : PyObject *ndr64_obj = NULL;
9601 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9602 0 : PyObject *allow_remaining_obj = NULL;
9603 0 : bool allow_remaining = false;
9604 :
9605 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
9606 : discard_const_p(char *, kwnames),
9607 : &blob.data, &blob_length,
9608 : &bigendian_obj,
9609 : &ndr64_obj,
9610 : &allow_remaining_obj)) {
9611 0 : return NULL;
9612 : }
9613 0 : blob.length = blob_length;
9614 :
9615 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9616 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9617 : }
9618 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9619 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9620 : }
9621 :
9622 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9623 0 : allow_remaining = true;
9624 : }
9625 :
9626 0 : return py_winreg_LoadKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
9627 : }
9628 :
9629 0 : static PyObject *py_winreg_LoadKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
9630 : {
9631 0 : const struct ndr_interface_call *call = NULL;
9632 0 : struct winreg_LoadKey *object = pytalloc_get_ptr(py_obj);
9633 : PyObject *ret;
9634 : char *retstr;
9635 :
9636 0 : if (ndr_table_winreg.num_calls < 14) {
9637 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_LoadKey_ndr_print");
9638 0 : return NULL;
9639 : }
9640 0 : call = &ndr_table_winreg.calls[13];
9641 :
9642 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
9643 0 : ret = PyUnicode_FromString(retstr);
9644 0 : TALLOC_FREE(retstr);
9645 :
9646 0 : return ret;
9647 : }
9648 :
9649 0 : static PyObject *py_winreg_LoadKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9650 : {
9651 0 : return py_winreg_LoadKey_ndr_print(py_obj, "winreg_LoadKey_in", NDR_IN);
9652 : }
9653 :
9654 0 : static PyObject *py_winreg_LoadKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9655 : {
9656 0 : return py_winreg_LoadKey_ndr_print(py_obj, "winreg_LoadKey_out", NDR_OUT);
9657 : }
9658 :
9659 : static PyMethodDef py_winreg_LoadKey_methods[] = {
9660 : { "opnum", (PyCFunction)py_winreg_LoadKey_ndr_opnum, METH_NOARGS|METH_CLASS,
9661 : "winreg.LoadKey.opnum() -> 13 (0x0d) " },
9662 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
9663 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
9664 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
9665 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
9666 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
9667 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
9668 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
9669 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
9670 : { "__ndr_print_in__", (PyCFunction)py_winreg_LoadKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
9671 : { "__ndr_print_out__", (PyCFunction)py_winreg_LoadKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
9672 : { NULL, NULL, 0, NULL }
9673 : };
9674 :
9675 :
9676 : static PyTypeObject winreg_LoadKey_Type = {
9677 : PyVarObject_HEAD_INIT(NULL, 0)
9678 : .tp_name = "winreg.LoadKey",
9679 : .tp_getset = py_winreg_LoadKey_getsetters,
9680 : .tp_methods = py_winreg_LoadKey_methods,
9681 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
9682 : .tp_new = py_winreg_LoadKey_new,
9683 : };
9684 :
9685 0 : static bool pack_py_winreg_LoadKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_LoadKey *r)
9686 : {
9687 : PyObject *py_handle;
9688 : PyObject *py_keyname;
9689 : PyObject *py_filename;
9690 0 : const char *kwnames[] = {
9691 : "handle", "keyname", "filename", NULL
9692 : };
9693 :
9694 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_LoadKey", discard_const_p(char *, kwnames), &py_handle, &py_keyname, &py_filename)) {
9695 0 : return false;
9696 : }
9697 :
9698 0 : if (py_handle == NULL) {
9699 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
9700 0 : return false;
9701 : }
9702 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
9703 0 : if (r->in.handle == NULL) {
9704 0 : PyErr_NoMemory();
9705 0 : return false;
9706 : }
9707 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
9708 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
9709 0 : PyErr_NoMemory();
9710 0 : return false;
9711 : }
9712 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
9713 0 : if (py_keyname == NULL) {
9714 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.keyname");
9715 0 : return false;
9716 : }
9717 0 : if (py_keyname == Py_None) {
9718 0 : r->in.keyname = NULL;
9719 : } else {
9720 0 : r->in.keyname = NULL;
9721 0 : PY_CHECK_TYPE(&winreg_String_Type, py_keyname, return false;);
9722 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyname)) == NULL) {
9723 0 : PyErr_NoMemory();
9724 0 : return false;
9725 : }
9726 0 : r->in.keyname = (struct winreg_String *)pytalloc_get_ptr(py_keyname);
9727 : }
9728 0 : if (py_filename == NULL) {
9729 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.filename");
9730 0 : return false;
9731 : }
9732 0 : if (py_filename == Py_None) {
9733 0 : r->in.filename = NULL;
9734 : } else {
9735 0 : r->in.filename = NULL;
9736 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
9737 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
9738 0 : PyErr_NoMemory();
9739 0 : return false;
9740 : }
9741 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
9742 : }
9743 0 : return true;
9744 : }
9745 :
9746 0 : static PyObject *unpack_py_winreg_LoadKey_args_out(struct winreg_LoadKey *r)
9747 : {
9748 : PyObject *result;
9749 0 : result = Py_None;
9750 0 : Py_INCREF(result);
9751 0 : if (!W_ERROR_IS_OK(r->out.result)) {
9752 0 : PyErr_SetWERROR(r->out.result);
9753 0 : return NULL;
9754 : }
9755 :
9756 0 : return result;
9757 : }
9758 :
9759 :
9760 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_handle(PyObject *obj, void *closure)
9761 : {
9762 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9763 : PyObject *py_handle;
9764 0 : if (object->in.handle == NULL) {
9765 0 : Py_RETURN_NONE;
9766 : }
9767 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
9768 0 : return py_handle;
9769 : }
9770 :
9771 0 : static int py_winreg_NotifyChangeKeyValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
9772 : {
9773 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
9774 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
9775 0 : if (value == NULL) {
9776 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
9777 0 : return -1;
9778 : }
9779 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
9780 0 : if (object->in.handle == NULL) {
9781 0 : PyErr_NoMemory();
9782 0 : return -1;
9783 : }
9784 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
9785 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9786 0 : PyErr_NoMemory();
9787 0 : return -1;
9788 : }
9789 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
9790 0 : return 0;
9791 : }
9792 :
9793 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_watch_subtree(PyObject *obj, void *closure)
9794 : {
9795 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9796 : PyObject *py_watch_subtree;
9797 0 : py_watch_subtree = PyLong_FromLong((uint16_t)(object->in.watch_subtree));
9798 0 : return py_watch_subtree;
9799 : }
9800 :
9801 0 : static int py_winreg_NotifyChangeKeyValue_in_set_watch_subtree(PyObject *py_obj, PyObject *value, void *closure)
9802 : {
9803 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
9804 0 : if (value == NULL) {
9805 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.watch_subtree");
9806 0 : return -1;
9807 : }
9808 : {
9809 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.watch_subtree));
9810 0 : if (PyLong_Check(value)) {
9811 : unsigned long long test_var;
9812 0 : test_var = PyLong_AsUnsignedLongLong(value);
9813 0 : if (PyErr_Occurred() != NULL) {
9814 0 : return -1;
9815 : }
9816 0 : if (test_var > uint_max) {
9817 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9818 : PyLong_Type.tp_name, uint_max, test_var);
9819 0 : return -1;
9820 : }
9821 0 : object->in.watch_subtree = test_var;
9822 : } else {
9823 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9824 : PyLong_Type.tp_name);
9825 0 : return -1;
9826 : }
9827 : }
9828 0 : return 0;
9829 : }
9830 :
9831 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_notify_filter(PyObject *obj, void *closure)
9832 : {
9833 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9834 : PyObject *py_notify_filter;
9835 0 : py_notify_filter = PyLong_FromUnsignedLongLong((uint32_t)(object->in.notify_filter));
9836 0 : return py_notify_filter;
9837 : }
9838 :
9839 0 : static int py_winreg_NotifyChangeKeyValue_in_set_notify_filter(PyObject *py_obj, PyObject *value, void *closure)
9840 : {
9841 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
9842 0 : if (value == NULL) {
9843 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.notify_filter");
9844 0 : return -1;
9845 : }
9846 : {
9847 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.notify_filter));
9848 0 : if (PyLong_Check(value)) {
9849 : unsigned long long test_var;
9850 0 : test_var = PyLong_AsUnsignedLongLong(value);
9851 0 : if (PyErr_Occurred() != NULL) {
9852 0 : return -1;
9853 : }
9854 0 : if (test_var > uint_max) {
9855 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9856 : PyLong_Type.tp_name, uint_max, test_var);
9857 0 : return -1;
9858 : }
9859 0 : object->in.notify_filter = test_var;
9860 : } else {
9861 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9862 : PyLong_Type.tp_name);
9863 0 : return -1;
9864 : }
9865 : }
9866 0 : return 0;
9867 : }
9868 :
9869 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_unknown(PyObject *obj, void *closure)
9870 : {
9871 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9872 : PyObject *py_unknown;
9873 0 : py_unknown = PyLong_FromUnsignedLongLong((uint32_t)(object->in.unknown));
9874 0 : return py_unknown;
9875 : }
9876 :
9877 0 : static int py_winreg_NotifyChangeKeyValue_in_set_unknown(PyObject *py_obj, PyObject *value, void *closure)
9878 : {
9879 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
9880 0 : if (value == NULL) {
9881 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.unknown");
9882 0 : return -1;
9883 : }
9884 : {
9885 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.unknown));
9886 0 : if (PyLong_Check(value)) {
9887 : unsigned long long test_var;
9888 0 : test_var = PyLong_AsUnsignedLongLong(value);
9889 0 : if (PyErr_Occurred() != NULL) {
9890 0 : return -1;
9891 : }
9892 0 : if (test_var > uint_max) {
9893 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9894 : PyLong_Type.tp_name, uint_max, test_var);
9895 0 : return -1;
9896 : }
9897 0 : object->in.unknown = test_var;
9898 : } else {
9899 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9900 : PyLong_Type.tp_name);
9901 0 : return -1;
9902 : }
9903 : }
9904 0 : return 0;
9905 : }
9906 :
9907 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_string1(PyObject *obj, void *closure)
9908 : {
9909 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9910 : PyObject *py_string1;
9911 0 : py_string1 = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.string1);
9912 0 : return py_string1;
9913 : }
9914 :
9915 0 : static int py_winreg_NotifyChangeKeyValue_in_set_string1(PyObject *py_obj, PyObject *value, void *closure)
9916 : {
9917 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
9918 0 : if (value == NULL) {
9919 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.string1");
9920 0 : return -1;
9921 : }
9922 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9923 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9924 0 : PyErr_NoMemory();
9925 0 : return -1;
9926 : }
9927 0 : object->in.string1 = *(struct winreg_String *)pytalloc_get_ptr(value);
9928 0 : return 0;
9929 : }
9930 :
9931 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_string2(PyObject *obj, void *closure)
9932 : {
9933 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9934 : PyObject *py_string2;
9935 0 : py_string2 = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.string2);
9936 0 : return py_string2;
9937 : }
9938 :
9939 0 : static int py_winreg_NotifyChangeKeyValue_in_set_string2(PyObject *py_obj, PyObject *value, void *closure)
9940 : {
9941 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
9942 0 : if (value == NULL) {
9943 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.string2");
9944 0 : return -1;
9945 : }
9946 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9947 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9948 0 : PyErr_NoMemory();
9949 0 : return -1;
9950 : }
9951 0 : object->in.string2 = *(struct winreg_String *)pytalloc_get_ptr(value);
9952 0 : return 0;
9953 : }
9954 :
9955 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_unknown2(PyObject *obj, void *closure)
9956 : {
9957 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9958 : PyObject *py_unknown2;
9959 0 : py_unknown2 = PyLong_FromUnsignedLongLong((uint32_t)(object->in.unknown2));
9960 0 : return py_unknown2;
9961 : }
9962 :
9963 0 : static int py_winreg_NotifyChangeKeyValue_in_set_unknown2(PyObject *py_obj, PyObject *value, void *closure)
9964 : {
9965 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
9966 0 : if (value == NULL) {
9967 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.unknown2");
9968 0 : return -1;
9969 : }
9970 : {
9971 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.unknown2));
9972 0 : if (PyLong_Check(value)) {
9973 : unsigned long long test_var;
9974 0 : test_var = PyLong_AsUnsignedLongLong(value);
9975 0 : if (PyErr_Occurred() != NULL) {
9976 0 : return -1;
9977 : }
9978 0 : if (test_var > uint_max) {
9979 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9980 : PyLong_Type.tp_name, uint_max, test_var);
9981 0 : return -1;
9982 : }
9983 0 : object->in.unknown2 = test_var;
9984 : } else {
9985 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9986 : PyLong_Type.tp_name);
9987 0 : return -1;
9988 : }
9989 : }
9990 0 : return 0;
9991 : }
9992 :
9993 0 : static PyObject *py_winreg_NotifyChangeKeyValue_get_result(PyObject *obj, void *closure)
9994 : {
9995 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(obj);
9996 : PyObject *py_result;
9997 0 : py_result = PyErr_FromWERROR(object->out.result);
9998 0 : return py_result;
9999 : }
10000 :
10001 0 : static int py_winreg_NotifyChangeKeyValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
10002 : {
10003 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
10004 0 : if (value == NULL) {
10005 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
10006 0 : return -1;
10007 : }
10008 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
10009 0 : return 0;
10010 : }
10011 :
10012 : static PyGetSetDef py_winreg_NotifyChangeKeyValue_getsetters[] = {
10013 : {
10014 : .name = discard_const_p(char, "in_handle"),
10015 : .get = py_winreg_NotifyChangeKeyValue_in_get_handle,
10016 : .set = py_winreg_NotifyChangeKeyValue_in_set_handle,
10017 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
10018 : },
10019 : {
10020 : .name = discard_const_p(char, "in_watch_subtree"),
10021 : .get = py_winreg_NotifyChangeKeyValue_in_get_watch_subtree,
10022 : .set = py_winreg_NotifyChangeKeyValue_in_set_watch_subtree,
10023 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
10024 : },
10025 : {
10026 : .name = discard_const_p(char, "in_notify_filter"),
10027 : .get = py_winreg_NotifyChangeKeyValue_in_get_notify_filter,
10028 : .set = py_winreg_NotifyChangeKeyValue_in_set_notify_filter,
10029 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_NotifyChangeType")
10030 : },
10031 : {
10032 : .name = discard_const_p(char, "in_unknown"),
10033 : .get = py_winreg_NotifyChangeKeyValue_in_get_unknown,
10034 : .set = py_winreg_NotifyChangeKeyValue_in_set_unknown,
10035 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
10036 : },
10037 : {
10038 : .name = discard_const_p(char, "in_string1"),
10039 : .get = py_winreg_NotifyChangeKeyValue_in_get_string1,
10040 : .set = py_winreg_NotifyChangeKeyValue_in_set_string1,
10041 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
10042 : },
10043 : {
10044 : .name = discard_const_p(char, "in_string2"),
10045 : .get = py_winreg_NotifyChangeKeyValue_in_get_string2,
10046 : .set = py_winreg_NotifyChangeKeyValue_in_set_string2,
10047 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
10048 : },
10049 : {
10050 : .name = discard_const_p(char, "in_unknown2"),
10051 : .get = py_winreg_NotifyChangeKeyValue_in_get_unknown2,
10052 : .set = py_winreg_NotifyChangeKeyValue_in_set_unknown2,
10053 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
10054 : },
10055 : {
10056 : .name = discard_const_p(char, "result"),
10057 : .get = py_winreg_NotifyChangeKeyValue_get_result,
10058 : .set = py_winreg_NotifyChangeKeyValue_set_result,
10059 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
10060 : },
10061 : { .name = NULL }
10062 : };
10063 :
10064 0 : static PyObject *py_winreg_NotifyChangeKeyValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
10065 : {
10066 0 : PyObject *self = pytalloc_new(struct winreg_NotifyChangeKeyValue, type);
10067 0 : struct winreg_NotifyChangeKeyValue *_self = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(self);
10068 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
10069 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
10070 0 : return self;
10071 : }
10072 :
10073 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
10074 : {
10075 :
10076 :
10077 0 : return PyLong_FromLong(14);
10078 : }
10079 :
10080 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
10081 : {
10082 0 : const struct ndr_interface_call *call = NULL;
10083 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
10084 0 : PyObject *ret = NULL;
10085 0 : struct ndr_push *push = NULL;
10086 : DATA_BLOB blob;
10087 : enum ndr_err_code err;
10088 :
10089 0 : if (ndr_table_winreg.num_calls < 15) {
10090 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_NotifyChangeKeyValue_ndr_pack");
10091 0 : return NULL;
10092 : }
10093 0 : call = &ndr_table_winreg.calls[14];
10094 :
10095 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
10096 0 : if (push == NULL) {
10097 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10098 0 : return NULL;
10099 : }
10100 :
10101 0 : push->flags |= ndr_push_flags;
10102 :
10103 0 : err = call->ndr_push(push, ndr_inout_flags, object);
10104 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10105 0 : TALLOC_FREE(push);
10106 0 : PyErr_SetNdrError(err);
10107 0 : return NULL;
10108 : }
10109 0 : blob = ndr_push_blob(push);
10110 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
10111 0 : TALLOC_FREE(push);
10112 0 : return ret;
10113 : }
10114 :
10115 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10116 : {
10117 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10118 0 : PyObject *bigendian_obj = NULL;
10119 0 : PyObject *ndr64_obj = NULL;
10120 0 : libndr_flags ndr_push_flags = 0;
10121 :
10122 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
10123 : discard_const_p(char *, kwnames),
10124 : &bigendian_obj,
10125 : &ndr64_obj)) {
10126 0 : return NULL;
10127 : }
10128 :
10129 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10130 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10131 : }
10132 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10133 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10134 : }
10135 :
10136 0 : return py_winreg_NotifyChangeKeyValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
10137 : }
10138 :
10139 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10140 : {
10141 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10142 0 : PyObject *bigendian_obj = NULL;
10143 0 : PyObject *ndr64_obj = NULL;
10144 0 : libndr_flags ndr_push_flags = 0;
10145 :
10146 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
10147 : discard_const_p(char *, kwnames),
10148 : &bigendian_obj,
10149 : &ndr64_obj)) {
10150 0 : return NULL;
10151 : }
10152 :
10153 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10154 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10155 : }
10156 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10157 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10158 : }
10159 :
10160 0 : return py_winreg_NotifyChangeKeyValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
10161 : }
10162 :
10163 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
10164 : {
10165 0 : const struct ndr_interface_call *call = NULL;
10166 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
10167 0 : struct ndr_pull *pull = NULL;
10168 : enum ndr_err_code err;
10169 :
10170 0 : if (ndr_table_winreg.num_calls < 15) {
10171 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_NotifyChangeKeyValue_ndr_unpack");
10172 0 : return NULL;
10173 : }
10174 0 : call = &ndr_table_winreg.calls[14];
10175 :
10176 0 : pull = ndr_pull_init_blob(blob, object);
10177 0 : if (pull == NULL) {
10178 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10179 0 : return NULL;
10180 : }
10181 :
10182 0 : pull->flags |= ndr_pull_flags;
10183 :
10184 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
10185 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10186 0 : TALLOC_FREE(pull);
10187 0 : PyErr_SetNdrError(err);
10188 0 : return NULL;
10189 : }
10190 0 : if (!allow_remaining) {
10191 : uint32_t highest_ofs;
10192 :
10193 0 : if (pull->offset > pull->relative_highest_offset) {
10194 0 : highest_ofs = pull->offset;
10195 : } else {
10196 0 : highest_ofs = pull->relative_highest_offset;
10197 : }
10198 0 : if (highest_ofs < pull->data_size) {
10199 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
10200 : "not all bytes consumed ofs[%u] size[%u]",
10201 : highest_ofs, pull->data_size);
10202 0 : TALLOC_FREE(pull);
10203 0 : PyErr_SetNdrError(err);
10204 0 : return NULL;
10205 : }
10206 : }
10207 :
10208 0 : TALLOC_FREE(pull);
10209 0 : Py_RETURN_NONE;
10210 : }
10211 :
10212 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10213 : {
10214 : DATA_BLOB blob;
10215 0 : Py_ssize_t blob_length = 0;
10216 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10217 0 : PyObject *bigendian_obj = NULL;
10218 0 : PyObject *ndr64_obj = NULL;
10219 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10220 0 : PyObject *allow_remaining_obj = NULL;
10221 0 : bool allow_remaining = false;
10222 :
10223 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
10224 : discard_const_p(char *, kwnames),
10225 : &blob.data, &blob_length,
10226 : &bigendian_obj,
10227 : &ndr64_obj,
10228 : &allow_remaining_obj)) {
10229 0 : return NULL;
10230 : }
10231 0 : blob.length = blob_length;
10232 :
10233 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10234 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10235 : }
10236 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10237 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10238 : }
10239 :
10240 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10241 0 : allow_remaining = true;
10242 : }
10243 :
10244 0 : return py_winreg_NotifyChangeKeyValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
10245 : }
10246 :
10247 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10248 : {
10249 : DATA_BLOB blob;
10250 0 : Py_ssize_t blob_length = 0;
10251 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10252 0 : PyObject *bigendian_obj = NULL;
10253 0 : PyObject *ndr64_obj = NULL;
10254 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10255 0 : PyObject *allow_remaining_obj = NULL;
10256 0 : bool allow_remaining = false;
10257 :
10258 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
10259 : discard_const_p(char *, kwnames),
10260 : &blob.data, &blob_length,
10261 : &bigendian_obj,
10262 : &ndr64_obj,
10263 : &allow_remaining_obj)) {
10264 0 : return NULL;
10265 : }
10266 0 : blob.length = blob_length;
10267 :
10268 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10269 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10270 : }
10271 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10272 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10273 : }
10274 :
10275 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10276 0 : allow_remaining = true;
10277 : }
10278 :
10279 0 : return py_winreg_NotifyChangeKeyValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
10280 : }
10281 :
10282 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
10283 : {
10284 0 : const struct ndr_interface_call *call = NULL;
10285 0 : struct winreg_NotifyChangeKeyValue *object = pytalloc_get_ptr(py_obj);
10286 : PyObject *ret;
10287 : char *retstr;
10288 :
10289 0 : if (ndr_table_winreg.num_calls < 15) {
10290 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_NotifyChangeKeyValue_ndr_print");
10291 0 : return NULL;
10292 : }
10293 0 : call = &ndr_table_winreg.calls[14];
10294 :
10295 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
10296 0 : ret = PyUnicode_FromString(retstr);
10297 0 : TALLOC_FREE(retstr);
10298 :
10299 0 : return ret;
10300 : }
10301 :
10302 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10303 : {
10304 0 : return py_winreg_NotifyChangeKeyValue_ndr_print(py_obj, "winreg_NotifyChangeKeyValue_in", NDR_IN);
10305 : }
10306 :
10307 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10308 : {
10309 0 : return py_winreg_NotifyChangeKeyValue_ndr_print(py_obj, "winreg_NotifyChangeKeyValue_out", NDR_OUT);
10310 : }
10311 :
10312 : static PyMethodDef py_winreg_NotifyChangeKeyValue_methods[] = {
10313 : { "opnum", (PyCFunction)py_winreg_NotifyChangeKeyValue_ndr_opnum, METH_NOARGS|METH_CLASS,
10314 : "winreg.NotifyChangeKeyValue.opnum() -> 14 (0x0e) " },
10315 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
10316 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
10317 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
10318 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
10319 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
10320 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
10321 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
10322 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
10323 : { "__ndr_print_in__", (PyCFunction)py_winreg_NotifyChangeKeyValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
10324 : { "__ndr_print_out__", (PyCFunction)py_winreg_NotifyChangeKeyValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
10325 : { NULL, NULL, 0, NULL }
10326 : };
10327 :
10328 :
10329 : static PyTypeObject winreg_NotifyChangeKeyValue_Type = {
10330 : PyVarObject_HEAD_INIT(NULL, 0)
10331 : .tp_name = "winreg.NotifyChangeKeyValue",
10332 : .tp_getset = py_winreg_NotifyChangeKeyValue_getsetters,
10333 : .tp_methods = py_winreg_NotifyChangeKeyValue_methods,
10334 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
10335 : .tp_new = py_winreg_NotifyChangeKeyValue_new,
10336 : };
10337 :
10338 0 : static bool pack_py_winreg_NotifyChangeKeyValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_NotifyChangeKeyValue *r)
10339 : {
10340 : PyObject *py_handle;
10341 : PyObject *py_watch_subtree;
10342 : PyObject *py_notify_filter;
10343 : PyObject *py_unknown;
10344 : PyObject *py_string1;
10345 : PyObject *py_string2;
10346 : PyObject *py_unknown2;
10347 0 : const char *kwnames[] = {
10348 : "handle", "watch_subtree", "notify_filter", "unknown", "string1", "string2", "unknown2", NULL
10349 : };
10350 :
10351 0 : 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)) {
10352 0 : return false;
10353 : }
10354 :
10355 0 : if (py_handle == NULL) {
10356 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
10357 0 : return false;
10358 : }
10359 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
10360 0 : if (r->in.handle == NULL) {
10361 0 : PyErr_NoMemory();
10362 0 : return false;
10363 : }
10364 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
10365 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
10366 0 : PyErr_NoMemory();
10367 0 : return false;
10368 : }
10369 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
10370 0 : if (py_watch_subtree == NULL) {
10371 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.watch_subtree");
10372 0 : return false;
10373 : }
10374 : {
10375 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.watch_subtree));
10376 0 : if (PyLong_Check(py_watch_subtree)) {
10377 : unsigned long long test_var;
10378 0 : test_var = PyLong_AsUnsignedLongLong(py_watch_subtree);
10379 0 : if (PyErr_Occurred() != NULL) {
10380 0 : return false;
10381 : }
10382 0 : if (test_var > uint_max) {
10383 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10384 : PyLong_Type.tp_name, uint_max, test_var);
10385 0 : return false;
10386 : }
10387 0 : r->in.watch_subtree = test_var;
10388 : } else {
10389 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10390 : PyLong_Type.tp_name);
10391 0 : return false;
10392 : }
10393 : }
10394 0 : if (py_notify_filter == NULL) {
10395 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.notify_filter");
10396 0 : return false;
10397 : }
10398 : {
10399 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.notify_filter));
10400 0 : if (PyLong_Check(py_notify_filter)) {
10401 : unsigned long long test_var;
10402 0 : test_var = PyLong_AsUnsignedLongLong(py_notify_filter);
10403 0 : if (PyErr_Occurred() != NULL) {
10404 0 : return false;
10405 : }
10406 0 : if (test_var > uint_max) {
10407 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10408 : PyLong_Type.tp_name, uint_max, test_var);
10409 0 : return false;
10410 : }
10411 0 : r->in.notify_filter = test_var;
10412 : } else {
10413 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10414 : PyLong_Type.tp_name);
10415 0 : return false;
10416 : }
10417 : }
10418 0 : if (py_unknown == NULL) {
10419 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.unknown");
10420 0 : return false;
10421 : }
10422 : {
10423 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.unknown));
10424 0 : if (PyLong_Check(py_unknown)) {
10425 : unsigned long long test_var;
10426 0 : test_var = PyLong_AsUnsignedLongLong(py_unknown);
10427 0 : if (PyErr_Occurred() != NULL) {
10428 0 : return false;
10429 : }
10430 0 : if (test_var > uint_max) {
10431 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10432 : PyLong_Type.tp_name, uint_max, test_var);
10433 0 : return false;
10434 : }
10435 0 : r->in.unknown = test_var;
10436 : } else {
10437 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10438 : PyLong_Type.tp_name);
10439 0 : return false;
10440 : }
10441 : }
10442 0 : if (py_string1 == NULL) {
10443 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.string1");
10444 0 : return false;
10445 : }
10446 0 : PY_CHECK_TYPE(&winreg_String_Type, py_string1, return false;);
10447 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_string1)) == NULL) {
10448 0 : PyErr_NoMemory();
10449 0 : return false;
10450 : }
10451 0 : r->in.string1 = *(struct winreg_String *)pytalloc_get_ptr(py_string1);
10452 0 : if (py_string2 == NULL) {
10453 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.string2");
10454 0 : return false;
10455 : }
10456 0 : PY_CHECK_TYPE(&winreg_String_Type, py_string2, return false;);
10457 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_string2)) == NULL) {
10458 0 : PyErr_NoMemory();
10459 0 : return false;
10460 : }
10461 0 : r->in.string2 = *(struct winreg_String *)pytalloc_get_ptr(py_string2);
10462 0 : if (py_unknown2 == NULL) {
10463 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.unknown2");
10464 0 : return false;
10465 : }
10466 : {
10467 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.unknown2));
10468 0 : if (PyLong_Check(py_unknown2)) {
10469 : unsigned long long test_var;
10470 0 : test_var = PyLong_AsUnsignedLongLong(py_unknown2);
10471 0 : if (PyErr_Occurred() != NULL) {
10472 0 : return false;
10473 : }
10474 0 : if (test_var > uint_max) {
10475 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10476 : PyLong_Type.tp_name, uint_max, test_var);
10477 0 : return false;
10478 : }
10479 0 : r->in.unknown2 = test_var;
10480 : } else {
10481 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10482 : PyLong_Type.tp_name);
10483 0 : return false;
10484 : }
10485 : }
10486 0 : return true;
10487 : }
10488 :
10489 0 : static PyObject *unpack_py_winreg_NotifyChangeKeyValue_args_out(struct winreg_NotifyChangeKeyValue *r)
10490 : {
10491 : PyObject *result;
10492 0 : result = Py_None;
10493 0 : Py_INCREF(result);
10494 0 : if (!W_ERROR_IS_OK(r->out.result)) {
10495 0 : PyErr_SetWERROR(r->out.result);
10496 0 : return NULL;
10497 : }
10498 :
10499 0 : return result;
10500 : }
10501 :
10502 :
10503 0 : static PyObject *py_winreg_OpenKey_in_get_parent_handle(PyObject *obj, void *closure)
10504 : {
10505 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(obj);
10506 : PyObject *py_parent_handle;
10507 0 : if (object->in.parent_handle == NULL) {
10508 0 : Py_RETURN_NONE;
10509 : }
10510 0 : py_parent_handle = pytalloc_reference_ex(policy_handle_Type, object->in.parent_handle, object->in.parent_handle);
10511 0 : return py_parent_handle;
10512 : }
10513 :
10514 0 : static int py_winreg_OpenKey_in_set_parent_handle(PyObject *py_obj, PyObject *value, void *closure)
10515 : {
10516 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10517 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.parent_handle));
10518 0 : if (value == NULL) {
10519 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.parent_handle");
10520 0 : return -1;
10521 : }
10522 0 : object->in.parent_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.parent_handle);
10523 0 : if (object->in.parent_handle == NULL) {
10524 0 : PyErr_NoMemory();
10525 0 : return -1;
10526 : }
10527 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
10528 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
10529 0 : PyErr_NoMemory();
10530 0 : return -1;
10531 : }
10532 0 : object->in.parent_handle = (struct policy_handle *)pytalloc_get_ptr(value);
10533 0 : return 0;
10534 : }
10535 :
10536 0 : static PyObject *py_winreg_OpenKey_in_get_keyname(PyObject *obj, void *closure)
10537 : {
10538 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(obj);
10539 : PyObject *py_keyname;
10540 0 : py_keyname = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.keyname);
10541 0 : return py_keyname;
10542 : }
10543 :
10544 0 : static int py_winreg_OpenKey_in_set_keyname(PyObject *py_obj, PyObject *value, void *closure)
10545 : {
10546 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10547 0 : if (value == NULL) {
10548 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.keyname");
10549 0 : return -1;
10550 : }
10551 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
10552 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
10553 0 : PyErr_NoMemory();
10554 0 : return -1;
10555 : }
10556 0 : object->in.keyname = *(struct winreg_String *)pytalloc_get_ptr(value);
10557 0 : return 0;
10558 : }
10559 :
10560 0 : static PyObject *py_winreg_OpenKey_in_get_options(PyObject *obj, void *closure)
10561 : {
10562 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(obj);
10563 : PyObject *py_options;
10564 0 : py_options = PyLong_FromUnsignedLongLong((uint32_t)(object->in.options));
10565 0 : return py_options;
10566 : }
10567 :
10568 0 : static int py_winreg_OpenKey_in_set_options(PyObject *py_obj, PyObject *value, void *closure)
10569 : {
10570 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10571 0 : if (value == NULL) {
10572 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.options");
10573 0 : return -1;
10574 : }
10575 : {
10576 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.options));
10577 0 : if (PyLong_Check(value)) {
10578 : unsigned long long test_var;
10579 0 : test_var = PyLong_AsUnsignedLongLong(value);
10580 0 : if (PyErr_Occurred() != NULL) {
10581 0 : return -1;
10582 : }
10583 0 : if (test_var > uint_max) {
10584 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10585 : PyLong_Type.tp_name, uint_max, test_var);
10586 0 : return -1;
10587 : }
10588 0 : object->in.options = test_var;
10589 : } else {
10590 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10591 : PyLong_Type.tp_name);
10592 0 : return -1;
10593 : }
10594 : }
10595 0 : return 0;
10596 : }
10597 :
10598 0 : static PyObject *py_winreg_OpenKey_in_get_access_mask(PyObject *obj, void *closure)
10599 : {
10600 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(obj);
10601 : PyObject *py_access_mask;
10602 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
10603 0 : return py_access_mask;
10604 : }
10605 :
10606 0 : static int py_winreg_OpenKey_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
10607 : {
10608 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10609 0 : if (value == NULL) {
10610 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
10611 0 : return -1;
10612 : }
10613 : {
10614 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
10615 0 : if (PyLong_Check(value)) {
10616 : unsigned long long test_var;
10617 0 : test_var = PyLong_AsUnsignedLongLong(value);
10618 0 : if (PyErr_Occurred() != NULL) {
10619 0 : return -1;
10620 : }
10621 0 : if (test_var > uint_max) {
10622 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10623 : PyLong_Type.tp_name, uint_max, test_var);
10624 0 : return -1;
10625 : }
10626 0 : object->in.access_mask = test_var;
10627 : } else {
10628 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10629 : PyLong_Type.tp_name);
10630 0 : return -1;
10631 : }
10632 : }
10633 0 : return 0;
10634 : }
10635 :
10636 0 : static PyObject *py_winreg_OpenKey_out_get_handle(PyObject *obj, void *closure)
10637 : {
10638 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(obj);
10639 : PyObject *py_handle;
10640 0 : if (object->out.handle == NULL) {
10641 0 : Py_RETURN_NONE;
10642 : }
10643 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
10644 0 : return py_handle;
10645 : }
10646 :
10647 0 : static int py_winreg_OpenKey_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
10648 : {
10649 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10650 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
10651 0 : if (value == NULL) {
10652 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
10653 0 : return -1;
10654 : }
10655 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
10656 0 : if (object->out.handle == NULL) {
10657 0 : PyErr_NoMemory();
10658 0 : return -1;
10659 : }
10660 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
10661 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
10662 0 : PyErr_NoMemory();
10663 0 : return -1;
10664 : }
10665 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
10666 0 : return 0;
10667 : }
10668 :
10669 0 : static PyObject *py_winreg_OpenKey_get_result(PyObject *obj, void *closure)
10670 : {
10671 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(obj);
10672 : PyObject *py_result;
10673 0 : py_result = PyErr_FromWERROR(object->out.result);
10674 0 : return py_result;
10675 : }
10676 :
10677 0 : static int py_winreg_OpenKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
10678 : {
10679 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10680 0 : if (value == NULL) {
10681 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
10682 0 : return -1;
10683 : }
10684 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
10685 0 : return 0;
10686 : }
10687 :
10688 : static PyGetSetDef py_winreg_OpenKey_getsetters[] = {
10689 : {
10690 : .name = discard_const_p(char, "in_parent_handle"),
10691 : .get = py_winreg_OpenKey_in_get_parent_handle,
10692 : .set = py_winreg_OpenKey_in_set_parent_handle,
10693 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
10694 : },
10695 : {
10696 : .name = discard_const_p(char, "in_keyname"),
10697 : .get = py_winreg_OpenKey_in_get_keyname,
10698 : .set = py_winreg_OpenKey_in_set_keyname,
10699 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
10700 : },
10701 : {
10702 : .name = discard_const_p(char, "in_options"),
10703 : .get = py_winreg_OpenKey_in_get_options,
10704 : .set = py_winreg_OpenKey_in_set_options,
10705 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_KeyOptions")
10706 : },
10707 : {
10708 : .name = discard_const_p(char, "in_access_mask"),
10709 : .get = py_winreg_OpenKey_in_get_access_mask,
10710 : .set = py_winreg_OpenKey_in_set_access_mask,
10711 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
10712 : },
10713 : {
10714 : .name = discard_const_p(char, "out_handle"),
10715 : .get = py_winreg_OpenKey_out_get_handle,
10716 : .set = py_winreg_OpenKey_out_set_handle,
10717 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
10718 : },
10719 : {
10720 : .name = discard_const_p(char, "result"),
10721 : .get = py_winreg_OpenKey_get_result,
10722 : .set = py_winreg_OpenKey_set_result,
10723 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
10724 : },
10725 : { .name = NULL }
10726 : };
10727 :
10728 0 : static PyObject *py_winreg_OpenKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
10729 : {
10730 0 : PyObject *self = pytalloc_new(struct winreg_OpenKey, type);
10731 0 : struct winreg_OpenKey *_self = (struct winreg_OpenKey *)pytalloc_get_ptr(self);
10732 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
10733 0 : _self->in.parent_handle = talloc_zero(mem_ctx, struct policy_handle);
10734 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
10735 0 : return self;
10736 : }
10737 :
10738 0 : static PyObject *py_winreg_OpenKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
10739 : {
10740 :
10741 :
10742 0 : return PyLong_FromLong(15);
10743 : }
10744 :
10745 0 : static PyObject *py_winreg_OpenKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
10746 : {
10747 0 : const struct ndr_interface_call *call = NULL;
10748 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10749 0 : PyObject *ret = NULL;
10750 0 : struct ndr_push *push = NULL;
10751 : DATA_BLOB blob;
10752 : enum ndr_err_code err;
10753 :
10754 0 : if (ndr_table_winreg.num_calls < 16) {
10755 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenKey_ndr_pack");
10756 0 : return NULL;
10757 : }
10758 0 : call = &ndr_table_winreg.calls[15];
10759 :
10760 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
10761 0 : if (push == NULL) {
10762 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10763 0 : return NULL;
10764 : }
10765 :
10766 0 : push->flags |= ndr_push_flags;
10767 :
10768 0 : err = call->ndr_push(push, ndr_inout_flags, object);
10769 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10770 0 : TALLOC_FREE(push);
10771 0 : PyErr_SetNdrError(err);
10772 0 : return NULL;
10773 : }
10774 0 : blob = ndr_push_blob(push);
10775 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
10776 0 : TALLOC_FREE(push);
10777 0 : return ret;
10778 : }
10779 :
10780 0 : static PyObject *py_winreg_OpenKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10781 : {
10782 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10783 0 : PyObject *bigendian_obj = NULL;
10784 0 : PyObject *ndr64_obj = NULL;
10785 0 : libndr_flags ndr_push_flags = 0;
10786 :
10787 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
10788 : discard_const_p(char *, kwnames),
10789 : &bigendian_obj,
10790 : &ndr64_obj)) {
10791 0 : return NULL;
10792 : }
10793 :
10794 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10795 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10796 : }
10797 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10798 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10799 : }
10800 :
10801 0 : return py_winreg_OpenKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
10802 : }
10803 :
10804 0 : static PyObject *py_winreg_OpenKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10805 : {
10806 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10807 0 : PyObject *bigendian_obj = NULL;
10808 0 : PyObject *ndr64_obj = NULL;
10809 0 : libndr_flags ndr_push_flags = 0;
10810 :
10811 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
10812 : discard_const_p(char *, kwnames),
10813 : &bigendian_obj,
10814 : &ndr64_obj)) {
10815 0 : return NULL;
10816 : }
10817 :
10818 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10819 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10820 : }
10821 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10822 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10823 : }
10824 :
10825 0 : return py_winreg_OpenKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
10826 : }
10827 :
10828 0 : static PyObject *py_winreg_OpenKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
10829 : {
10830 0 : const struct ndr_interface_call *call = NULL;
10831 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10832 0 : struct ndr_pull *pull = NULL;
10833 : enum ndr_err_code err;
10834 :
10835 0 : if (ndr_table_winreg.num_calls < 16) {
10836 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenKey_ndr_unpack");
10837 0 : return NULL;
10838 : }
10839 0 : call = &ndr_table_winreg.calls[15];
10840 :
10841 0 : pull = ndr_pull_init_blob(blob, object);
10842 0 : if (pull == NULL) {
10843 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10844 0 : return NULL;
10845 : }
10846 :
10847 0 : pull->flags |= ndr_pull_flags;
10848 :
10849 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
10850 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10851 0 : TALLOC_FREE(pull);
10852 0 : PyErr_SetNdrError(err);
10853 0 : return NULL;
10854 : }
10855 0 : if (!allow_remaining) {
10856 : uint32_t highest_ofs;
10857 :
10858 0 : if (pull->offset > pull->relative_highest_offset) {
10859 0 : highest_ofs = pull->offset;
10860 : } else {
10861 0 : highest_ofs = pull->relative_highest_offset;
10862 : }
10863 0 : if (highest_ofs < pull->data_size) {
10864 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
10865 : "not all bytes consumed ofs[%u] size[%u]",
10866 : highest_ofs, pull->data_size);
10867 0 : TALLOC_FREE(pull);
10868 0 : PyErr_SetNdrError(err);
10869 0 : return NULL;
10870 : }
10871 : }
10872 :
10873 0 : TALLOC_FREE(pull);
10874 0 : Py_RETURN_NONE;
10875 : }
10876 :
10877 0 : static PyObject *py_winreg_OpenKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10878 : {
10879 : DATA_BLOB blob;
10880 0 : Py_ssize_t blob_length = 0;
10881 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10882 0 : PyObject *bigendian_obj = NULL;
10883 0 : PyObject *ndr64_obj = NULL;
10884 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10885 0 : PyObject *allow_remaining_obj = NULL;
10886 0 : bool allow_remaining = false;
10887 :
10888 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
10889 : discard_const_p(char *, kwnames),
10890 : &blob.data, &blob_length,
10891 : &bigendian_obj,
10892 : &ndr64_obj,
10893 : &allow_remaining_obj)) {
10894 0 : return NULL;
10895 : }
10896 0 : blob.length = blob_length;
10897 :
10898 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10899 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10900 : }
10901 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10902 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10903 : }
10904 :
10905 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10906 0 : allow_remaining = true;
10907 : }
10908 :
10909 0 : return py_winreg_OpenKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
10910 : }
10911 :
10912 0 : static PyObject *py_winreg_OpenKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10913 : {
10914 : DATA_BLOB blob;
10915 0 : Py_ssize_t blob_length = 0;
10916 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10917 0 : PyObject *bigendian_obj = NULL;
10918 0 : PyObject *ndr64_obj = NULL;
10919 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10920 0 : PyObject *allow_remaining_obj = NULL;
10921 0 : bool allow_remaining = false;
10922 :
10923 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
10924 : discard_const_p(char *, kwnames),
10925 : &blob.data, &blob_length,
10926 : &bigendian_obj,
10927 : &ndr64_obj,
10928 : &allow_remaining_obj)) {
10929 0 : return NULL;
10930 : }
10931 0 : blob.length = blob_length;
10932 :
10933 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10934 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10935 : }
10936 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10937 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10938 : }
10939 :
10940 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10941 0 : allow_remaining = true;
10942 : }
10943 :
10944 0 : return py_winreg_OpenKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
10945 : }
10946 :
10947 0 : static PyObject *py_winreg_OpenKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
10948 : {
10949 0 : const struct ndr_interface_call *call = NULL;
10950 0 : struct winreg_OpenKey *object = pytalloc_get_ptr(py_obj);
10951 : PyObject *ret;
10952 : char *retstr;
10953 :
10954 0 : if (ndr_table_winreg.num_calls < 16) {
10955 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenKey_ndr_print");
10956 0 : return NULL;
10957 : }
10958 0 : call = &ndr_table_winreg.calls[15];
10959 :
10960 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
10961 0 : ret = PyUnicode_FromString(retstr);
10962 0 : TALLOC_FREE(retstr);
10963 :
10964 0 : return ret;
10965 : }
10966 :
10967 0 : static PyObject *py_winreg_OpenKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10968 : {
10969 0 : return py_winreg_OpenKey_ndr_print(py_obj, "winreg_OpenKey_in", NDR_IN);
10970 : }
10971 :
10972 0 : static PyObject *py_winreg_OpenKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10973 : {
10974 0 : return py_winreg_OpenKey_ndr_print(py_obj, "winreg_OpenKey_out", NDR_OUT);
10975 : }
10976 :
10977 : static PyMethodDef py_winreg_OpenKey_methods[] = {
10978 : { "opnum", (PyCFunction)py_winreg_OpenKey_ndr_opnum, METH_NOARGS|METH_CLASS,
10979 : "winreg.OpenKey.opnum() -> 15 (0x0f) " },
10980 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
10981 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
10982 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
10983 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
10984 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
10985 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
10986 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
10987 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
10988 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
10989 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
10990 : { NULL, NULL, 0, NULL }
10991 : };
10992 :
10993 :
10994 : static PyTypeObject winreg_OpenKey_Type = {
10995 : PyVarObject_HEAD_INIT(NULL, 0)
10996 : .tp_name = "winreg.OpenKey",
10997 : .tp_getset = py_winreg_OpenKey_getsetters,
10998 : .tp_methods = py_winreg_OpenKey_methods,
10999 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
11000 : .tp_new = py_winreg_OpenKey_new,
11001 : };
11002 :
11003 0 : static bool pack_py_winreg_OpenKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenKey *r)
11004 : {
11005 : PyObject *py_parent_handle;
11006 : PyObject *py_keyname;
11007 : PyObject *py_options;
11008 : PyObject *py_access_mask;
11009 0 : const char *kwnames[] = {
11010 : "parent_handle", "keyname", "options", "access_mask", NULL
11011 : };
11012 :
11013 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_OpenKey", discard_const_p(char *, kwnames), &py_parent_handle, &py_keyname, &py_options, &py_access_mask)) {
11014 0 : return false;
11015 : }
11016 :
11017 0 : if (py_parent_handle == NULL) {
11018 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.parent_handle");
11019 0 : return false;
11020 : }
11021 0 : r->in.parent_handle = talloc_ptrtype(r, r->in.parent_handle);
11022 0 : if (r->in.parent_handle == NULL) {
11023 0 : PyErr_NoMemory();
11024 0 : return false;
11025 : }
11026 0 : PY_CHECK_TYPE(policy_handle_Type, py_parent_handle, return false;);
11027 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_parent_handle)) == NULL) {
11028 0 : PyErr_NoMemory();
11029 0 : return false;
11030 : }
11031 0 : r->in.parent_handle = (struct policy_handle *)pytalloc_get_ptr(py_parent_handle);
11032 0 : if (py_keyname == NULL) {
11033 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.keyname");
11034 0 : return false;
11035 : }
11036 0 : PY_CHECK_TYPE(&winreg_String_Type, py_keyname, return false;);
11037 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyname)) == NULL) {
11038 0 : PyErr_NoMemory();
11039 0 : return false;
11040 : }
11041 0 : r->in.keyname = *(struct winreg_String *)pytalloc_get_ptr(py_keyname);
11042 0 : if (py_options == NULL) {
11043 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.options");
11044 0 : return false;
11045 : }
11046 : {
11047 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.options));
11048 0 : if (PyLong_Check(py_options)) {
11049 : unsigned long long test_var;
11050 0 : test_var = PyLong_AsUnsignedLongLong(py_options);
11051 0 : if (PyErr_Occurred() != NULL) {
11052 0 : return false;
11053 : }
11054 0 : if (test_var > uint_max) {
11055 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11056 : PyLong_Type.tp_name, uint_max, test_var);
11057 0 : return false;
11058 : }
11059 0 : r->in.options = test_var;
11060 : } else {
11061 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11062 : PyLong_Type.tp_name);
11063 0 : return false;
11064 : }
11065 : }
11066 0 : if (py_access_mask == NULL) {
11067 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
11068 0 : return false;
11069 : }
11070 : {
11071 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
11072 0 : if (PyLong_Check(py_access_mask)) {
11073 : unsigned long long test_var;
11074 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
11075 0 : if (PyErr_Occurred() != NULL) {
11076 0 : return false;
11077 : }
11078 0 : if (test_var > uint_max) {
11079 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11080 : PyLong_Type.tp_name, uint_max, test_var);
11081 0 : return false;
11082 : }
11083 0 : r->in.access_mask = test_var;
11084 : } else {
11085 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11086 : PyLong_Type.tp_name);
11087 0 : return false;
11088 : }
11089 : }
11090 0 : return true;
11091 : }
11092 :
11093 0 : static PyObject *unpack_py_winreg_OpenKey_args_out(struct winreg_OpenKey *r)
11094 : {
11095 : PyObject *result;
11096 : PyObject *py_handle;
11097 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
11098 0 : result = py_handle;
11099 0 : if (!W_ERROR_IS_OK(r->out.result)) {
11100 0 : PyErr_SetWERROR(r->out.result);
11101 0 : return NULL;
11102 : }
11103 :
11104 0 : return result;
11105 : }
11106 :
11107 :
11108 0 : static PyObject *py_winreg_QueryInfoKey_in_get_handle(PyObject *obj, void *closure)
11109 : {
11110 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11111 : PyObject *py_handle;
11112 0 : if (object->in.handle == NULL) {
11113 0 : Py_RETURN_NONE;
11114 : }
11115 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
11116 0 : return py_handle;
11117 : }
11118 :
11119 0 : static int py_winreg_QueryInfoKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
11120 : {
11121 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11122 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
11123 0 : if (value == NULL) {
11124 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
11125 0 : return -1;
11126 : }
11127 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
11128 0 : if (object->in.handle == NULL) {
11129 0 : PyErr_NoMemory();
11130 0 : return -1;
11131 : }
11132 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
11133 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
11134 0 : PyErr_NoMemory();
11135 0 : return -1;
11136 : }
11137 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
11138 0 : return 0;
11139 : }
11140 :
11141 0 : static PyObject *py_winreg_QueryInfoKey_in_get_classname(PyObject *obj, void *closure)
11142 : {
11143 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11144 : PyObject *py_classname;
11145 0 : if (object->in.classname == NULL) {
11146 0 : Py_RETURN_NONE;
11147 : }
11148 0 : py_classname = pytalloc_reference_ex(&winreg_String_Type, object->in.classname, object->in.classname);
11149 0 : return py_classname;
11150 : }
11151 :
11152 0 : static int py_winreg_QueryInfoKey_in_set_classname(PyObject *py_obj, PyObject *value, void *closure)
11153 : {
11154 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11155 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.classname));
11156 0 : if (value == NULL) {
11157 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.classname");
11158 0 : return -1;
11159 : }
11160 0 : object->in.classname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.classname);
11161 0 : if (object->in.classname == NULL) {
11162 0 : PyErr_NoMemory();
11163 0 : return -1;
11164 : }
11165 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
11166 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
11167 0 : PyErr_NoMemory();
11168 0 : return -1;
11169 : }
11170 0 : object->in.classname = (struct winreg_String *)pytalloc_get_ptr(value);
11171 0 : return 0;
11172 : }
11173 :
11174 0 : static PyObject *py_winreg_QueryInfoKey_out_get_classname(PyObject *obj, void *closure)
11175 : {
11176 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11177 : PyObject *py_classname;
11178 0 : if (object->out.classname == NULL) {
11179 0 : Py_RETURN_NONE;
11180 : }
11181 0 : py_classname = pytalloc_reference_ex(&winreg_String_Type, object->out.classname, object->out.classname);
11182 0 : return py_classname;
11183 : }
11184 :
11185 0 : static int py_winreg_QueryInfoKey_out_set_classname(PyObject *py_obj, PyObject *value, void *closure)
11186 : {
11187 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11188 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.classname));
11189 0 : if (value == NULL) {
11190 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.classname");
11191 0 : return -1;
11192 : }
11193 0 : object->out.classname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.classname);
11194 0 : if (object->out.classname == NULL) {
11195 0 : PyErr_NoMemory();
11196 0 : return -1;
11197 : }
11198 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
11199 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
11200 0 : PyErr_NoMemory();
11201 0 : return -1;
11202 : }
11203 0 : object->out.classname = (struct winreg_String *)pytalloc_get_ptr(value);
11204 0 : return 0;
11205 : }
11206 :
11207 0 : static PyObject *py_winreg_QueryInfoKey_out_get_num_subkeys(PyObject *obj, void *closure)
11208 : {
11209 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11210 : PyObject *py_num_subkeys;
11211 0 : if (object->out.num_subkeys == NULL) {
11212 0 : Py_RETURN_NONE;
11213 : }
11214 0 : py_num_subkeys = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.num_subkeys));
11215 0 : return py_num_subkeys;
11216 : }
11217 :
11218 0 : static int py_winreg_QueryInfoKey_out_set_num_subkeys(PyObject *py_obj, PyObject *value, void *closure)
11219 : {
11220 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11221 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.num_subkeys));
11222 0 : if (value == NULL) {
11223 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.num_subkeys");
11224 0 : return -1;
11225 : }
11226 0 : object->out.num_subkeys = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.num_subkeys);
11227 0 : if (object->out.num_subkeys == NULL) {
11228 0 : PyErr_NoMemory();
11229 0 : return -1;
11230 : }
11231 : {
11232 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.num_subkeys));
11233 0 : if (PyLong_Check(value)) {
11234 : unsigned long long test_var;
11235 0 : test_var = PyLong_AsUnsignedLongLong(value);
11236 0 : if (PyErr_Occurred() != NULL) {
11237 0 : return -1;
11238 : }
11239 0 : if (test_var > uint_max) {
11240 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11241 : PyLong_Type.tp_name, uint_max, test_var);
11242 0 : return -1;
11243 : }
11244 0 : *object->out.num_subkeys = test_var;
11245 : } else {
11246 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11247 : PyLong_Type.tp_name);
11248 0 : return -1;
11249 : }
11250 : }
11251 0 : return 0;
11252 : }
11253 :
11254 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_subkeylen(PyObject *obj, void *closure)
11255 : {
11256 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11257 : PyObject *py_max_subkeylen;
11258 0 : if (object->out.max_subkeylen == NULL) {
11259 0 : Py_RETURN_NONE;
11260 : }
11261 0 : py_max_subkeylen = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.max_subkeylen));
11262 0 : return py_max_subkeylen;
11263 : }
11264 :
11265 0 : static int py_winreg_QueryInfoKey_out_set_max_subkeylen(PyObject *py_obj, PyObject *value, void *closure)
11266 : {
11267 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11268 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_subkeylen));
11269 0 : if (value == NULL) {
11270 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.max_subkeylen");
11271 0 : return -1;
11272 : }
11273 0 : object->out.max_subkeylen = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_subkeylen);
11274 0 : if (object->out.max_subkeylen == NULL) {
11275 0 : PyErr_NoMemory();
11276 0 : return -1;
11277 : }
11278 : {
11279 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_subkeylen));
11280 0 : if (PyLong_Check(value)) {
11281 : unsigned long long test_var;
11282 0 : test_var = PyLong_AsUnsignedLongLong(value);
11283 0 : if (PyErr_Occurred() != NULL) {
11284 0 : return -1;
11285 : }
11286 0 : if (test_var > uint_max) {
11287 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11288 : PyLong_Type.tp_name, uint_max, test_var);
11289 0 : return -1;
11290 : }
11291 0 : *object->out.max_subkeylen = test_var;
11292 : } else {
11293 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11294 : PyLong_Type.tp_name);
11295 0 : return -1;
11296 : }
11297 : }
11298 0 : return 0;
11299 : }
11300 :
11301 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_classlen(PyObject *obj, void *closure)
11302 : {
11303 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11304 : PyObject *py_max_classlen;
11305 0 : if (object->out.max_classlen == NULL) {
11306 0 : Py_RETURN_NONE;
11307 : }
11308 0 : py_max_classlen = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.max_classlen));
11309 0 : return py_max_classlen;
11310 : }
11311 :
11312 0 : static int py_winreg_QueryInfoKey_out_set_max_classlen(PyObject *py_obj, PyObject *value, void *closure)
11313 : {
11314 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11315 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_classlen));
11316 0 : if (value == NULL) {
11317 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.max_classlen");
11318 0 : return -1;
11319 : }
11320 0 : object->out.max_classlen = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_classlen);
11321 0 : if (object->out.max_classlen == NULL) {
11322 0 : PyErr_NoMemory();
11323 0 : return -1;
11324 : }
11325 : {
11326 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_classlen));
11327 0 : if (PyLong_Check(value)) {
11328 : unsigned long long test_var;
11329 0 : test_var = PyLong_AsUnsignedLongLong(value);
11330 0 : if (PyErr_Occurred() != NULL) {
11331 0 : return -1;
11332 : }
11333 0 : if (test_var > uint_max) {
11334 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11335 : PyLong_Type.tp_name, uint_max, test_var);
11336 0 : return -1;
11337 : }
11338 0 : *object->out.max_classlen = test_var;
11339 : } else {
11340 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11341 : PyLong_Type.tp_name);
11342 0 : return -1;
11343 : }
11344 : }
11345 0 : return 0;
11346 : }
11347 :
11348 0 : static PyObject *py_winreg_QueryInfoKey_out_get_num_values(PyObject *obj, void *closure)
11349 : {
11350 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11351 : PyObject *py_num_values;
11352 0 : if (object->out.num_values == NULL) {
11353 0 : Py_RETURN_NONE;
11354 : }
11355 0 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.num_values));
11356 0 : return py_num_values;
11357 : }
11358 :
11359 0 : static int py_winreg_QueryInfoKey_out_set_num_values(PyObject *py_obj, PyObject *value, void *closure)
11360 : {
11361 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11362 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.num_values));
11363 0 : if (value == NULL) {
11364 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.num_values");
11365 0 : return -1;
11366 : }
11367 0 : object->out.num_values = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.num_values);
11368 0 : if (object->out.num_values == NULL) {
11369 0 : PyErr_NoMemory();
11370 0 : return -1;
11371 : }
11372 : {
11373 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.num_values));
11374 0 : if (PyLong_Check(value)) {
11375 : unsigned long long test_var;
11376 0 : test_var = PyLong_AsUnsignedLongLong(value);
11377 0 : if (PyErr_Occurred() != NULL) {
11378 0 : return -1;
11379 : }
11380 0 : if (test_var > uint_max) {
11381 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11382 : PyLong_Type.tp_name, uint_max, test_var);
11383 0 : return -1;
11384 : }
11385 0 : *object->out.num_values = test_var;
11386 : } else {
11387 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11388 : PyLong_Type.tp_name);
11389 0 : return -1;
11390 : }
11391 : }
11392 0 : return 0;
11393 : }
11394 :
11395 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_valnamelen(PyObject *obj, void *closure)
11396 : {
11397 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11398 : PyObject *py_max_valnamelen;
11399 0 : if (object->out.max_valnamelen == NULL) {
11400 0 : Py_RETURN_NONE;
11401 : }
11402 0 : py_max_valnamelen = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.max_valnamelen));
11403 0 : return py_max_valnamelen;
11404 : }
11405 :
11406 0 : static int py_winreg_QueryInfoKey_out_set_max_valnamelen(PyObject *py_obj, PyObject *value, void *closure)
11407 : {
11408 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11409 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_valnamelen));
11410 0 : if (value == NULL) {
11411 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.max_valnamelen");
11412 0 : return -1;
11413 : }
11414 0 : object->out.max_valnamelen = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_valnamelen);
11415 0 : if (object->out.max_valnamelen == NULL) {
11416 0 : PyErr_NoMemory();
11417 0 : return -1;
11418 : }
11419 : {
11420 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_valnamelen));
11421 0 : if (PyLong_Check(value)) {
11422 : unsigned long long test_var;
11423 0 : test_var = PyLong_AsUnsignedLongLong(value);
11424 0 : if (PyErr_Occurred() != NULL) {
11425 0 : return -1;
11426 : }
11427 0 : if (test_var > uint_max) {
11428 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11429 : PyLong_Type.tp_name, uint_max, test_var);
11430 0 : return -1;
11431 : }
11432 0 : *object->out.max_valnamelen = test_var;
11433 : } else {
11434 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11435 : PyLong_Type.tp_name);
11436 0 : return -1;
11437 : }
11438 : }
11439 0 : return 0;
11440 : }
11441 :
11442 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_valbufsize(PyObject *obj, void *closure)
11443 : {
11444 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11445 : PyObject *py_max_valbufsize;
11446 0 : if (object->out.max_valbufsize == NULL) {
11447 0 : Py_RETURN_NONE;
11448 : }
11449 0 : py_max_valbufsize = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.max_valbufsize));
11450 0 : return py_max_valbufsize;
11451 : }
11452 :
11453 0 : static int py_winreg_QueryInfoKey_out_set_max_valbufsize(PyObject *py_obj, PyObject *value, void *closure)
11454 : {
11455 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11456 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_valbufsize));
11457 0 : if (value == NULL) {
11458 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.max_valbufsize");
11459 0 : return -1;
11460 : }
11461 0 : object->out.max_valbufsize = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_valbufsize);
11462 0 : if (object->out.max_valbufsize == NULL) {
11463 0 : PyErr_NoMemory();
11464 0 : return -1;
11465 : }
11466 : {
11467 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_valbufsize));
11468 0 : if (PyLong_Check(value)) {
11469 : unsigned long long test_var;
11470 0 : test_var = PyLong_AsUnsignedLongLong(value);
11471 0 : if (PyErr_Occurred() != NULL) {
11472 0 : return -1;
11473 : }
11474 0 : if (test_var > uint_max) {
11475 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11476 : PyLong_Type.tp_name, uint_max, test_var);
11477 0 : return -1;
11478 : }
11479 0 : *object->out.max_valbufsize = test_var;
11480 : } else {
11481 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11482 : PyLong_Type.tp_name);
11483 0 : return -1;
11484 : }
11485 : }
11486 0 : return 0;
11487 : }
11488 :
11489 0 : static PyObject *py_winreg_QueryInfoKey_out_get_secdescsize(PyObject *obj, void *closure)
11490 : {
11491 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11492 : PyObject *py_secdescsize;
11493 0 : if (object->out.secdescsize == NULL) {
11494 0 : Py_RETURN_NONE;
11495 : }
11496 0 : py_secdescsize = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.secdescsize));
11497 0 : return py_secdescsize;
11498 : }
11499 :
11500 0 : static int py_winreg_QueryInfoKey_out_set_secdescsize(PyObject *py_obj, PyObject *value, void *closure)
11501 : {
11502 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11503 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.secdescsize));
11504 0 : if (value == NULL) {
11505 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.secdescsize");
11506 0 : return -1;
11507 : }
11508 0 : object->out.secdescsize = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.secdescsize);
11509 0 : if (object->out.secdescsize == NULL) {
11510 0 : PyErr_NoMemory();
11511 0 : return -1;
11512 : }
11513 : {
11514 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.secdescsize));
11515 0 : if (PyLong_Check(value)) {
11516 : unsigned long long test_var;
11517 0 : test_var = PyLong_AsUnsignedLongLong(value);
11518 0 : if (PyErr_Occurred() != NULL) {
11519 0 : return -1;
11520 : }
11521 0 : if (test_var > uint_max) {
11522 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11523 : PyLong_Type.tp_name, uint_max, test_var);
11524 0 : return -1;
11525 : }
11526 0 : *object->out.secdescsize = test_var;
11527 : } else {
11528 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11529 : PyLong_Type.tp_name);
11530 0 : return -1;
11531 : }
11532 : }
11533 0 : return 0;
11534 : }
11535 :
11536 0 : static PyObject *py_winreg_QueryInfoKey_out_get_last_changed_time(PyObject *obj, void *closure)
11537 : {
11538 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11539 : PyObject *py_last_changed_time;
11540 0 : if (object->out.last_changed_time == NULL) {
11541 0 : Py_RETURN_NONE;
11542 : }
11543 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*object->out.last_changed_time);
11544 0 : return py_last_changed_time;
11545 : }
11546 :
11547 0 : static int py_winreg_QueryInfoKey_out_set_last_changed_time(PyObject *py_obj, PyObject *value, void *closure)
11548 : {
11549 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11550 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.last_changed_time));
11551 0 : if (value == NULL) {
11552 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.last_changed_time");
11553 0 : return -1;
11554 : }
11555 0 : object->out.last_changed_time = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.last_changed_time);
11556 0 : if (object->out.last_changed_time == NULL) {
11557 0 : PyErr_NoMemory();
11558 0 : return -1;
11559 : }
11560 : {
11561 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.last_changed_time));
11562 0 : if (PyLong_Check(value)) {
11563 : unsigned long long test_var;
11564 0 : test_var = PyLong_AsUnsignedLongLong(value);
11565 0 : if (PyErr_Occurred() != NULL) {
11566 0 : return -1;
11567 : }
11568 0 : if (test_var > uint_max) {
11569 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11570 : PyLong_Type.tp_name, uint_max, test_var);
11571 0 : return -1;
11572 : }
11573 0 : *object->out.last_changed_time = test_var;
11574 : } else {
11575 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11576 : PyLong_Type.tp_name);
11577 0 : return -1;
11578 : }
11579 : }
11580 0 : return 0;
11581 : }
11582 :
11583 0 : static PyObject *py_winreg_QueryInfoKey_get_result(PyObject *obj, void *closure)
11584 : {
11585 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(obj);
11586 : PyObject *py_result;
11587 0 : py_result = PyErr_FromWERROR(object->out.result);
11588 0 : return py_result;
11589 : }
11590 :
11591 0 : static int py_winreg_QueryInfoKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
11592 : {
11593 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11594 0 : if (value == NULL) {
11595 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
11596 0 : return -1;
11597 : }
11598 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
11599 0 : return 0;
11600 : }
11601 :
11602 : static PyGetSetDef py_winreg_QueryInfoKey_getsetters[] = {
11603 : {
11604 : .name = discard_const_p(char, "in_handle"),
11605 : .get = py_winreg_QueryInfoKey_in_get_handle,
11606 : .set = py_winreg_QueryInfoKey_in_set_handle,
11607 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
11608 : },
11609 : {
11610 : .name = discard_const_p(char, "in_classname"),
11611 : .get = py_winreg_QueryInfoKey_in_get_classname,
11612 : .set = py_winreg_QueryInfoKey_in_set_classname,
11613 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
11614 : },
11615 : {
11616 : .name = discard_const_p(char, "out_classname"),
11617 : .get = py_winreg_QueryInfoKey_out_get_classname,
11618 : .set = py_winreg_QueryInfoKey_out_set_classname,
11619 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
11620 : },
11621 : {
11622 : .name = discard_const_p(char, "out_num_subkeys"),
11623 : .get = py_winreg_QueryInfoKey_out_get_num_subkeys,
11624 : .set = py_winreg_QueryInfoKey_out_set_num_subkeys,
11625 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11626 : },
11627 : {
11628 : .name = discard_const_p(char, "out_max_subkeylen"),
11629 : .get = py_winreg_QueryInfoKey_out_get_max_subkeylen,
11630 : .set = py_winreg_QueryInfoKey_out_set_max_subkeylen,
11631 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11632 : },
11633 : {
11634 : .name = discard_const_p(char, "out_max_classlen"),
11635 : .get = py_winreg_QueryInfoKey_out_get_max_classlen,
11636 : .set = py_winreg_QueryInfoKey_out_set_max_classlen,
11637 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11638 : },
11639 : {
11640 : .name = discard_const_p(char, "out_num_values"),
11641 : .get = py_winreg_QueryInfoKey_out_get_num_values,
11642 : .set = py_winreg_QueryInfoKey_out_set_num_values,
11643 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11644 : },
11645 : {
11646 : .name = discard_const_p(char, "out_max_valnamelen"),
11647 : .get = py_winreg_QueryInfoKey_out_get_max_valnamelen,
11648 : .set = py_winreg_QueryInfoKey_out_set_max_valnamelen,
11649 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11650 : },
11651 : {
11652 : .name = discard_const_p(char, "out_max_valbufsize"),
11653 : .get = py_winreg_QueryInfoKey_out_get_max_valbufsize,
11654 : .set = py_winreg_QueryInfoKey_out_set_max_valbufsize,
11655 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11656 : },
11657 : {
11658 : .name = discard_const_p(char, "out_secdescsize"),
11659 : .get = py_winreg_QueryInfoKey_out_get_secdescsize,
11660 : .set = py_winreg_QueryInfoKey_out_set_secdescsize,
11661 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11662 : },
11663 : {
11664 : .name = discard_const_p(char, "out_last_changed_time"),
11665 : .get = py_winreg_QueryInfoKey_out_get_last_changed_time,
11666 : .set = py_winreg_QueryInfoKey_out_set_last_changed_time,
11667 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
11668 : },
11669 : {
11670 : .name = discard_const_p(char, "result"),
11671 : .get = py_winreg_QueryInfoKey_get_result,
11672 : .set = py_winreg_QueryInfoKey_set_result,
11673 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
11674 : },
11675 : { .name = NULL }
11676 : };
11677 :
11678 0 : static PyObject *py_winreg_QueryInfoKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
11679 : {
11680 0 : PyObject *self = pytalloc_new(struct winreg_QueryInfoKey, type);
11681 0 : struct winreg_QueryInfoKey *_self = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(self);
11682 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
11683 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
11684 0 : _self->in.classname = talloc_zero(mem_ctx, struct winreg_String);
11685 0 : _self->out.classname = talloc_zero(mem_ctx, struct winreg_String);
11686 0 : _self->out.num_subkeys = talloc_zero(mem_ctx, uint32_t);
11687 0 : _self->out.max_subkeylen = talloc_zero(mem_ctx, uint32_t);
11688 0 : _self->out.max_classlen = talloc_zero(mem_ctx, uint32_t);
11689 0 : _self->out.num_values = talloc_zero(mem_ctx, uint32_t);
11690 0 : _self->out.max_valnamelen = talloc_zero(mem_ctx, uint32_t);
11691 0 : _self->out.max_valbufsize = talloc_zero(mem_ctx, uint32_t);
11692 0 : _self->out.secdescsize = talloc_zero(mem_ctx, uint32_t);
11693 0 : _self->out.last_changed_time = talloc_zero(mem_ctx, NTTIME);
11694 0 : return self;
11695 : }
11696 :
11697 0 : static PyObject *py_winreg_QueryInfoKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
11698 : {
11699 :
11700 :
11701 0 : return PyLong_FromLong(16);
11702 : }
11703 :
11704 0 : static PyObject *py_winreg_QueryInfoKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
11705 : {
11706 0 : const struct ndr_interface_call *call = NULL;
11707 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11708 0 : PyObject *ret = NULL;
11709 0 : struct ndr_push *push = NULL;
11710 : DATA_BLOB blob;
11711 : enum ndr_err_code err;
11712 :
11713 0 : if (ndr_table_winreg.num_calls < 17) {
11714 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryInfoKey_ndr_pack");
11715 0 : return NULL;
11716 : }
11717 0 : call = &ndr_table_winreg.calls[16];
11718 :
11719 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
11720 0 : if (push == NULL) {
11721 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
11722 0 : return NULL;
11723 : }
11724 :
11725 0 : push->flags |= ndr_push_flags;
11726 :
11727 0 : err = call->ndr_push(push, ndr_inout_flags, object);
11728 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
11729 0 : TALLOC_FREE(push);
11730 0 : PyErr_SetNdrError(err);
11731 0 : return NULL;
11732 : }
11733 0 : blob = ndr_push_blob(push);
11734 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
11735 0 : TALLOC_FREE(push);
11736 0 : return ret;
11737 : }
11738 :
11739 0 : static PyObject *py_winreg_QueryInfoKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11740 : {
11741 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
11742 0 : PyObject *bigendian_obj = NULL;
11743 0 : PyObject *ndr64_obj = NULL;
11744 0 : libndr_flags ndr_push_flags = 0;
11745 :
11746 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
11747 : discard_const_p(char *, kwnames),
11748 : &bigendian_obj,
11749 : &ndr64_obj)) {
11750 0 : return NULL;
11751 : }
11752 :
11753 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11754 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
11755 : }
11756 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11757 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
11758 : }
11759 :
11760 0 : return py_winreg_QueryInfoKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
11761 : }
11762 :
11763 0 : static PyObject *py_winreg_QueryInfoKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11764 : {
11765 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
11766 0 : PyObject *bigendian_obj = NULL;
11767 0 : PyObject *ndr64_obj = NULL;
11768 0 : libndr_flags ndr_push_flags = 0;
11769 :
11770 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
11771 : discard_const_p(char *, kwnames),
11772 : &bigendian_obj,
11773 : &ndr64_obj)) {
11774 0 : return NULL;
11775 : }
11776 :
11777 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11778 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
11779 : }
11780 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11781 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
11782 : }
11783 :
11784 0 : return py_winreg_QueryInfoKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
11785 : }
11786 :
11787 0 : static PyObject *py_winreg_QueryInfoKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
11788 : {
11789 0 : const struct ndr_interface_call *call = NULL;
11790 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11791 0 : struct ndr_pull *pull = NULL;
11792 : enum ndr_err_code err;
11793 :
11794 0 : if (ndr_table_winreg.num_calls < 17) {
11795 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryInfoKey_ndr_unpack");
11796 0 : return NULL;
11797 : }
11798 0 : call = &ndr_table_winreg.calls[16];
11799 :
11800 0 : pull = ndr_pull_init_blob(blob, object);
11801 0 : if (pull == NULL) {
11802 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
11803 0 : return NULL;
11804 : }
11805 :
11806 0 : pull->flags |= ndr_pull_flags;
11807 :
11808 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
11809 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
11810 0 : TALLOC_FREE(pull);
11811 0 : PyErr_SetNdrError(err);
11812 0 : return NULL;
11813 : }
11814 0 : if (!allow_remaining) {
11815 : uint32_t highest_ofs;
11816 :
11817 0 : if (pull->offset > pull->relative_highest_offset) {
11818 0 : highest_ofs = pull->offset;
11819 : } else {
11820 0 : highest_ofs = pull->relative_highest_offset;
11821 : }
11822 0 : if (highest_ofs < pull->data_size) {
11823 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
11824 : "not all bytes consumed ofs[%u] size[%u]",
11825 : highest_ofs, pull->data_size);
11826 0 : TALLOC_FREE(pull);
11827 0 : PyErr_SetNdrError(err);
11828 0 : return NULL;
11829 : }
11830 : }
11831 :
11832 0 : TALLOC_FREE(pull);
11833 0 : Py_RETURN_NONE;
11834 : }
11835 :
11836 0 : static PyObject *py_winreg_QueryInfoKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11837 : {
11838 : DATA_BLOB blob;
11839 0 : Py_ssize_t blob_length = 0;
11840 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
11841 0 : PyObject *bigendian_obj = NULL;
11842 0 : PyObject *ndr64_obj = NULL;
11843 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
11844 0 : PyObject *allow_remaining_obj = NULL;
11845 0 : bool allow_remaining = false;
11846 :
11847 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
11848 : discard_const_p(char *, kwnames),
11849 : &blob.data, &blob_length,
11850 : &bigendian_obj,
11851 : &ndr64_obj,
11852 : &allow_remaining_obj)) {
11853 0 : return NULL;
11854 : }
11855 0 : blob.length = blob_length;
11856 :
11857 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11858 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
11859 : }
11860 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11861 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
11862 : }
11863 :
11864 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
11865 0 : allow_remaining = true;
11866 : }
11867 :
11868 0 : return py_winreg_QueryInfoKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
11869 : }
11870 :
11871 0 : static PyObject *py_winreg_QueryInfoKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11872 : {
11873 : DATA_BLOB blob;
11874 0 : Py_ssize_t blob_length = 0;
11875 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
11876 0 : PyObject *bigendian_obj = NULL;
11877 0 : PyObject *ndr64_obj = NULL;
11878 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
11879 0 : PyObject *allow_remaining_obj = NULL;
11880 0 : bool allow_remaining = false;
11881 :
11882 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
11883 : discard_const_p(char *, kwnames),
11884 : &blob.data, &blob_length,
11885 : &bigendian_obj,
11886 : &ndr64_obj,
11887 : &allow_remaining_obj)) {
11888 0 : return NULL;
11889 : }
11890 0 : blob.length = blob_length;
11891 :
11892 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11893 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
11894 : }
11895 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11896 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
11897 : }
11898 :
11899 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
11900 0 : allow_remaining = true;
11901 : }
11902 :
11903 0 : return py_winreg_QueryInfoKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
11904 : }
11905 :
11906 0 : static PyObject *py_winreg_QueryInfoKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
11907 : {
11908 0 : const struct ndr_interface_call *call = NULL;
11909 0 : struct winreg_QueryInfoKey *object = pytalloc_get_ptr(py_obj);
11910 : PyObject *ret;
11911 : char *retstr;
11912 :
11913 0 : if (ndr_table_winreg.num_calls < 17) {
11914 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryInfoKey_ndr_print");
11915 0 : return NULL;
11916 : }
11917 0 : call = &ndr_table_winreg.calls[16];
11918 :
11919 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
11920 0 : ret = PyUnicode_FromString(retstr);
11921 0 : TALLOC_FREE(retstr);
11922 :
11923 0 : return ret;
11924 : }
11925 :
11926 0 : static PyObject *py_winreg_QueryInfoKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
11927 : {
11928 0 : return py_winreg_QueryInfoKey_ndr_print(py_obj, "winreg_QueryInfoKey_in", NDR_IN);
11929 : }
11930 :
11931 0 : static PyObject *py_winreg_QueryInfoKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
11932 : {
11933 0 : return py_winreg_QueryInfoKey_ndr_print(py_obj, "winreg_QueryInfoKey_out", NDR_OUT);
11934 : }
11935 :
11936 : static PyMethodDef py_winreg_QueryInfoKey_methods[] = {
11937 : { "opnum", (PyCFunction)py_winreg_QueryInfoKey_ndr_opnum, METH_NOARGS|METH_CLASS,
11938 : "winreg.QueryInfoKey.opnum() -> 16 (0x10) " },
11939 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
11940 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
11941 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
11942 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
11943 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
11944 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
11945 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
11946 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
11947 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryInfoKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
11948 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryInfoKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
11949 : { NULL, NULL, 0, NULL }
11950 : };
11951 :
11952 :
11953 : static PyTypeObject winreg_QueryInfoKey_Type = {
11954 : PyVarObject_HEAD_INIT(NULL, 0)
11955 : .tp_name = "winreg.QueryInfoKey",
11956 : .tp_getset = py_winreg_QueryInfoKey_getsetters,
11957 : .tp_methods = py_winreg_QueryInfoKey_methods,
11958 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
11959 : .tp_new = py_winreg_QueryInfoKey_new,
11960 : };
11961 :
11962 1 : static bool pack_py_winreg_QueryInfoKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryInfoKey *r)
11963 : {
11964 : PyObject *py_handle;
11965 : PyObject *py_classname;
11966 1 : const char *kwnames[] = {
11967 : "handle", "classname", NULL
11968 : };
11969 :
11970 1 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_QueryInfoKey", discard_const_p(char *, kwnames), &py_handle, &py_classname)) {
11971 0 : return false;
11972 : }
11973 :
11974 1 : if (py_handle == NULL) {
11975 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
11976 0 : return false;
11977 : }
11978 1 : r->in.handle = talloc_ptrtype(r, r->in.handle);
11979 1 : if (r->in.handle == NULL) {
11980 0 : PyErr_NoMemory();
11981 0 : return false;
11982 : }
11983 1 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
11984 1 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
11985 0 : PyErr_NoMemory();
11986 0 : return false;
11987 : }
11988 1 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
11989 1 : if (py_classname == NULL) {
11990 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.classname");
11991 0 : return false;
11992 : }
11993 1 : r->in.classname = talloc_ptrtype(r, r->in.classname);
11994 1 : if (r->in.classname == NULL) {
11995 0 : PyErr_NoMemory();
11996 0 : return false;
11997 : }
11998 1 : PY_CHECK_TYPE(&winreg_String_Type, py_classname, return false;);
11999 1 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_classname)) == NULL) {
12000 0 : PyErr_NoMemory();
12001 0 : return false;
12002 : }
12003 1 : r->in.classname = (struct winreg_String *)pytalloc_get_ptr(py_classname);
12004 1 : return true;
12005 : }
12006 :
12007 1 : static PyObject *unpack_py_winreg_QueryInfoKey_args_out(struct winreg_QueryInfoKey *r)
12008 : {
12009 : PyObject *result;
12010 : PyObject *py_classname;
12011 : PyObject *py_num_subkeys;
12012 : PyObject *py_max_subkeylen;
12013 : PyObject *py_max_classlen;
12014 : PyObject *py_num_values;
12015 : PyObject *py_max_valnamelen;
12016 : PyObject *py_max_valbufsize;
12017 : PyObject *py_secdescsize;
12018 : PyObject *py_last_changed_time;
12019 1 : result = PyTuple_New(9);
12020 1 : py_classname = pytalloc_reference_ex(&winreg_String_Type, r->out.classname, r->out.classname);
12021 1 : PyTuple_SetItem(result, 0, py_classname);
12022 1 : py_num_subkeys = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.num_subkeys));
12023 1 : PyTuple_SetItem(result, 1, py_num_subkeys);
12024 1 : py_max_subkeylen = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.max_subkeylen));
12025 1 : PyTuple_SetItem(result, 2, py_max_subkeylen);
12026 1 : py_max_classlen = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.max_classlen));
12027 1 : PyTuple_SetItem(result, 3, py_max_classlen);
12028 1 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.num_values));
12029 1 : PyTuple_SetItem(result, 4, py_num_values);
12030 1 : py_max_valnamelen = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.max_valnamelen));
12031 1 : PyTuple_SetItem(result, 5, py_max_valnamelen);
12032 1 : py_max_valbufsize = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.max_valbufsize));
12033 1 : PyTuple_SetItem(result, 6, py_max_valbufsize);
12034 1 : py_secdescsize = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.secdescsize));
12035 1 : PyTuple_SetItem(result, 7, py_secdescsize);
12036 1 : py_last_changed_time = PyLong_FromUnsignedLongLong(*r->out.last_changed_time);
12037 1 : PyTuple_SetItem(result, 8, py_last_changed_time);
12038 1 : if (!W_ERROR_IS_OK(r->out.result)) {
12039 0 : PyErr_SetWERROR(r->out.result);
12040 0 : return NULL;
12041 : }
12042 :
12043 1 : return result;
12044 : }
12045 :
12046 :
12047 0 : static PyObject *py_winreg_QueryValue_in_get_handle(PyObject *obj, void *closure)
12048 : {
12049 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12050 : PyObject *py_handle;
12051 0 : if (object->in.handle == NULL) {
12052 0 : Py_RETURN_NONE;
12053 : }
12054 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
12055 0 : return py_handle;
12056 : }
12057 :
12058 0 : static int py_winreg_QueryValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
12059 : {
12060 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12061 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
12062 0 : if (value == NULL) {
12063 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
12064 0 : return -1;
12065 : }
12066 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
12067 0 : if (object->in.handle == NULL) {
12068 0 : PyErr_NoMemory();
12069 0 : return -1;
12070 : }
12071 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
12072 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
12073 0 : PyErr_NoMemory();
12074 0 : return -1;
12075 : }
12076 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
12077 0 : return 0;
12078 : }
12079 :
12080 0 : static PyObject *py_winreg_QueryValue_in_get_value_name(PyObject *obj, void *closure)
12081 : {
12082 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12083 : PyObject *py_value_name;
12084 0 : if (object->in.value_name == NULL) {
12085 0 : Py_RETURN_NONE;
12086 : }
12087 0 : py_value_name = pytalloc_reference_ex(&winreg_String_Type, object->in.value_name, object->in.value_name);
12088 0 : return py_value_name;
12089 : }
12090 :
12091 0 : static int py_winreg_QueryValue_in_set_value_name(PyObject *py_obj, PyObject *value, void *closure)
12092 : {
12093 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12094 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.value_name));
12095 0 : if (value == NULL) {
12096 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.value_name");
12097 0 : return -1;
12098 : }
12099 0 : object->in.value_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.value_name);
12100 0 : if (object->in.value_name == NULL) {
12101 0 : PyErr_NoMemory();
12102 0 : return -1;
12103 : }
12104 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
12105 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
12106 0 : PyErr_NoMemory();
12107 0 : return -1;
12108 : }
12109 0 : object->in.value_name = (struct winreg_String *)pytalloc_get_ptr(value);
12110 0 : return 0;
12111 : }
12112 :
12113 0 : static PyObject *py_winreg_QueryValue_in_get_type(PyObject *obj, void *closure)
12114 : {
12115 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12116 : PyObject *py_type;
12117 0 : if (object->in.type == NULL) {
12118 0 : Py_RETURN_NONE;
12119 : }
12120 0 : if (object->in.type == NULL) {
12121 0 : py_type = Py_None;
12122 0 : Py_INCREF(py_type);
12123 : } else {
12124 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.type));
12125 : }
12126 0 : return py_type;
12127 : }
12128 :
12129 0 : static int py_winreg_QueryValue_in_set_type(PyObject *py_obj, PyObject *value, void *closure)
12130 : {
12131 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12132 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.type));
12133 0 : if (value == NULL) {
12134 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.type");
12135 0 : return -1;
12136 : }
12137 0 : if (value == Py_None) {
12138 0 : object->in.type = NULL;
12139 : } else {
12140 0 : object->in.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.type);
12141 0 : if (object->in.type == NULL) {
12142 0 : PyErr_NoMemory();
12143 0 : return -1;
12144 : }
12145 : {
12146 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.type));
12147 0 : if (PyLong_Check(value)) {
12148 : unsigned long long test_var;
12149 0 : test_var = PyLong_AsUnsignedLongLong(value);
12150 0 : if (PyErr_Occurred() != NULL) {
12151 0 : return -1;
12152 : }
12153 0 : if (test_var > uint_max) {
12154 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12155 : PyLong_Type.tp_name, uint_max, test_var);
12156 0 : return -1;
12157 : }
12158 0 : *object->in.type = test_var;
12159 : } else {
12160 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12161 : PyLong_Type.tp_name);
12162 0 : return -1;
12163 : }
12164 : }
12165 : }
12166 0 : return 0;
12167 : }
12168 :
12169 0 : static PyObject *py_winreg_QueryValue_out_get_type(PyObject *obj, void *closure)
12170 : {
12171 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12172 : PyObject *py_type;
12173 0 : if (object->out.type == NULL) {
12174 0 : Py_RETURN_NONE;
12175 : }
12176 0 : if (object->out.type == NULL) {
12177 0 : py_type = Py_None;
12178 0 : Py_INCREF(py_type);
12179 : } else {
12180 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.type));
12181 : }
12182 0 : return py_type;
12183 : }
12184 :
12185 0 : static int py_winreg_QueryValue_out_set_type(PyObject *py_obj, PyObject *value, void *closure)
12186 : {
12187 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12188 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.type));
12189 0 : if (value == NULL) {
12190 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.type");
12191 0 : return -1;
12192 : }
12193 0 : if (value == Py_None) {
12194 0 : object->out.type = NULL;
12195 : } else {
12196 0 : object->out.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.type);
12197 0 : if (object->out.type == NULL) {
12198 0 : PyErr_NoMemory();
12199 0 : return -1;
12200 : }
12201 : {
12202 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.type));
12203 0 : if (PyLong_Check(value)) {
12204 : unsigned long long test_var;
12205 0 : test_var = PyLong_AsUnsignedLongLong(value);
12206 0 : if (PyErr_Occurred() != NULL) {
12207 0 : return -1;
12208 : }
12209 0 : if (test_var > uint_max) {
12210 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12211 : PyLong_Type.tp_name, uint_max, test_var);
12212 0 : return -1;
12213 : }
12214 0 : *object->out.type = test_var;
12215 : } else {
12216 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12217 : PyLong_Type.tp_name);
12218 0 : return -1;
12219 : }
12220 : }
12221 : }
12222 0 : return 0;
12223 : }
12224 :
12225 0 : static PyObject *py_winreg_QueryValue_in_get_data(PyObject *obj, void *closure)
12226 : {
12227 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12228 : PyObject *py_data;
12229 0 : if (object->in.data == NULL) {
12230 0 : Py_RETURN_NONE;
12231 : }
12232 0 : if (object->in.data == NULL) {
12233 0 : py_data = Py_None;
12234 0 : Py_INCREF(py_data);
12235 : } else {
12236 0 : py_data = PyList_New(object->in.data_length?*object->in.data_length:0);
12237 0 : if (py_data == NULL) {
12238 0 : return NULL;
12239 : }
12240 : {
12241 : int data_cntr_1;
12242 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->in.data_length?*object->in.data_length:0); data_cntr_1++) {
12243 : PyObject *py_data_1;
12244 0 : py_data_1 = PyLong_FromLong((uint16_t)((object->in.data)[data_cntr_1]));
12245 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
12246 : }
12247 : }
12248 : }
12249 0 : return py_data;
12250 : }
12251 :
12252 0 : static int py_winreg_QueryValue_in_set_data(PyObject *py_obj, PyObject *value, void *closure)
12253 : {
12254 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12255 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data));
12256 0 : if (value == NULL) {
12257 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.data");
12258 0 : return -1;
12259 : }
12260 0 : if (value == Py_None) {
12261 0 : object->in.data = NULL;
12262 : } else {
12263 0 : object->in.data = NULL;
12264 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
12265 : {
12266 : int data_cntr_1;
12267 0 : object->in.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data, PyList_GET_SIZE(value));
12268 0 : if (!object->in.data) { return -1; }
12269 0 : talloc_set_name_const(object->in.data, "ARRAY: object->in.data");
12270 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
12271 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
12272 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.data)[data_cntr_1]");
12273 0 : return -1;
12274 : }
12275 : {
12276 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->in.data)[data_cntr_1]));
12277 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
12278 : unsigned long long test_var;
12279 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
12280 0 : if (PyErr_Occurred() != NULL) {
12281 0 : return -1;
12282 : }
12283 0 : if (test_var > uint_max) {
12284 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12285 : PyLong_Type.tp_name, uint_max, test_var);
12286 0 : return -1;
12287 : }
12288 0 : (object->in.data)[data_cntr_1] = test_var;
12289 : } else {
12290 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12291 : PyLong_Type.tp_name);
12292 0 : return -1;
12293 : }
12294 : }
12295 : }
12296 : }
12297 : }
12298 0 : return 0;
12299 : }
12300 :
12301 0 : static PyObject *py_winreg_QueryValue_out_get_data(PyObject *obj, void *closure)
12302 : {
12303 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12304 : PyObject *py_data;
12305 0 : if (object->out.data == NULL) {
12306 0 : Py_RETURN_NONE;
12307 : }
12308 0 : if (object->out.data == NULL) {
12309 0 : py_data = Py_None;
12310 0 : Py_INCREF(py_data);
12311 : } else {
12312 0 : py_data = PyList_New(object->out.data_length?*object->out.data_length:0);
12313 0 : if (py_data == NULL) {
12314 0 : return NULL;
12315 : }
12316 : {
12317 : int data_cntr_1;
12318 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->out.data_length?*object->out.data_length:0); data_cntr_1++) {
12319 : PyObject *py_data_1;
12320 0 : py_data_1 = PyLong_FromLong((uint16_t)((object->out.data)[data_cntr_1]));
12321 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
12322 : }
12323 : }
12324 : }
12325 0 : return py_data;
12326 : }
12327 :
12328 0 : static int py_winreg_QueryValue_out_set_data(PyObject *py_obj, PyObject *value, void *closure)
12329 : {
12330 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12331 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.data));
12332 0 : if (value == NULL) {
12333 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.data");
12334 0 : return -1;
12335 : }
12336 0 : if (value == Py_None) {
12337 0 : object->out.data = NULL;
12338 : } else {
12339 0 : object->out.data = NULL;
12340 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
12341 : {
12342 : int data_cntr_1;
12343 0 : object->out.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data, PyList_GET_SIZE(value));
12344 0 : if (!object->out.data) { return -1; }
12345 0 : talloc_set_name_const(object->out.data, "ARRAY: object->out.data");
12346 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
12347 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
12348 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->out.data)[data_cntr_1]");
12349 0 : return -1;
12350 : }
12351 : {
12352 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->out.data)[data_cntr_1]));
12353 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
12354 : unsigned long long test_var;
12355 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
12356 0 : if (PyErr_Occurred() != NULL) {
12357 0 : return -1;
12358 : }
12359 0 : if (test_var > uint_max) {
12360 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12361 : PyLong_Type.tp_name, uint_max, test_var);
12362 0 : return -1;
12363 : }
12364 0 : (object->out.data)[data_cntr_1] = test_var;
12365 : } else {
12366 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12367 : PyLong_Type.tp_name);
12368 0 : return -1;
12369 : }
12370 : }
12371 : }
12372 : }
12373 : }
12374 0 : return 0;
12375 : }
12376 :
12377 0 : static PyObject *py_winreg_QueryValue_in_get_data_size(PyObject *obj, void *closure)
12378 : {
12379 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12380 : PyObject *py_data_size;
12381 0 : if (object->in.data_size == NULL) {
12382 0 : Py_RETURN_NONE;
12383 : }
12384 0 : if (object->in.data_size == NULL) {
12385 0 : py_data_size = Py_None;
12386 0 : Py_INCREF(py_data_size);
12387 : } else {
12388 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.data_size));
12389 : }
12390 0 : return py_data_size;
12391 : }
12392 :
12393 0 : static int py_winreg_QueryValue_in_set_data_size(PyObject *py_obj, PyObject *value, void *closure)
12394 : {
12395 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12396 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data_size));
12397 0 : if (value == NULL) {
12398 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.data_size");
12399 0 : return -1;
12400 : }
12401 0 : if (value == Py_None) {
12402 0 : object->in.data_size = NULL;
12403 : } else {
12404 0 : object->in.data_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data_size);
12405 0 : if (object->in.data_size == NULL) {
12406 0 : PyErr_NoMemory();
12407 0 : return -1;
12408 : }
12409 : {
12410 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.data_size));
12411 0 : if (PyLong_Check(value)) {
12412 : unsigned long long test_var;
12413 0 : test_var = PyLong_AsUnsignedLongLong(value);
12414 0 : if (PyErr_Occurred() != NULL) {
12415 0 : return -1;
12416 : }
12417 0 : if (test_var > uint_max) {
12418 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12419 : PyLong_Type.tp_name, uint_max, test_var);
12420 0 : return -1;
12421 : }
12422 0 : *object->in.data_size = test_var;
12423 : } else {
12424 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12425 : PyLong_Type.tp_name);
12426 0 : return -1;
12427 : }
12428 : }
12429 : }
12430 0 : return 0;
12431 : }
12432 :
12433 0 : static PyObject *py_winreg_QueryValue_out_get_data_size(PyObject *obj, void *closure)
12434 : {
12435 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12436 : PyObject *py_data_size;
12437 0 : if (object->out.data_size == NULL) {
12438 0 : Py_RETURN_NONE;
12439 : }
12440 0 : if (object->out.data_size == NULL) {
12441 0 : py_data_size = Py_None;
12442 0 : Py_INCREF(py_data_size);
12443 : } else {
12444 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.data_size));
12445 : }
12446 0 : return py_data_size;
12447 : }
12448 :
12449 0 : static int py_winreg_QueryValue_out_set_data_size(PyObject *py_obj, PyObject *value, void *closure)
12450 : {
12451 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12452 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.data_size));
12453 0 : if (value == NULL) {
12454 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.data_size");
12455 0 : return -1;
12456 : }
12457 0 : if (value == Py_None) {
12458 0 : object->out.data_size = NULL;
12459 : } else {
12460 0 : object->out.data_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data_size);
12461 0 : if (object->out.data_size == NULL) {
12462 0 : PyErr_NoMemory();
12463 0 : return -1;
12464 : }
12465 : {
12466 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.data_size));
12467 0 : if (PyLong_Check(value)) {
12468 : unsigned long long test_var;
12469 0 : test_var = PyLong_AsUnsignedLongLong(value);
12470 0 : if (PyErr_Occurred() != NULL) {
12471 0 : return -1;
12472 : }
12473 0 : if (test_var > uint_max) {
12474 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12475 : PyLong_Type.tp_name, uint_max, test_var);
12476 0 : return -1;
12477 : }
12478 0 : *object->out.data_size = test_var;
12479 : } else {
12480 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12481 : PyLong_Type.tp_name);
12482 0 : return -1;
12483 : }
12484 : }
12485 : }
12486 0 : return 0;
12487 : }
12488 :
12489 0 : static PyObject *py_winreg_QueryValue_in_get_data_length(PyObject *obj, void *closure)
12490 : {
12491 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12492 : PyObject *py_data_length;
12493 0 : if (object->in.data_length == NULL) {
12494 0 : Py_RETURN_NONE;
12495 : }
12496 0 : if (object->in.data_length == NULL) {
12497 0 : py_data_length = Py_None;
12498 0 : Py_INCREF(py_data_length);
12499 : } else {
12500 0 : py_data_length = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.data_length));
12501 : }
12502 0 : return py_data_length;
12503 : }
12504 :
12505 0 : static int py_winreg_QueryValue_in_set_data_length(PyObject *py_obj, PyObject *value, void *closure)
12506 : {
12507 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12508 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data_length));
12509 0 : if (value == NULL) {
12510 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.data_length");
12511 0 : return -1;
12512 : }
12513 0 : if (value == Py_None) {
12514 0 : object->in.data_length = NULL;
12515 : } else {
12516 0 : object->in.data_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data_length);
12517 0 : if (object->in.data_length == NULL) {
12518 0 : PyErr_NoMemory();
12519 0 : return -1;
12520 : }
12521 : {
12522 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.data_length));
12523 0 : if (PyLong_Check(value)) {
12524 : unsigned long long test_var;
12525 0 : test_var = PyLong_AsUnsignedLongLong(value);
12526 0 : if (PyErr_Occurred() != NULL) {
12527 0 : return -1;
12528 : }
12529 0 : if (test_var > uint_max) {
12530 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12531 : PyLong_Type.tp_name, uint_max, test_var);
12532 0 : return -1;
12533 : }
12534 0 : *object->in.data_length = test_var;
12535 : } else {
12536 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12537 : PyLong_Type.tp_name);
12538 0 : return -1;
12539 : }
12540 : }
12541 : }
12542 0 : return 0;
12543 : }
12544 :
12545 0 : static PyObject *py_winreg_QueryValue_out_get_data_length(PyObject *obj, void *closure)
12546 : {
12547 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12548 : PyObject *py_data_length;
12549 0 : if (object->out.data_length == NULL) {
12550 0 : Py_RETURN_NONE;
12551 : }
12552 0 : if (object->out.data_length == NULL) {
12553 0 : py_data_length = Py_None;
12554 0 : Py_INCREF(py_data_length);
12555 : } else {
12556 0 : py_data_length = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.data_length));
12557 : }
12558 0 : return py_data_length;
12559 : }
12560 :
12561 0 : static int py_winreg_QueryValue_out_set_data_length(PyObject *py_obj, PyObject *value, void *closure)
12562 : {
12563 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12564 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.data_length));
12565 0 : if (value == NULL) {
12566 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.data_length");
12567 0 : return -1;
12568 : }
12569 0 : if (value == Py_None) {
12570 0 : object->out.data_length = NULL;
12571 : } else {
12572 0 : object->out.data_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data_length);
12573 0 : if (object->out.data_length == NULL) {
12574 0 : PyErr_NoMemory();
12575 0 : return -1;
12576 : }
12577 : {
12578 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.data_length));
12579 0 : if (PyLong_Check(value)) {
12580 : unsigned long long test_var;
12581 0 : test_var = PyLong_AsUnsignedLongLong(value);
12582 0 : if (PyErr_Occurred() != NULL) {
12583 0 : return -1;
12584 : }
12585 0 : if (test_var > uint_max) {
12586 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12587 : PyLong_Type.tp_name, uint_max, test_var);
12588 0 : return -1;
12589 : }
12590 0 : *object->out.data_length = test_var;
12591 : } else {
12592 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12593 : PyLong_Type.tp_name);
12594 0 : return -1;
12595 : }
12596 : }
12597 : }
12598 0 : return 0;
12599 : }
12600 :
12601 0 : static PyObject *py_winreg_QueryValue_get_result(PyObject *obj, void *closure)
12602 : {
12603 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(obj);
12604 : PyObject *py_result;
12605 0 : py_result = PyErr_FromWERROR(object->out.result);
12606 0 : return py_result;
12607 : }
12608 :
12609 0 : static int py_winreg_QueryValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
12610 : {
12611 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12612 0 : if (value == NULL) {
12613 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
12614 0 : return -1;
12615 : }
12616 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
12617 0 : return 0;
12618 : }
12619 :
12620 : static PyGetSetDef py_winreg_QueryValue_getsetters[] = {
12621 : {
12622 : .name = discard_const_p(char, "in_handle"),
12623 : .get = py_winreg_QueryValue_in_get_handle,
12624 : .set = py_winreg_QueryValue_in_set_handle,
12625 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
12626 : },
12627 : {
12628 : .name = discard_const_p(char, "in_value_name"),
12629 : .get = py_winreg_QueryValue_in_get_value_name,
12630 : .set = py_winreg_QueryValue_in_set_value_name,
12631 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
12632 : },
12633 : {
12634 : .name = discard_const_p(char, "in_type"),
12635 : .get = py_winreg_QueryValue_in_get_type,
12636 : .set = py_winreg_QueryValue_in_set_type,
12637 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
12638 : },
12639 : {
12640 : .name = discard_const_p(char, "out_type"),
12641 : .get = py_winreg_QueryValue_out_get_type,
12642 : .set = py_winreg_QueryValue_out_set_type,
12643 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
12644 : },
12645 : {
12646 : .name = discard_const_p(char, "in_data"),
12647 : .get = py_winreg_QueryValue_in_get_data,
12648 : .set = py_winreg_QueryValue_in_set_data,
12649 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
12650 : },
12651 : {
12652 : .name = discard_const_p(char, "out_data"),
12653 : .get = py_winreg_QueryValue_out_get_data,
12654 : .set = py_winreg_QueryValue_out_set_data,
12655 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
12656 : },
12657 : {
12658 : .name = discard_const_p(char, "in_data_size"),
12659 : .get = py_winreg_QueryValue_in_get_data_size,
12660 : .set = py_winreg_QueryValue_in_set_data_size,
12661 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12662 : },
12663 : {
12664 : .name = discard_const_p(char, "out_data_size"),
12665 : .get = py_winreg_QueryValue_out_get_data_size,
12666 : .set = py_winreg_QueryValue_out_set_data_size,
12667 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12668 : },
12669 : {
12670 : .name = discard_const_p(char, "in_data_length"),
12671 : .get = py_winreg_QueryValue_in_get_data_length,
12672 : .set = py_winreg_QueryValue_in_set_data_length,
12673 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12674 : },
12675 : {
12676 : .name = discard_const_p(char, "out_data_length"),
12677 : .get = py_winreg_QueryValue_out_get_data_length,
12678 : .set = py_winreg_QueryValue_out_set_data_length,
12679 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12680 : },
12681 : {
12682 : .name = discard_const_p(char, "result"),
12683 : .get = py_winreg_QueryValue_get_result,
12684 : .set = py_winreg_QueryValue_set_result,
12685 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
12686 : },
12687 : { .name = NULL }
12688 : };
12689 :
12690 0 : static PyObject *py_winreg_QueryValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
12691 : {
12692 0 : PyObject *self = pytalloc_new(struct winreg_QueryValue, type);
12693 0 : struct winreg_QueryValue *_self = (struct winreg_QueryValue *)pytalloc_get_ptr(self);
12694 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
12695 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
12696 0 : _self->in.value_name = talloc_zero(mem_ctx, struct winreg_String);
12697 0 : return self;
12698 : }
12699 :
12700 0 : static PyObject *py_winreg_QueryValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
12701 : {
12702 :
12703 :
12704 0 : return PyLong_FromLong(17);
12705 : }
12706 :
12707 0 : static PyObject *py_winreg_QueryValue_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
12708 : {
12709 0 : const struct ndr_interface_call *call = NULL;
12710 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12711 0 : PyObject *ret = NULL;
12712 0 : struct ndr_push *push = NULL;
12713 : DATA_BLOB blob;
12714 : enum ndr_err_code err;
12715 :
12716 0 : if (ndr_table_winreg.num_calls < 18) {
12717 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryValue_ndr_pack");
12718 0 : return NULL;
12719 : }
12720 0 : call = &ndr_table_winreg.calls[17];
12721 :
12722 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
12723 0 : if (push == NULL) {
12724 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
12725 0 : return NULL;
12726 : }
12727 :
12728 0 : push->flags |= ndr_push_flags;
12729 :
12730 0 : err = call->ndr_push(push, ndr_inout_flags, object);
12731 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
12732 0 : TALLOC_FREE(push);
12733 0 : PyErr_SetNdrError(err);
12734 0 : return NULL;
12735 : }
12736 0 : blob = ndr_push_blob(push);
12737 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
12738 0 : TALLOC_FREE(push);
12739 0 : return ret;
12740 : }
12741 :
12742 0 : static PyObject *py_winreg_QueryValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12743 : {
12744 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
12745 0 : PyObject *bigendian_obj = NULL;
12746 0 : PyObject *ndr64_obj = NULL;
12747 0 : libndr_flags ndr_push_flags = 0;
12748 :
12749 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
12750 : discard_const_p(char *, kwnames),
12751 : &bigendian_obj,
12752 : &ndr64_obj)) {
12753 0 : return NULL;
12754 : }
12755 :
12756 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12757 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
12758 : }
12759 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12760 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
12761 : }
12762 :
12763 0 : return py_winreg_QueryValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
12764 : }
12765 :
12766 0 : static PyObject *py_winreg_QueryValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12767 : {
12768 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
12769 0 : PyObject *bigendian_obj = NULL;
12770 0 : PyObject *ndr64_obj = NULL;
12771 0 : libndr_flags ndr_push_flags = 0;
12772 :
12773 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
12774 : discard_const_p(char *, kwnames),
12775 : &bigendian_obj,
12776 : &ndr64_obj)) {
12777 0 : return NULL;
12778 : }
12779 :
12780 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12781 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
12782 : }
12783 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12784 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
12785 : }
12786 :
12787 0 : return py_winreg_QueryValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
12788 : }
12789 :
12790 0 : static PyObject *py_winreg_QueryValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
12791 : {
12792 0 : const struct ndr_interface_call *call = NULL;
12793 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12794 0 : struct ndr_pull *pull = NULL;
12795 : enum ndr_err_code err;
12796 :
12797 0 : if (ndr_table_winreg.num_calls < 18) {
12798 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryValue_ndr_unpack");
12799 0 : return NULL;
12800 : }
12801 0 : call = &ndr_table_winreg.calls[17];
12802 :
12803 0 : pull = ndr_pull_init_blob(blob, object);
12804 0 : if (pull == NULL) {
12805 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
12806 0 : return NULL;
12807 : }
12808 :
12809 0 : pull->flags |= ndr_pull_flags;
12810 :
12811 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
12812 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
12813 0 : TALLOC_FREE(pull);
12814 0 : PyErr_SetNdrError(err);
12815 0 : return NULL;
12816 : }
12817 0 : if (!allow_remaining) {
12818 : uint32_t highest_ofs;
12819 :
12820 0 : if (pull->offset > pull->relative_highest_offset) {
12821 0 : highest_ofs = pull->offset;
12822 : } else {
12823 0 : highest_ofs = pull->relative_highest_offset;
12824 : }
12825 0 : if (highest_ofs < pull->data_size) {
12826 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
12827 : "not all bytes consumed ofs[%u] size[%u]",
12828 : highest_ofs, pull->data_size);
12829 0 : TALLOC_FREE(pull);
12830 0 : PyErr_SetNdrError(err);
12831 0 : return NULL;
12832 : }
12833 : }
12834 :
12835 0 : TALLOC_FREE(pull);
12836 0 : Py_RETURN_NONE;
12837 : }
12838 :
12839 0 : static PyObject *py_winreg_QueryValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12840 : {
12841 : DATA_BLOB blob;
12842 0 : Py_ssize_t blob_length = 0;
12843 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
12844 0 : PyObject *bigendian_obj = NULL;
12845 0 : PyObject *ndr64_obj = NULL;
12846 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
12847 0 : PyObject *allow_remaining_obj = NULL;
12848 0 : bool allow_remaining = false;
12849 :
12850 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
12851 : discard_const_p(char *, kwnames),
12852 : &blob.data, &blob_length,
12853 : &bigendian_obj,
12854 : &ndr64_obj,
12855 : &allow_remaining_obj)) {
12856 0 : return NULL;
12857 : }
12858 0 : blob.length = blob_length;
12859 :
12860 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12861 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
12862 : }
12863 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12864 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
12865 : }
12866 :
12867 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
12868 0 : allow_remaining = true;
12869 : }
12870 :
12871 0 : return py_winreg_QueryValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
12872 : }
12873 :
12874 0 : static PyObject *py_winreg_QueryValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12875 : {
12876 : DATA_BLOB blob;
12877 0 : Py_ssize_t blob_length = 0;
12878 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
12879 0 : PyObject *bigendian_obj = NULL;
12880 0 : PyObject *ndr64_obj = NULL;
12881 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
12882 0 : PyObject *allow_remaining_obj = NULL;
12883 0 : bool allow_remaining = false;
12884 :
12885 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
12886 : discard_const_p(char *, kwnames),
12887 : &blob.data, &blob_length,
12888 : &bigendian_obj,
12889 : &ndr64_obj,
12890 : &allow_remaining_obj)) {
12891 0 : return NULL;
12892 : }
12893 0 : blob.length = blob_length;
12894 :
12895 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12896 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
12897 : }
12898 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12899 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
12900 : }
12901 :
12902 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
12903 0 : allow_remaining = true;
12904 : }
12905 :
12906 0 : return py_winreg_QueryValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
12907 : }
12908 :
12909 0 : static PyObject *py_winreg_QueryValue_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
12910 : {
12911 0 : const struct ndr_interface_call *call = NULL;
12912 0 : struct winreg_QueryValue *object = pytalloc_get_ptr(py_obj);
12913 : PyObject *ret;
12914 : char *retstr;
12915 :
12916 0 : if (ndr_table_winreg.num_calls < 18) {
12917 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryValue_ndr_print");
12918 0 : return NULL;
12919 : }
12920 0 : call = &ndr_table_winreg.calls[17];
12921 :
12922 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
12923 0 : ret = PyUnicode_FromString(retstr);
12924 0 : TALLOC_FREE(retstr);
12925 :
12926 0 : return ret;
12927 : }
12928 :
12929 0 : static PyObject *py_winreg_QueryValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
12930 : {
12931 0 : return py_winreg_QueryValue_ndr_print(py_obj, "winreg_QueryValue_in", NDR_IN);
12932 : }
12933 :
12934 0 : static PyObject *py_winreg_QueryValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
12935 : {
12936 0 : return py_winreg_QueryValue_ndr_print(py_obj, "winreg_QueryValue_out", NDR_OUT);
12937 : }
12938 :
12939 : static PyMethodDef py_winreg_QueryValue_methods[] = {
12940 : { "opnum", (PyCFunction)py_winreg_QueryValue_ndr_opnum, METH_NOARGS|METH_CLASS,
12941 : "winreg.QueryValue.opnum() -> 17 (0x11) " },
12942 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
12943 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
12944 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
12945 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
12946 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
12947 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
12948 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
12949 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
12950 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
12951 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
12952 : { NULL, NULL, 0, NULL }
12953 : };
12954 :
12955 :
12956 : static PyTypeObject winreg_QueryValue_Type = {
12957 : PyVarObject_HEAD_INIT(NULL, 0)
12958 : .tp_name = "winreg.QueryValue",
12959 : .tp_getset = py_winreg_QueryValue_getsetters,
12960 : .tp_methods = py_winreg_QueryValue_methods,
12961 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
12962 : .tp_new = py_winreg_QueryValue_new,
12963 : };
12964 :
12965 0 : static bool pack_py_winreg_QueryValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryValue *r)
12966 : {
12967 : PyObject *py_handle;
12968 : PyObject *py_value_name;
12969 : PyObject *py_type;
12970 : PyObject *py_data;
12971 : PyObject *py_data_size;
12972 : PyObject *py_data_length;
12973 0 : const char *kwnames[] = {
12974 : "handle", "value_name", "type", "data", "data_size", "data_length", NULL
12975 : };
12976 :
12977 0 : 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)) {
12978 0 : return false;
12979 : }
12980 :
12981 0 : if (py_handle == NULL) {
12982 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
12983 0 : return false;
12984 : }
12985 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
12986 0 : if (r->in.handle == NULL) {
12987 0 : PyErr_NoMemory();
12988 0 : return false;
12989 : }
12990 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
12991 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
12992 0 : PyErr_NoMemory();
12993 0 : return false;
12994 : }
12995 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
12996 0 : if (py_value_name == NULL) {
12997 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.value_name");
12998 0 : return false;
12999 : }
13000 0 : r->in.value_name = talloc_ptrtype(r, r->in.value_name);
13001 0 : if (r->in.value_name == NULL) {
13002 0 : PyErr_NoMemory();
13003 0 : return false;
13004 : }
13005 0 : PY_CHECK_TYPE(&winreg_String_Type, py_value_name, return false;);
13006 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_value_name)) == NULL) {
13007 0 : PyErr_NoMemory();
13008 0 : return false;
13009 : }
13010 0 : r->in.value_name = (struct winreg_String *)pytalloc_get_ptr(py_value_name);
13011 0 : if (py_type == NULL) {
13012 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.type");
13013 0 : return false;
13014 : }
13015 0 : if (py_type == Py_None) {
13016 0 : r->in.type = NULL;
13017 : } else {
13018 0 : r->in.type = talloc_ptrtype(r, r->in.type);
13019 0 : if (r->in.type == NULL) {
13020 0 : PyErr_NoMemory();
13021 0 : return false;
13022 : }
13023 : {
13024 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.type));
13025 0 : if (PyLong_Check(py_type)) {
13026 : unsigned long long test_var;
13027 0 : test_var = PyLong_AsUnsignedLongLong(py_type);
13028 0 : if (PyErr_Occurred() != NULL) {
13029 0 : return false;
13030 : }
13031 0 : if (test_var > uint_max) {
13032 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13033 : PyLong_Type.tp_name, uint_max, test_var);
13034 0 : return false;
13035 : }
13036 0 : *r->in.type = test_var;
13037 : } else {
13038 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13039 : PyLong_Type.tp_name);
13040 0 : return false;
13041 : }
13042 : }
13043 : }
13044 0 : if (py_data == NULL) {
13045 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.data");
13046 0 : return false;
13047 : }
13048 0 : if (py_data == Py_None) {
13049 0 : r->in.data = NULL;
13050 : } else {
13051 0 : r->in.data = NULL;
13052 0 : PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
13053 : {
13054 : int data_cntr_1;
13055 0 : r->in.data = talloc_array_ptrtype(r, r->in.data, PyList_GET_SIZE(py_data));
13056 0 : if (!r->in.data) { return false; }
13057 0 : talloc_set_name_const(r->in.data, "ARRAY: r->in.data");
13058 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(py_data); data_cntr_1++) {
13059 0 : if (PyList_GET_ITEM(py_data, data_cntr_1) == NULL) {
13060 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.data)[data_cntr_1]");
13061 0 : return false;
13062 : }
13063 : {
13064 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((r->in.data)[data_cntr_1]));
13065 0 : if (PyLong_Check(PyList_GET_ITEM(py_data, data_cntr_1))) {
13066 : unsigned long long test_var;
13067 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_data, data_cntr_1));
13068 0 : if (PyErr_Occurred() != NULL) {
13069 0 : return false;
13070 : }
13071 0 : if (test_var > uint_max) {
13072 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13073 : PyLong_Type.tp_name, uint_max, test_var);
13074 0 : return false;
13075 : }
13076 0 : (r->in.data)[data_cntr_1] = test_var;
13077 : } else {
13078 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13079 : PyLong_Type.tp_name);
13080 0 : return false;
13081 : }
13082 : }
13083 : }
13084 : }
13085 : }
13086 0 : if (py_data_size == NULL) {
13087 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.data_size");
13088 0 : return false;
13089 : }
13090 0 : if (py_data_size == Py_None) {
13091 0 : r->in.data_size = NULL;
13092 : } else {
13093 0 : r->in.data_size = talloc_ptrtype(r, r->in.data_size);
13094 0 : if (r->in.data_size == NULL) {
13095 0 : PyErr_NoMemory();
13096 0 : return false;
13097 : }
13098 : {
13099 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.data_size));
13100 0 : if (PyLong_Check(py_data_size)) {
13101 : unsigned long long test_var;
13102 0 : test_var = PyLong_AsUnsignedLongLong(py_data_size);
13103 0 : if (PyErr_Occurred() != NULL) {
13104 0 : return false;
13105 : }
13106 0 : if (test_var > uint_max) {
13107 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13108 : PyLong_Type.tp_name, uint_max, test_var);
13109 0 : return false;
13110 : }
13111 0 : *r->in.data_size = test_var;
13112 : } else {
13113 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13114 : PyLong_Type.tp_name);
13115 0 : return false;
13116 : }
13117 : }
13118 : }
13119 0 : if (py_data_length == NULL) {
13120 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.data_length");
13121 0 : return false;
13122 : }
13123 0 : if (py_data_length == Py_None) {
13124 0 : r->in.data_length = NULL;
13125 : } else {
13126 0 : r->in.data_length = talloc_ptrtype(r, r->in.data_length);
13127 0 : if (r->in.data_length == NULL) {
13128 0 : PyErr_NoMemory();
13129 0 : return false;
13130 : }
13131 : {
13132 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.data_length));
13133 0 : if (PyLong_Check(py_data_length)) {
13134 : unsigned long long test_var;
13135 0 : test_var = PyLong_AsUnsignedLongLong(py_data_length);
13136 0 : if (PyErr_Occurred() != NULL) {
13137 0 : return false;
13138 : }
13139 0 : if (test_var > uint_max) {
13140 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13141 : PyLong_Type.tp_name, uint_max, test_var);
13142 0 : return false;
13143 : }
13144 0 : *r->in.data_length = test_var;
13145 : } else {
13146 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13147 : PyLong_Type.tp_name);
13148 0 : return false;
13149 : }
13150 : }
13151 : }
13152 0 : return true;
13153 : }
13154 :
13155 0 : static PyObject *unpack_py_winreg_QueryValue_args_out(struct winreg_QueryValue *r)
13156 : {
13157 : PyObject *result;
13158 : PyObject *py_type;
13159 : PyObject *py_data;
13160 : PyObject *py_data_size;
13161 : PyObject *py_data_length;
13162 0 : result = PyTuple_New(4);
13163 0 : if (r->out.type == NULL) {
13164 0 : py_type = Py_None;
13165 0 : Py_INCREF(py_type);
13166 : } else {
13167 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.type));
13168 : }
13169 0 : PyTuple_SetItem(result, 0, py_type);
13170 0 : if (r->out.data == NULL) {
13171 0 : py_data = Py_None;
13172 0 : Py_INCREF(py_data);
13173 : } else {
13174 0 : py_data = PyList_New(r->out.data_length?*r->out.data_length:0);
13175 0 : if (py_data == NULL) {
13176 0 : return NULL;
13177 : }
13178 : {
13179 : int data_cntr_1;
13180 0 : for (data_cntr_1 = 0; data_cntr_1 < (r->out.data_length?*r->out.data_length:0); data_cntr_1++) {
13181 : PyObject *py_data_1;
13182 0 : py_data_1 = PyLong_FromLong((uint16_t)((r->out.data)[data_cntr_1]));
13183 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
13184 : }
13185 : }
13186 : }
13187 0 : PyTuple_SetItem(result, 1, py_data);
13188 0 : if (r->out.data_size == NULL) {
13189 0 : py_data_size = Py_None;
13190 0 : Py_INCREF(py_data_size);
13191 : } else {
13192 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.data_size));
13193 : }
13194 0 : PyTuple_SetItem(result, 2, py_data_size);
13195 0 : if (r->out.data_length == NULL) {
13196 0 : py_data_length = Py_None;
13197 0 : Py_INCREF(py_data_length);
13198 : } else {
13199 0 : py_data_length = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.data_length));
13200 : }
13201 0 : PyTuple_SetItem(result, 3, py_data_length);
13202 0 : if (!W_ERROR_IS_OK(r->out.result)) {
13203 0 : PyErr_SetWERROR(r->out.result);
13204 0 : return NULL;
13205 : }
13206 :
13207 0 : return result;
13208 : }
13209 :
13210 :
13211 0 : static PyObject *py_winreg_ReplaceKey_in_get_handle(PyObject *obj, void *closure)
13212 : {
13213 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(obj);
13214 : PyObject *py_handle;
13215 0 : if (object->in.handle == NULL) {
13216 0 : Py_RETURN_NONE;
13217 : }
13218 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
13219 0 : return py_handle;
13220 : }
13221 :
13222 0 : static int py_winreg_ReplaceKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
13223 : {
13224 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13225 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
13226 0 : if (value == NULL) {
13227 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
13228 0 : return -1;
13229 : }
13230 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
13231 0 : if (object->in.handle == NULL) {
13232 0 : PyErr_NoMemory();
13233 0 : return -1;
13234 : }
13235 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
13236 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13237 0 : PyErr_NoMemory();
13238 0 : return -1;
13239 : }
13240 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
13241 0 : return 0;
13242 : }
13243 :
13244 0 : static PyObject *py_winreg_ReplaceKey_in_get_subkey(PyObject *obj, void *closure)
13245 : {
13246 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(obj);
13247 : PyObject *py_subkey;
13248 0 : if (object->in.subkey == NULL) {
13249 0 : Py_RETURN_NONE;
13250 : }
13251 0 : py_subkey = pytalloc_reference_ex(&winreg_String_Type, object->in.subkey, object->in.subkey);
13252 0 : return py_subkey;
13253 : }
13254 :
13255 0 : static int py_winreg_ReplaceKey_in_set_subkey(PyObject *py_obj, PyObject *value, void *closure)
13256 : {
13257 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13258 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.subkey));
13259 0 : if (value == NULL) {
13260 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.subkey");
13261 0 : return -1;
13262 : }
13263 0 : object->in.subkey = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.subkey);
13264 0 : if (object->in.subkey == NULL) {
13265 0 : PyErr_NoMemory();
13266 0 : return -1;
13267 : }
13268 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13269 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13270 0 : PyErr_NoMemory();
13271 0 : return -1;
13272 : }
13273 0 : object->in.subkey = (struct winreg_String *)pytalloc_get_ptr(value);
13274 0 : return 0;
13275 : }
13276 :
13277 0 : static PyObject *py_winreg_ReplaceKey_in_get_new_file(PyObject *obj, void *closure)
13278 : {
13279 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(obj);
13280 : PyObject *py_new_file;
13281 0 : if (object->in.new_file == NULL) {
13282 0 : Py_RETURN_NONE;
13283 : }
13284 0 : py_new_file = pytalloc_reference_ex(&winreg_String_Type, object->in.new_file, object->in.new_file);
13285 0 : return py_new_file;
13286 : }
13287 :
13288 0 : static int py_winreg_ReplaceKey_in_set_new_file(PyObject *py_obj, PyObject *value, void *closure)
13289 : {
13290 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13291 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.new_file));
13292 0 : if (value == NULL) {
13293 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.new_file");
13294 0 : return -1;
13295 : }
13296 0 : object->in.new_file = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.new_file);
13297 0 : if (object->in.new_file == NULL) {
13298 0 : PyErr_NoMemory();
13299 0 : return -1;
13300 : }
13301 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13302 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13303 0 : PyErr_NoMemory();
13304 0 : return -1;
13305 : }
13306 0 : object->in.new_file = (struct winreg_String *)pytalloc_get_ptr(value);
13307 0 : return 0;
13308 : }
13309 :
13310 0 : static PyObject *py_winreg_ReplaceKey_in_get_old_file(PyObject *obj, void *closure)
13311 : {
13312 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(obj);
13313 : PyObject *py_old_file;
13314 0 : if (object->in.old_file == NULL) {
13315 0 : Py_RETURN_NONE;
13316 : }
13317 0 : py_old_file = pytalloc_reference_ex(&winreg_String_Type, object->in.old_file, object->in.old_file);
13318 0 : return py_old_file;
13319 : }
13320 :
13321 0 : static int py_winreg_ReplaceKey_in_set_old_file(PyObject *py_obj, PyObject *value, void *closure)
13322 : {
13323 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13324 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.old_file));
13325 0 : if (value == NULL) {
13326 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.old_file");
13327 0 : return -1;
13328 : }
13329 0 : object->in.old_file = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.old_file);
13330 0 : if (object->in.old_file == NULL) {
13331 0 : PyErr_NoMemory();
13332 0 : return -1;
13333 : }
13334 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13335 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13336 0 : PyErr_NoMemory();
13337 0 : return -1;
13338 : }
13339 0 : object->in.old_file = (struct winreg_String *)pytalloc_get_ptr(value);
13340 0 : return 0;
13341 : }
13342 :
13343 0 : static PyObject *py_winreg_ReplaceKey_get_result(PyObject *obj, void *closure)
13344 : {
13345 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(obj);
13346 : PyObject *py_result;
13347 0 : py_result = PyErr_FromWERROR(object->out.result);
13348 0 : return py_result;
13349 : }
13350 :
13351 0 : static int py_winreg_ReplaceKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
13352 : {
13353 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13354 0 : if (value == NULL) {
13355 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
13356 0 : return -1;
13357 : }
13358 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
13359 0 : return 0;
13360 : }
13361 :
13362 : static PyGetSetDef py_winreg_ReplaceKey_getsetters[] = {
13363 : {
13364 : .name = discard_const_p(char, "in_handle"),
13365 : .get = py_winreg_ReplaceKey_in_get_handle,
13366 : .set = py_winreg_ReplaceKey_in_set_handle,
13367 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
13368 : },
13369 : {
13370 : .name = discard_const_p(char, "in_subkey"),
13371 : .get = py_winreg_ReplaceKey_in_get_subkey,
13372 : .set = py_winreg_ReplaceKey_in_set_subkey,
13373 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13374 : },
13375 : {
13376 : .name = discard_const_p(char, "in_new_file"),
13377 : .get = py_winreg_ReplaceKey_in_get_new_file,
13378 : .set = py_winreg_ReplaceKey_in_set_new_file,
13379 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13380 : },
13381 : {
13382 : .name = discard_const_p(char, "in_old_file"),
13383 : .get = py_winreg_ReplaceKey_in_get_old_file,
13384 : .set = py_winreg_ReplaceKey_in_set_old_file,
13385 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13386 : },
13387 : {
13388 : .name = discard_const_p(char, "result"),
13389 : .get = py_winreg_ReplaceKey_get_result,
13390 : .set = py_winreg_ReplaceKey_set_result,
13391 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
13392 : },
13393 : { .name = NULL }
13394 : };
13395 :
13396 0 : static PyObject *py_winreg_ReplaceKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
13397 : {
13398 0 : PyObject *self = pytalloc_new(struct winreg_ReplaceKey, type);
13399 0 : struct winreg_ReplaceKey *_self = (struct winreg_ReplaceKey *)pytalloc_get_ptr(self);
13400 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
13401 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
13402 0 : _self->in.subkey = talloc_zero(mem_ctx, struct winreg_String);
13403 0 : _self->in.new_file = talloc_zero(mem_ctx, struct winreg_String);
13404 0 : _self->in.old_file = talloc_zero(mem_ctx, struct winreg_String);
13405 0 : return self;
13406 : }
13407 :
13408 0 : static PyObject *py_winreg_ReplaceKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
13409 : {
13410 :
13411 :
13412 0 : return PyLong_FromLong(18);
13413 : }
13414 :
13415 0 : static PyObject *py_winreg_ReplaceKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
13416 : {
13417 0 : const struct ndr_interface_call *call = NULL;
13418 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13419 0 : PyObject *ret = NULL;
13420 0 : struct ndr_push *push = NULL;
13421 : DATA_BLOB blob;
13422 : enum ndr_err_code err;
13423 :
13424 0 : if (ndr_table_winreg.num_calls < 19) {
13425 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_ReplaceKey_ndr_pack");
13426 0 : return NULL;
13427 : }
13428 0 : call = &ndr_table_winreg.calls[18];
13429 :
13430 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
13431 0 : if (push == NULL) {
13432 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
13433 0 : return NULL;
13434 : }
13435 :
13436 0 : push->flags |= ndr_push_flags;
13437 :
13438 0 : err = call->ndr_push(push, ndr_inout_flags, object);
13439 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
13440 0 : TALLOC_FREE(push);
13441 0 : PyErr_SetNdrError(err);
13442 0 : return NULL;
13443 : }
13444 0 : blob = ndr_push_blob(push);
13445 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
13446 0 : TALLOC_FREE(push);
13447 0 : return ret;
13448 : }
13449 :
13450 0 : static PyObject *py_winreg_ReplaceKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13451 : {
13452 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13453 0 : PyObject *bigendian_obj = NULL;
13454 0 : PyObject *ndr64_obj = NULL;
13455 0 : libndr_flags ndr_push_flags = 0;
13456 :
13457 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
13458 : discard_const_p(char *, kwnames),
13459 : &bigendian_obj,
13460 : &ndr64_obj)) {
13461 0 : return NULL;
13462 : }
13463 :
13464 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13465 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
13466 : }
13467 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13468 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
13469 : }
13470 :
13471 0 : return py_winreg_ReplaceKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
13472 : }
13473 :
13474 0 : static PyObject *py_winreg_ReplaceKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13475 : {
13476 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13477 0 : PyObject *bigendian_obj = NULL;
13478 0 : PyObject *ndr64_obj = NULL;
13479 0 : libndr_flags ndr_push_flags = 0;
13480 :
13481 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
13482 : discard_const_p(char *, kwnames),
13483 : &bigendian_obj,
13484 : &ndr64_obj)) {
13485 0 : return NULL;
13486 : }
13487 :
13488 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13489 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
13490 : }
13491 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13492 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
13493 : }
13494 :
13495 0 : return py_winreg_ReplaceKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
13496 : }
13497 :
13498 0 : static PyObject *py_winreg_ReplaceKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
13499 : {
13500 0 : const struct ndr_interface_call *call = NULL;
13501 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13502 0 : struct ndr_pull *pull = NULL;
13503 : enum ndr_err_code err;
13504 :
13505 0 : if (ndr_table_winreg.num_calls < 19) {
13506 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_ReplaceKey_ndr_unpack");
13507 0 : return NULL;
13508 : }
13509 0 : call = &ndr_table_winreg.calls[18];
13510 :
13511 0 : pull = ndr_pull_init_blob(blob, object);
13512 0 : if (pull == NULL) {
13513 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
13514 0 : return NULL;
13515 : }
13516 :
13517 0 : pull->flags |= ndr_pull_flags;
13518 :
13519 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
13520 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
13521 0 : TALLOC_FREE(pull);
13522 0 : PyErr_SetNdrError(err);
13523 0 : return NULL;
13524 : }
13525 0 : if (!allow_remaining) {
13526 : uint32_t highest_ofs;
13527 :
13528 0 : if (pull->offset > pull->relative_highest_offset) {
13529 0 : highest_ofs = pull->offset;
13530 : } else {
13531 0 : highest_ofs = pull->relative_highest_offset;
13532 : }
13533 0 : if (highest_ofs < pull->data_size) {
13534 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
13535 : "not all bytes consumed ofs[%u] size[%u]",
13536 : highest_ofs, pull->data_size);
13537 0 : TALLOC_FREE(pull);
13538 0 : PyErr_SetNdrError(err);
13539 0 : return NULL;
13540 : }
13541 : }
13542 :
13543 0 : TALLOC_FREE(pull);
13544 0 : Py_RETURN_NONE;
13545 : }
13546 :
13547 0 : static PyObject *py_winreg_ReplaceKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13548 : {
13549 : DATA_BLOB blob;
13550 0 : Py_ssize_t blob_length = 0;
13551 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
13552 0 : PyObject *bigendian_obj = NULL;
13553 0 : PyObject *ndr64_obj = NULL;
13554 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
13555 0 : PyObject *allow_remaining_obj = NULL;
13556 0 : bool allow_remaining = false;
13557 :
13558 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
13559 : discard_const_p(char *, kwnames),
13560 : &blob.data, &blob_length,
13561 : &bigendian_obj,
13562 : &ndr64_obj,
13563 : &allow_remaining_obj)) {
13564 0 : return NULL;
13565 : }
13566 0 : blob.length = blob_length;
13567 :
13568 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13569 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
13570 : }
13571 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13572 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
13573 : }
13574 :
13575 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
13576 0 : allow_remaining = true;
13577 : }
13578 :
13579 0 : return py_winreg_ReplaceKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
13580 : }
13581 :
13582 0 : static PyObject *py_winreg_ReplaceKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13583 : {
13584 : DATA_BLOB blob;
13585 0 : Py_ssize_t blob_length = 0;
13586 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
13587 0 : PyObject *bigendian_obj = NULL;
13588 0 : PyObject *ndr64_obj = NULL;
13589 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
13590 0 : PyObject *allow_remaining_obj = NULL;
13591 0 : bool allow_remaining = false;
13592 :
13593 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
13594 : discard_const_p(char *, kwnames),
13595 : &blob.data, &blob_length,
13596 : &bigendian_obj,
13597 : &ndr64_obj,
13598 : &allow_remaining_obj)) {
13599 0 : return NULL;
13600 : }
13601 0 : blob.length = blob_length;
13602 :
13603 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13604 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
13605 : }
13606 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13607 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
13608 : }
13609 :
13610 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
13611 0 : allow_remaining = true;
13612 : }
13613 :
13614 0 : return py_winreg_ReplaceKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
13615 : }
13616 :
13617 0 : static PyObject *py_winreg_ReplaceKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
13618 : {
13619 0 : const struct ndr_interface_call *call = NULL;
13620 0 : struct winreg_ReplaceKey *object = pytalloc_get_ptr(py_obj);
13621 : PyObject *ret;
13622 : char *retstr;
13623 :
13624 0 : if (ndr_table_winreg.num_calls < 19) {
13625 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_ReplaceKey_ndr_print");
13626 0 : return NULL;
13627 : }
13628 0 : call = &ndr_table_winreg.calls[18];
13629 :
13630 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
13631 0 : ret = PyUnicode_FromString(retstr);
13632 0 : TALLOC_FREE(retstr);
13633 :
13634 0 : return ret;
13635 : }
13636 :
13637 0 : static PyObject *py_winreg_ReplaceKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
13638 : {
13639 0 : return py_winreg_ReplaceKey_ndr_print(py_obj, "winreg_ReplaceKey_in", NDR_IN);
13640 : }
13641 :
13642 0 : static PyObject *py_winreg_ReplaceKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
13643 : {
13644 0 : return py_winreg_ReplaceKey_ndr_print(py_obj, "winreg_ReplaceKey_out", NDR_OUT);
13645 : }
13646 :
13647 : static PyMethodDef py_winreg_ReplaceKey_methods[] = {
13648 : { "opnum", (PyCFunction)py_winreg_ReplaceKey_ndr_opnum, METH_NOARGS|METH_CLASS,
13649 : "winreg.ReplaceKey.opnum() -> 18 (0x12) " },
13650 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
13651 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
13652 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
13653 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
13654 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
13655 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
13656 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
13657 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
13658 : { "__ndr_print_in__", (PyCFunction)py_winreg_ReplaceKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
13659 : { "__ndr_print_out__", (PyCFunction)py_winreg_ReplaceKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
13660 : { NULL, NULL, 0, NULL }
13661 : };
13662 :
13663 :
13664 : static PyTypeObject winreg_ReplaceKey_Type = {
13665 : PyVarObject_HEAD_INIT(NULL, 0)
13666 : .tp_name = "winreg.ReplaceKey",
13667 : .tp_getset = py_winreg_ReplaceKey_getsetters,
13668 : .tp_methods = py_winreg_ReplaceKey_methods,
13669 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
13670 : .tp_new = py_winreg_ReplaceKey_new,
13671 : };
13672 :
13673 0 : static bool pack_py_winreg_ReplaceKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_ReplaceKey *r)
13674 : {
13675 : PyObject *py_handle;
13676 : PyObject *py_subkey;
13677 : PyObject *py_new_file;
13678 : PyObject *py_old_file;
13679 0 : const char *kwnames[] = {
13680 : "handle", "subkey", "new_file", "old_file", NULL
13681 : };
13682 :
13683 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_ReplaceKey", discard_const_p(char *, kwnames), &py_handle, &py_subkey, &py_new_file, &py_old_file)) {
13684 0 : return false;
13685 : }
13686 :
13687 0 : if (py_handle == NULL) {
13688 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
13689 0 : return false;
13690 : }
13691 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
13692 0 : if (r->in.handle == NULL) {
13693 0 : PyErr_NoMemory();
13694 0 : return false;
13695 : }
13696 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
13697 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
13698 0 : PyErr_NoMemory();
13699 0 : return false;
13700 : }
13701 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
13702 0 : if (py_subkey == NULL) {
13703 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.subkey");
13704 0 : return false;
13705 : }
13706 0 : r->in.subkey = talloc_ptrtype(r, r->in.subkey);
13707 0 : if (r->in.subkey == NULL) {
13708 0 : PyErr_NoMemory();
13709 0 : return false;
13710 : }
13711 0 : PY_CHECK_TYPE(&winreg_String_Type, py_subkey, return false;);
13712 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_subkey)) == NULL) {
13713 0 : PyErr_NoMemory();
13714 0 : return false;
13715 : }
13716 0 : r->in.subkey = (struct winreg_String *)pytalloc_get_ptr(py_subkey);
13717 0 : if (py_new_file == NULL) {
13718 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.new_file");
13719 0 : return false;
13720 : }
13721 0 : r->in.new_file = talloc_ptrtype(r, r->in.new_file);
13722 0 : if (r->in.new_file == NULL) {
13723 0 : PyErr_NoMemory();
13724 0 : return false;
13725 : }
13726 0 : PY_CHECK_TYPE(&winreg_String_Type, py_new_file, return false;);
13727 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_new_file)) == NULL) {
13728 0 : PyErr_NoMemory();
13729 0 : return false;
13730 : }
13731 0 : r->in.new_file = (struct winreg_String *)pytalloc_get_ptr(py_new_file);
13732 0 : if (py_old_file == NULL) {
13733 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.old_file");
13734 0 : return false;
13735 : }
13736 0 : r->in.old_file = talloc_ptrtype(r, r->in.old_file);
13737 0 : if (r->in.old_file == NULL) {
13738 0 : PyErr_NoMemory();
13739 0 : return false;
13740 : }
13741 0 : PY_CHECK_TYPE(&winreg_String_Type, py_old_file, return false;);
13742 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_old_file)) == NULL) {
13743 0 : PyErr_NoMemory();
13744 0 : return false;
13745 : }
13746 0 : r->in.old_file = (struct winreg_String *)pytalloc_get_ptr(py_old_file);
13747 0 : return true;
13748 : }
13749 :
13750 0 : static PyObject *unpack_py_winreg_ReplaceKey_args_out(struct winreg_ReplaceKey *r)
13751 : {
13752 : PyObject *result;
13753 0 : result = Py_None;
13754 0 : Py_INCREF(result);
13755 0 : if (!W_ERROR_IS_OK(r->out.result)) {
13756 0 : PyErr_SetWERROR(r->out.result);
13757 0 : return NULL;
13758 : }
13759 :
13760 0 : return result;
13761 : }
13762 :
13763 :
13764 0 : static PyObject *py_winreg_RestoreKey_in_get_handle(PyObject *obj, void *closure)
13765 : {
13766 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(obj);
13767 : PyObject *py_handle;
13768 0 : if (object->in.handle == NULL) {
13769 0 : Py_RETURN_NONE;
13770 : }
13771 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
13772 0 : return py_handle;
13773 : }
13774 :
13775 0 : static int py_winreg_RestoreKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
13776 : {
13777 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(py_obj);
13778 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
13779 0 : if (value == NULL) {
13780 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
13781 0 : return -1;
13782 : }
13783 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
13784 0 : if (object->in.handle == NULL) {
13785 0 : PyErr_NoMemory();
13786 0 : return -1;
13787 : }
13788 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
13789 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13790 0 : PyErr_NoMemory();
13791 0 : return -1;
13792 : }
13793 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
13794 0 : return 0;
13795 : }
13796 :
13797 0 : static PyObject *py_winreg_RestoreKey_in_get_filename(PyObject *obj, void *closure)
13798 : {
13799 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(obj);
13800 : PyObject *py_filename;
13801 0 : if (object->in.filename == NULL) {
13802 0 : Py_RETURN_NONE;
13803 : }
13804 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
13805 0 : return py_filename;
13806 : }
13807 :
13808 0 : static int py_winreg_RestoreKey_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
13809 : {
13810 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(py_obj);
13811 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
13812 0 : if (value == NULL) {
13813 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.filename");
13814 0 : return -1;
13815 : }
13816 0 : object->in.filename = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.filename);
13817 0 : if (object->in.filename == NULL) {
13818 0 : PyErr_NoMemory();
13819 0 : return -1;
13820 : }
13821 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13822 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13823 0 : PyErr_NoMemory();
13824 0 : return -1;
13825 : }
13826 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
13827 0 : return 0;
13828 : }
13829 :
13830 0 : static PyObject *py_winreg_RestoreKey_in_get_flags(PyObject *obj, void *closure)
13831 : {
13832 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(obj);
13833 : PyObject *py_flags;
13834 0 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->in.flags));
13835 0 : return py_flags;
13836 : }
13837 :
13838 0 : static int py_winreg_RestoreKey_in_set_flags(PyObject *py_obj, PyObject *value, void *closure)
13839 : {
13840 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(py_obj);
13841 0 : if (value == NULL) {
13842 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.flags");
13843 0 : return -1;
13844 : }
13845 : {
13846 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags));
13847 0 : if (PyLong_Check(value)) {
13848 : unsigned long long test_var;
13849 0 : test_var = PyLong_AsUnsignedLongLong(value);
13850 0 : if (PyErr_Occurred() != NULL) {
13851 0 : return -1;
13852 : }
13853 0 : if (test_var > uint_max) {
13854 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13855 : PyLong_Type.tp_name, uint_max, test_var);
13856 0 : return -1;
13857 : }
13858 0 : object->in.flags = test_var;
13859 : } else {
13860 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13861 : PyLong_Type.tp_name);
13862 0 : return -1;
13863 : }
13864 : }
13865 0 : return 0;
13866 : }
13867 :
13868 0 : static PyObject *py_winreg_RestoreKey_get_result(PyObject *obj, void *closure)
13869 : {
13870 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(obj);
13871 : PyObject *py_result;
13872 0 : py_result = PyErr_FromWERROR(object->out.result);
13873 0 : return py_result;
13874 : }
13875 :
13876 0 : static int py_winreg_RestoreKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
13877 : {
13878 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(py_obj);
13879 0 : if (value == NULL) {
13880 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
13881 0 : return -1;
13882 : }
13883 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
13884 0 : return 0;
13885 : }
13886 :
13887 : static PyGetSetDef py_winreg_RestoreKey_getsetters[] = {
13888 : {
13889 : .name = discard_const_p(char, "in_handle"),
13890 : .get = py_winreg_RestoreKey_in_get_handle,
13891 : .set = py_winreg_RestoreKey_in_set_handle,
13892 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
13893 : },
13894 : {
13895 : .name = discard_const_p(char, "in_filename"),
13896 : .get = py_winreg_RestoreKey_in_get_filename,
13897 : .set = py_winreg_RestoreKey_in_set_filename,
13898 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13899 : },
13900 : {
13901 : .name = discard_const_p(char, "in_flags"),
13902 : .get = py_winreg_RestoreKey_in_get_flags,
13903 : .set = py_winreg_RestoreKey_in_set_flags,
13904 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_RestoreKeyFlags")
13905 : },
13906 : {
13907 : .name = discard_const_p(char, "result"),
13908 : .get = py_winreg_RestoreKey_get_result,
13909 : .set = py_winreg_RestoreKey_set_result,
13910 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
13911 : },
13912 : { .name = NULL }
13913 : };
13914 :
13915 0 : static PyObject *py_winreg_RestoreKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
13916 : {
13917 0 : PyObject *self = pytalloc_new(struct winreg_RestoreKey, type);
13918 0 : struct winreg_RestoreKey *_self = (struct winreg_RestoreKey *)pytalloc_get_ptr(self);
13919 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
13920 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
13921 0 : _self->in.filename = talloc_zero(mem_ctx, struct winreg_String);
13922 0 : return self;
13923 : }
13924 :
13925 0 : static PyObject *py_winreg_RestoreKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
13926 : {
13927 :
13928 :
13929 0 : return PyLong_FromLong(19);
13930 : }
13931 :
13932 0 : static PyObject *py_winreg_RestoreKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
13933 : {
13934 0 : const struct ndr_interface_call *call = NULL;
13935 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(py_obj);
13936 0 : PyObject *ret = NULL;
13937 0 : struct ndr_push *push = NULL;
13938 : DATA_BLOB blob;
13939 : enum ndr_err_code err;
13940 :
13941 0 : if (ndr_table_winreg.num_calls < 20) {
13942 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_RestoreKey_ndr_pack");
13943 0 : return NULL;
13944 : }
13945 0 : call = &ndr_table_winreg.calls[19];
13946 :
13947 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
13948 0 : if (push == NULL) {
13949 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
13950 0 : return NULL;
13951 : }
13952 :
13953 0 : push->flags |= ndr_push_flags;
13954 :
13955 0 : err = call->ndr_push(push, ndr_inout_flags, object);
13956 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
13957 0 : TALLOC_FREE(push);
13958 0 : PyErr_SetNdrError(err);
13959 0 : return NULL;
13960 : }
13961 0 : blob = ndr_push_blob(push);
13962 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
13963 0 : TALLOC_FREE(push);
13964 0 : return ret;
13965 : }
13966 :
13967 0 : static PyObject *py_winreg_RestoreKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13968 : {
13969 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13970 0 : PyObject *bigendian_obj = NULL;
13971 0 : PyObject *ndr64_obj = NULL;
13972 0 : libndr_flags ndr_push_flags = 0;
13973 :
13974 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
13975 : discard_const_p(char *, kwnames),
13976 : &bigendian_obj,
13977 : &ndr64_obj)) {
13978 0 : return NULL;
13979 : }
13980 :
13981 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13982 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
13983 : }
13984 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13985 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
13986 : }
13987 :
13988 0 : return py_winreg_RestoreKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
13989 : }
13990 :
13991 0 : static PyObject *py_winreg_RestoreKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13992 : {
13993 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13994 0 : PyObject *bigendian_obj = NULL;
13995 0 : PyObject *ndr64_obj = NULL;
13996 0 : libndr_flags ndr_push_flags = 0;
13997 :
13998 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
13999 : discard_const_p(char *, kwnames),
14000 : &bigendian_obj,
14001 : &ndr64_obj)) {
14002 0 : return NULL;
14003 : }
14004 :
14005 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14006 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14007 : }
14008 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14009 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
14010 : }
14011 :
14012 0 : return py_winreg_RestoreKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
14013 : }
14014 :
14015 0 : static PyObject *py_winreg_RestoreKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
14016 : {
14017 0 : const struct ndr_interface_call *call = NULL;
14018 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(py_obj);
14019 0 : struct ndr_pull *pull = NULL;
14020 : enum ndr_err_code err;
14021 :
14022 0 : if (ndr_table_winreg.num_calls < 20) {
14023 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_RestoreKey_ndr_unpack");
14024 0 : return NULL;
14025 : }
14026 0 : call = &ndr_table_winreg.calls[19];
14027 :
14028 0 : pull = ndr_pull_init_blob(blob, object);
14029 0 : if (pull == NULL) {
14030 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14031 0 : return NULL;
14032 : }
14033 :
14034 0 : pull->flags |= ndr_pull_flags;
14035 :
14036 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
14037 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14038 0 : TALLOC_FREE(pull);
14039 0 : PyErr_SetNdrError(err);
14040 0 : return NULL;
14041 : }
14042 0 : if (!allow_remaining) {
14043 : uint32_t highest_ofs;
14044 :
14045 0 : if (pull->offset > pull->relative_highest_offset) {
14046 0 : highest_ofs = pull->offset;
14047 : } else {
14048 0 : highest_ofs = pull->relative_highest_offset;
14049 : }
14050 0 : if (highest_ofs < pull->data_size) {
14051 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
14052 : "not all bytes consumed ofs[%u] size[%u]",
14053 : highest_ofs, pull->data_size);
14054 0 : TALLOC_FREE(pull);
14055 0 : PyErr_SetNdrError(err);
14056 0 : return NULL;
14057 : }
14058 : }
14059 :
14060 0 : TALLOC_FREE(pull);
14061 0 : Py_RETURN_NONE;
14062 : }
14063 :
14064 0 : static PyObject *py_winreg_RestoreKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14065 : {
14066 : DATA_BLOB blob;
14067 0 : Py_ssize_t blob_length = 0;
14068 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14069 0 : PyObject *bigendian_obj = NULL;
14070 0 : PyObject *ndr64_obj = NULL;
14071 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14072 0 : PyObject *allow_remaining_obj = NULL;
14073 0 : bool allow_remaining = false;
14074 :
14075 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
14076 : discard_const_p(char *, kwnames),
14077 : &blob.data, &blob_length,
14078 : &bigendian_obj,
14079 : &ndr64_obj,
14080 : &allow_remaining_obj)) {
14081 0 : return NULL;
14082 : }
14083 0 : blob.length = blob_length;
14084 :
14085 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14086 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14087 : }
14088 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14089 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14090 : }
14091 :
14092 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14093 0 : allow_remaining = true;
14094 : }
14095 :
14096 0 : return py_winreg_RestoreKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
14097 : }
14098 :
14099 0 : static PyObject *py_winreg_RestoreKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14100 : {
14101 : DATA_BLOB blob;
14102 0 : Py_ssize_t blob_length = 0;
14103 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14104 0 : PyObject *bigendian_obj = NULL;
14105 0 : PyObject *ndr64_obj = NULL;
14106 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14107 0 : PyObject *allow_remaining_obj = NULL;
14108 0 : bool allow_remaining = false;
14109 :
14110 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
14111 : discard_const_p(char *, kwnames),
14112 : &blob.data, &blob_length,
14113 : &bigendian_obj,
14114 : &ndr64_obj,
14115 : &allow_remaining_obj)) {
14116 0 : return NULL;
14117 : }
14118 0 : blob.length = blob_length;
14119 :
14120 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14121 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14122 : }
14123 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14124 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14125 : }
14126 :
14127 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14128 0 : allow_remaining = true;
14129 : }
14130 :
14131 0 : return py_winreg_RestoreKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
14132 : }
14133 :
14134 0 : static PyObject *py_winreg_RestoreKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
14135 : {
14136 0 : const struct ndr_interface_call *call = NULL;
14137 0 : struct winreg_RestoreKey *object = pytalloc_get_ptr(py_obj);
14138 : PyObject *ret;
14139 : char *retstr;
14140 :
14141 0 : if (ndr_table_winreg.num_calls < 20) {
14142 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_RestoreKey_ndr_print");
14143 0 : return NULL;
14144 : }
14145 0 : call = &ndr_table_winreg.calls[19];
14146 :
14147 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
14148 0 : ret = PyUnicode_FromString(retstr);
14149 0 : TALLOC_FREE(retstr);
14150 :
14151 0 : return ret;
14152 : }
14153 :
14154 0 : static PyObject *py_winreg_RestoreKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14155 : {
14156 0 : return py_winreg_RestoreKey_ndr_print(py_obj, "winreg_RestoreKey_in", NDR_IN);
14157 : }
14158 :
14159 0 : static PyObject *py_winreg_RestoreKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14160 : {
14161 0 : return py_winreg_RestoreKey_ndr_print(py_obj, "winreg_RestoreKey_out", NDR_OUT);
14162 : }
14163 :
14164 : static PyMethodDef py_winreg_RestoreKey_methods[] = {
14165 : { "opnum", (PyCFunction)py_winreg_RestoreKey_ndr_opnum, METH_NOARGS|METH_CLASS,
14166 : "winreg.RestoreKey.opnum() -> 19 (0x13) " },
14167 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
14168 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
14169 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
14170 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
14171 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
14172 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
14173 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
14174 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
14175 : { "__ndr_print_in__", (PyCFunction)py_winreg_RestoreKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
14176 : { "__ndr_print_out__", (PyCFunction)py_winreg_RestoreKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
14177 : { NULL, NULL, 0, NULL }
14178 : };
14179 :
14180 :
14181 : static PyTypeObject winreg_RestoreKey_Type = {
14182 : PyVarObject_HEAD_INIT(NULL, 0)
14183 : .tp_name = "winreg.RestoreKey",
14184 : .tp_getset = py_winreg_RestoreKey_getsetters,
14185 : .tp_methods = py_winreg_RestoreKey_methods,
14186 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
14187 : .tp_new = py_winreg_RestoreKey_new,
14188 : };
14189 :
14190 0 : static bool pack_py_winreg_RestoreKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_RestoreKey *r)
14191 : {
14192 : PyObject *py_handle;
14193 : PyObject *py_filename;
14194 : PyObject *py_flags;
14195 0 : const char *kwnames[] = {
14196 : "handle", "filename", "flags", NULL
14197 : };
14198 :
14199 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_RestoreKey", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_flags)) {
14200 0 : return false;
14201 : }
14202 :
14203 0 : if (py_handle == NULL) {
14204 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
14205 0 : return false;
14206 : }
14207 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
14208 0 : if (r->in.handle == NULL) {
14209 0 : PyErr_NoMemory();
14210 0 : return false;
14211 : }
14212 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
14213 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
14214 0 : PyErr_NoMemory();
14215 0 : return false;
14216 : }
14217 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
14218 0 : if (py_filename == NULL) {
14219 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.filename");
14220 0 : return false;
14221 : }
14222 0 : r->in.filename = talloc_ptrtype(r, r->in.filename);
14223 0 : if (r->in.filename == NULL) {
14224 0 : PyErr_NoMemory();
14225 0 : return false;
14226 : }
14227 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
14228 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
14229 0 : PyErr_NoMemory();
14230 0 : return false;
14231 : }
14232 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
14233 0 : if (py_flags == NULL) {
14234 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.flags");
14235 0 : return false;
14236 : }
14237 : {
14238 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags));
14239 0 : if (PyLong_Check(py_flags)) {
14240 : unsigned long long test_var;
14241 0 : test_var = PyLong_AsUnsignedLongLong(py_flags);
14242 0 : if (PyErr_Occurred() != NULL) {
14243 0 : return false;
14244 : }
14245 0 : if (test_var > uint_max) {
14246 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
14247 : PyLong_Type.tp_name, uint_max, test_var);
14248 0 : return false;
14249 : }
14250 0 : r->in.flags = test_var;
14251 : } else {
14252 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
14253 : PyLong_Type.tp_name);
14254 0 : return false;
14255 : }
14256 : }
14257 0 : return true;
14258 : }
14259 :
14260 0 : static PyObject *unpack_py_winreg_RestoreKey_args_out(struct winreg_RestoreKey *r)
14261 : {
14262 : PyObject *result;
14263 0 : result = Py_None;
14264 0 : Py_INCREF(result);
14265 0 : if (!W_ERROR_IS_OK(r->out.result)) {
14266 0 : PyErr_SetWERROR(r->out.result);
14267 0 : return NULL;
14268 : }
14269 :
14270 0 : return result;
14271 : }
14272 :
14273 :
14274 0 : static PyObject *py_winreg_SaveKey_in_get_handle(PyObject *obj, void *closure)
14275 : {
14276 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(obj);
14277 : PyObject *py_handle;
14278 0 : if (object->in.handle == NULL) {
14279 0 : Py_RETURN_NONE;
14280 : }
14281 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
14282 0 : return py_handle;
14283 : }
14284 :
14285 0 : static int py_winreg_SaveKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
14286 : {
14287 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(py_obj);
14288 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
14289 0 : if (value == NULL) {
14290 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
14291 0 : return -1;
14292 : }
14293 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
14294 0 : if (object->in.handle == NULL) {
14295 0 : PyErr_NoMemory();
14296 0 : return -1;
14297 : }
14298 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
14299 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14300 0 : PyErr_NoMemory();
14301 0 : return -1;
14302 : }
14303 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
14304 0 : return 0;
14305 : }
14306 :
14307 0 : static PyObject *py_winreg_SaveKey_in_get_filename(PyObject *obj, void *closure)
14308 : {
14309 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(obj);
14310 : PyObject *py_filename;
14311 0 : if (object->in.filename == NULL) {
14312 0 : Py_RETURN_NONE;
14313 : }
14314 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
14315 0 : return py_filename;
14316 : }
14317 :
14318 0 : static int py_winreg_SaveKey_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
14319 : {
14320 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(py_obj);
14321 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
14322 0 : if (value == NULL) {
14323 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.filename");
14324 0 : return -1;
14325 : }
14326 0 : object->in.filename = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.filename);
14327 0 : if (object->in.filename == NULL) {
14328 0 : PyErr_NoMemory();
14329 0 : return -1;
14330 : }
14331 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
14332 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14333 0 : PyErr_NoMemory();
14334 0 : return -1;
14335 : }
14336 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
14337 0 : return 0;
14338 : }
14339 :
14340 0 : static PyObject *py_winreg_SaveKey_in_get_sec_attrib(PyObject *obj, void *closure)
14341 : {
14342 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(obj);
14343 : PyObject *py_sec_attrib;
14344 0 : if (object->in.sec_attrib == NULL) {
14345 0 : Py_RETURN_NONE;
14346 : }
14347 0 : if (object->in.sec_attrib == NULL) {
14348 0 : py_sec_attrib = Py_None;
14349 0 : Py_INCREF(py_sec_attrib);
14350 : } else {
14351 0 : py_sec_attrib = pytalloc_reference_ex(&KeySecurityAttribute_Type, object->in.sec_attrib, object->in.sec_attrib);
14352 : }
14353 0 : return py_sec_attrib;
14354 : }
14355 :
14356 0 : static int py_winreg_SaveKey_in_set_sec_attrib(PyObject *py_obj, PyObject *value, void *closure)
14357 : {
14358 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(py_obj);
14359 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sec_attrib));
14360 0 : if (value == NULL) {
14361 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.sec_attrib");
14362 0 : return -1;
14363 : }
14364 0 : if (value == Py_None) {
14365 0 : object->in.sec_attrib = NULL;
14366 : } else {
14367 0 : object->in.sec_attrib = NULL;
14368 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, value, return -1;);
14369 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14370 0 : PyErr_NoMemory();
14371 0 : return -1;
14372 : }
14373 0 : object->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(value);
14374 : }
14375 0 : return 0;
14376 : }
14377 :
14378 0 : static PyObject *py_winreg_SaveKey_get_result(PyObject *obj, void *closure)
14379 : {
14380 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(obj);
14381 : PyObject *py_result;
14382 0 : py_result = PyErr_FromWERROR(object->out.result);
14383 0 : return py_result;
14384 : }
14385 :
14386 0 : static int py_winreg_SaveKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
14387 : {
14388 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(py_obj);
14389 0 : if (value == NULL) {
14390 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
14391 0 : return -1;
14392 : }
14393 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
14394 0 : return 0;
14395 : }
14396 :
14397 : static PyGetSetDef py_winreg_SaveKey_getsetters[] = {
14398 : {
14399 : .name = discard_const_p(char, "in_handle"),
14400 : .get = py_winreg_SaveKey_in_get_handle,
14401 : .set = py_winreg_SaveKey_in_set_handle,
14402 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
14403 : },
14404 : {
14405 : .name = discard_const_p(char, "in_filename"),
14406 : .get = py_winreg_SaveKey_in_get_filename,
14407 : .set = py_winreg_SaveKey_in_set_filename,
14408 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
14409 : },
14410 : {
14411 : .name = discard_const_p(char, "in_sec_attrib"),
14412 : .get = py_winreg_SaveKey_in_get_sec_attrib,
14413 : .set = py_winreg_SaveKey_in_set_sec_attrib,
14414 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityAttribute")
14415 : },
14416 : {
14417 : .name = discard_const_p(char, "result"),
14418 : .get = py_winreg_SaveKey_get_result,
14419 : .set = py_winreg_SaveKey_set_result,
14420 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
14421 : },
14422 : { .name = NULL }
14423 : };
14424 :
14425 0 : static PyObject *py_winreg_SaveKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
14426 : {
14427 0 : PyObject *self = pytalloc_new(struct winreg_SaveKey, type);
14428 0 : struct winreg_SaveKey *_self = (struct winreg_SaveKey *)pytalloc_get_ptr(self);
14429 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
14430 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
14431 0 : _self->in.filename = talloc_zero(mem_ctx, struct winreg_String);
14432 0 : return self;
14433 : }
14434 :
14435 0 : static PyObject *py_winreg_SaveKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
14436 : {
14437 :
14438 :
14439 0 : return PyLong_FromLong(20);
14440 : }
14441 :
14442 0 : static PyObject *py_winreg_SaveKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
14443 : {
14444 0 : const struct ndr_interface_call *call = NULL;
14445 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(py_obj);
14446 0 : PyObject *ret = NULL;
14447 0 : struct ndr_push *push = NULL;
14448 : DATA_BLOB blob;
14449 : enum ndr_err_code err;
14450 :
14451 0 : if (ndr_table_winreg.num_calls < 21) {
14452 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKey_ndr_pack");
14453 0 : return NULL;
14454 : }
14455 0 : call = &ndr_table_winreg.calls[20];
14456 :
14457 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
14458 0 : if (push == NULL) {
14459 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14460 0 : return NULL;
14461 : }
14462 :
14463 0 : push->flags |= ndr_push_flags;
14464 :
14465 0 : err = call->ndr_push(push, ndr_inout_flags, object);
14466 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14467 0 : TALLOC_FREE(push);
14468 0 : PyErr_SetNdrError(err);
14469 0 : return NULL;
14470 : }
14471 0 : blob = ndr_push_blob(push);
14472 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
14473 0 : TALLOC_FREE(push);
14474 0 : return ret;
14475 : }
14476 :
14477 0 : static PyObject *py_winreg_SaveKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14478 : {
14479 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
14480 0 : PyObject *bigendian_obj = NULL;
14481 0 : PyObject *ndr64_obj = NULL;
14482 0 : libndr_flags ndr_push_flags = 0;
14483 :
14484 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
14485 : discard_const_p(char *, kwnames),
14486 : &bigendian_obj,
14487 : &ndr64_obj)) {
14488 0 : return NULL;
14489 : }
14490 :
14491 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14492 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14493 : }
14494 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14495 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
14496 : }
14497 :
14498 0 : return py_winreg_SaveKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
14499 : }
14500 :
14501 0 : static PyObject *py_winreg_SaveKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14502 : {
14503 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
14504 0 : PyObject *bigendian_obj = NULL;
14505 0 : PyObject *ndr64_obj = NULL;
14506 0 : libndr_flags ndr_push_flags = 0;
14507 :
14508 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
14509 : discard_const_p(char *, kwnames),
14510 : &bigendian_obj,
14511 : &ndr64_obj)) {
14512 0 : return NULL;
14513 : }
14514 :
14515 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14516 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14517 : }
14518 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14519 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
14520 : }
14521 :
14522 0 : return py_winreg_SaveKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
14523 : }
14524 :
14525 0 : static PyObject *py_winreg_SaveKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
14526 : {
14527 0 : const struct ndr_interface_call *call = NULL;
14528 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(py_obj);
14529 0 : struct ndr_pull *pull = NULL;
14530 : enum ndr_err_code err;
14531 :
14532 0 : if (ndr_table_winreg.num_calls < 21) {
14533 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKey_ndr_unpack");
14534 0 : return NULL;
14535 : }
14536 0 : call = &ndr_table_winreg.calls[20];
14537 :
14538 0 : pull = ndr_pull_init_blob(blob, object);
14539 0 : if (pull == NULL) {
14540 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14541 0 : return NULL;
14542 : }
14543 :
14544 0 : pull->flags |= ndr_pull_flags;
14545 :
14546 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
14547 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14548 0 : TALLOC_FREE(pull);
14549 0 : PyErr_SetNdrError(err);
14550 0 : return NULL;
14551 : }
14552 0 : if (!allow_remaining) {
14553 : uint32_t highest_ofs;
14554 :
14555 0 : if (pull->offset > pull->relative_highest_offset) {
14556 0 : highest_ofs = pull->offset;
14557 : } else {
14558 0 : highest_ofs = pull->relative_highest_offset;
14559 : }
14560 0 : if (highest_ofs < pull->data_size) {
14561 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
14562 : "not all bytes consumed ofs[%u] size[%u]",
14563 : highest_ofs, pull->data_size);
14564 0 : TALLOC_FREE(pull);
14565 0 : PyErr_SetNdrError(err);
14566 0 : return NULL;
14567 : }
14568 : }
14569 :
14570 0 : TALLOC_FREE(pull);
14571 0 : Py_RETURN_NONE;
14572 : }
14573 :
14574 0 : static PyObject *py_winreg_SaveKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14575 : {
14576 : DATA_BLOB blob;
14577 0 : Py_ssize_t blob_length = 0;
14578 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14579 0 : PyObject *bigendian_obj = NULL;
14580 0 : PyObject *ndr64_obj = NULL;
14581 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14582 0 : PyObject *allow_remaining_obj = NULL;
14583 0 : bool allow_remaining = false;
14584 :
14585 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
14586 : discard_const_p(char *, kwnames),
14587 : &blob.data, &blob_length,
14588 : &bigendian_obj,
14589 : &ndr64_obj,
14590 : &allow_remaining_obj)) {
14591 0 : return NULL;
14592 : }
14593 0 : blob.length = blob_length;
14594 :
14595 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14596 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14597 : }
14598 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14599 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14600 : }
14601 :
14602 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14603 0 : allow_remaining = true;
14604 : }
14605 :
14606 0 : return py_winreg_SaveKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
14607 : }
14608 :
14609 0 : static PyObject *py_winreg_SaveKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14610 : {
14611 : DATA_BLOB blob;
14612 0 : Py_ssize_t blob_length = 0;
14613 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14614 0 : PyObject *bigendian_obj = NULL;
14615 0 : PyObject *ndr64_obj = NULL;
14616 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14617 0 : PyObject *allow_remaining_obj = NULL;
14618 0 : bool allow_remaining = false;
14619 :
14620 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
14621 : discard_const_p(char *, kwnames),
14622 : &blob.data, &blob_length,
14623 : &bigendian_obj,
14624 : &ndr64_obj,
14625 : &allow_remaining_obj)) {
14626 0 : return NULL;
14627 : }
14628 0 : blob.length = blob_length;
14629 :
14630 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14631 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14632 : }
14633 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14634 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14635 : }
14636 :
14637 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14638 0 : allow_remaining = true;
14639 : }
14640 :
14641 0 : return py_winreg_SaveKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
14642 : }
14643 :
14644 0 : static PyObject *py_winreg_SaveKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
14645 : {
14646 0 : const struct ndr_interface_call *call = NULL;
14647 0 : struct winreg_SaveKey *object = pytalloc_get_ptr(py_obj);
14648 : PyObject *ret;
14649 : char *retstr;
14650 :
14651 0 : if (ndr_table_winreg.num_calls < 21) {
14652 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKey_ndr_print");
14653 0 : return NULL;
14654 : }
14655 0 : call = &ndr_table_winreg.calls[20];
14656 :
14657 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
14658 0 : ret = PyUnicode_FromString(retstr);
14659 0 : TALLOC_FREE(retstr);
14660 :
14661 0 : return ret;
14662 : }
14663 :
14664 0 : static PyObject *py_winreg_SaveKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14665 : {
14666 0 : return py_winreg_SaveKey_ndr_print(py_obj, "winreg_SaveKey_in", NDR_IN);
14667 : }
14668 :
14669 0 : static PyObject *py_winreg_SaveKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14670 : {
14671 0 : return py_winreg_SaveKey_ndr_print(py_obj, "winreg_SaveKey_out", NDR_OUT);
14672 : }
14673 :
14674 : static PyMethodDef py_winreg_SaveKey_methods[] = {
14675 : { "opnum", (PyCFunction)py_winreg_SaveKey_ndr_opnum, METH_NOARGS|METH_CLASS,
14676 : "winreg.SaveKey.opnum() -> 20 (0x14) " },
14677 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
14678 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
14679 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
14680 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
14681 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
14682 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
14683 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
14684 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
14685 : { "__ndr_print_in__", (PyCFunction)py_winreg_SaveKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
14686 : { "__ndr_print_out__", (PyCFunction)py_winreg_SaveKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
14687 : { NULL, NULL, 0, NULL }
14688 : };
14689 :
14690 :
14691 : static PyTypeObject winreg_SaveKey_Type = {
14692 : PyVarObject_HEAD_INIT(NULL, 0)
14693 : .tp_name = "winreg.SaveKey",
14694 : .tp_getset = py_winreg_SaveKey_getsetters,
14695 : .tp_methods = py_winreg_SaveKey_methods,
14696 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
14697 : .tp_new = py_winreg_SaveKey_new,
14698 : };
14699 :
14700 0 : static bool pack_py_winreg_SaveKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_SaveKey *r)
14701 : {
14702 : PyObject *py_handle;
14703 : PyObject *py_filename;
14704 : PyObject *py_sec_attrib;
14705 0 : const char *kwnames[] = {
14706 : "handle", "filename", "sec_attrib", NULL
14707 : };
14708 :
14709 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_SaveKey", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_sec_attrib)) {
14710 0 : return false;
14711 : }
14712 :
14713 0 : if (py_handle == NULL) {
14714 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
14715 0 : return false;
14716 : }
14717 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
14718 0 : if (r->in.handle == NULL) {
14719 0 : PyErr_NoMemory();
14720 0 : return false;
14721 : }
14722 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
14723 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
14724 0 : PyErr_NoMemory();
14725 0 : return false;
14726 : }
14727 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
14728 0 : if (py_filename == NULL) {
14729 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.filename");
14730 0 : return false;
14731 : }
14732 0 : r->in.filename = talloc_ptrtype(r, r->in.filename);
14733 0 : if (r->in.filename == NULL) {
14734 0 : PyErr_NoMemory();
14735 0 : return false;
14736 : }
14737 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
14738 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
14739 0 : PyErr_NoMemory();
14740 0 : return false;
14741 : }
14742 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
14743 0 : if (py_sec_attrib == NULL) {
14744 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.sec_attrib");
14745 0 : return false;
14746 : }
14747 0 : if (py_sec_attrib == Py_None) {
14748 0 : r->in.sec_attrib = NULL;
14749 : } else {
14750 0 : r->in.sec_attrib = NULL;
14751 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, py_sec_attrib, return false;);
14752 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sec_attrib)) == NULL) {
14753 0 : PyErr_NoMemory();
14754 0 : return false;
14755 : }
14756 0 : r->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(py_sec_attrib);
14757 : }
14758 0 : return true;
14759 : }
14760 :
14761 0 : static PyObject *unpack_py_winreg_SaveKey_args_out(struct winreg_SaveKey *r)
14762 : {
14763 : PyObject *result;
14764 0 : result = Py_None;
14765 0 : Py_INCREF(result);
14766 0 : if (!W_ERROR_IS_OK(r->out.result)) {
14767 0 : PyErr_SetWERROR(r->out.result);
14768 0 : return NULL;
14769 : }
14770 :
14771 0 : return result;
14772 : }
14773 :
14774 :
14775 0 : static PyObject *py_winreg_SetKeySecurity_in_get_handle(PyObject *obj, void *closure)
14776 : {
14777 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(obj);
14778 : PyObject *py_handle;
14779 0 : if (object->in.handle == NULL) {
14780 0 : Py_RETURN_NONE;
14781 : }
14782 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
14783 0 : return py_handle;
14784 : }
14785 :
14786 0 : static int py_winreg_SetKeySecurity_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
14787 : {
14788 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(py_obj);
14789 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
14790 0 : if (value == NULL) {
14791 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
14792 0 : return -1;
14793 : }
14794 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
14795 0 : if (object->in.handle == NULL) {
14796 0 : PyErr_NoMemory();
14797 0 : return -1;
14798 : }
14799 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
14800 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14801 0 : PyErr_NoMemory();
14802 0 : return -1;
14803 : }
14804 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
14805 0 : return 0;
14806 : }
14807 :
14808 0 : static PyObject *py_winreg_SetKeySecurity_in_get_sec_info(PyObject *obj, void *closure)
14809 : {
14810 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(obj);
14811 : PyObject *py_sec_info;
14812 0 : py_sec_info = PyLong_FromUnsignedLongLong((uint32_t)(object->in.sec_info));
14813 0 : return py_sec_info;
14814 : }
14815 :
14816 0 : static int py_winreg_SetKeySecurity_in_set_sec_info(PyObject *py_obj, PyObject *value, void *closure)
14817 : {
14818 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(py_obj);
14819 0 : if (value == NULL) {
14820 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.sec_info");
14821 0 : return -1;
14822 : }
14823 : {
14824 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.sec_info));
14825 0 : if (PyLong_Check(value)) {
14826 : unsigned long long test_var;
14827 0 : test_var = PyLong_AsUnsignedLongLong(value);
14828 0 : if (PyErr_Occurred() != NULL) {
14829 0 : return -1;
14830 : }
14831 0 : if (test_var > uint_max) {
14832 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
14833 : PyLong_Type.tp_name, uint_max, test_var);
14834 0 : return -1;
14835 : }
14836 0 : object->in.sec_info = test_var;
14837 : } else {
14838 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
14839 : PyLong_Type.tp_name);
14840 0 : return -1;
14841 : }
14842 : }
14843 0 : return 0;
14844 : }
14845 :
14846 0 : static PyObject *py_winreg_SetKeySecurity_in_get_sd(PyObject *obj, void *closure)
14847 : {
14848 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(obj);
14849 : PyObject *py_sd;
14850 0 : if (object->in.sd == NULL) {
14851 0 : Py_RETURN_NONE;
14852 : }
14853 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, object->in.sd, object->in.sd);
14854 0 : return py_sd;
14855 : }
14856 :
14857 0 : static int py_winreg_SetKeySecurity_in_set_sd(PyObject *py_obj, PyObject *value, void *closure)
14858 : {
14859 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(py_obj);
14860 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sd));
14861 0 : if (value == NULL) {
14862 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.sd");
14863 0 : return -1;
14864 : }
14865 0 : object->in.sd = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.sd);
14866 0 : if (object->in.sd == NULL) {
14867 0 : PyErr_NoMemory();
14868 0 : return -1;
14869 : }
14870 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
14871 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14872 0 : PyErr_NoMemory();
14873 0 : return -1;
14874 : }
14875 0 : object->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(value);
14876 0 : return 0;
14877 : }
14878 :
14879 0 : static PyObject *py_winreg_SetKeySecurity_get_result(PyObject *obj, void *closure)
14880 : {
14881 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(obj);
14882 : PyObject *py_result;
14883 0 : py_result = PyErr_FromWERROR(object->out.result);
14884 0 : return py_result;
14885 : }
14886 :
14887 0 : static int py_winreg_SetKeySecurity_set_result(PyObject *py_obj, PyObject *value, void *closure)
14888 : {
14889 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(py_obj);
14890 0 : if (value == NULL) {
14891 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
14892 0 : return -1;
14893 : }
14894 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
14895 0 : return 0;
14896 : }
14897 :
14898 : static PyGetSetDef py_winreg_SetKeySecurity_getsetters[] = {
14899 : {
14900 : .name = discard_const_p(char, "in_handle"),
14901 : .get = py_winreg_SetKeySecurity_in_get_handle,
14902 : .set = py_winreg_SetKeySecurity_in_set_handle,
14903 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
14904 : },
14905 : {
14906 : .name = discard_const_p(char, "in_sec_info"),
14907 : .get = py_winreg_SetKeySecurity_in_get_sec_info,
14908 : .set = py_winreg_SetKeySecurity_in_set_sec_info,
14909 : .doc = discard_const_p(char, "PIDL-generated element of base type security_secinfo")
14910 : },
14911 : {
14912 : .name = discard_const_p(char, "in_sd"),
14913 : .get = py_winreg_SetKeySecurity_in_get_sd,
14914 : .set = py_winreg_SetKeySecurity_in_set_sd,
14915 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
14916 : },
14917 : {
14918 : .name = discard_const_p(char, "result"),
14919 : .get = py_winreg_SetKeySecurity_get_result,
14920 : .set = py_winreg_SetKeySecurity_set_result,
14921 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
14922 : },
14923 : { .name = NULL }
14924 : };
14925 :
14926 0 : static PyObject *py_winreg_SetKeySecurity_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
14927 : {
14928 0 : PyObject *self = pytalloc_new(struct winreg_SetKeySecurity, type);
14929 0 : struct winreg_SetKeySecurity *_self = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(self);
14930 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
14931 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
14932 0 : _self->in.sd = talloc_zero(mem_ctx, struct KeySecurityData);
14933 0 : return self;
14934 : }
14935 :
14936 0 : static PyObject *py_winreg_SetKeySecurity_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
14937 : {
14938 :
14939 :
14940 0 : return PyLong_FromLong(21);
14941 : }
14942 :
14943 0 : static PyObject *py_winreg_SetKeySecurity_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
14944 : {
14945 0 : const struct ndr_interface_call *call = NULL;
14946 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(py_obj);
14947 0 : PyObject *ret = NULL;
14948 0 : struct ndr_push *push = NULL;
14949 : DATA_BLOB blob;
14950 : enum ndr_err_code err;
14951 :
14952 0 : if (ndr_table_winreg.num_calls < 22) {
14953 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetKeySecurity_ndr_pack");
14954 0 : return NULL;
14955 : }
14956 0 : call = &ndr_table_winreg.calls[21];
14957 :
14958 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
14959 0 : if (push == NULL) {
14960 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14961 0 : return NULL;
14962 : }
14963 :
14964 0 : push->flags |= ndr_push_flags;
14965 :
14966 0 : err = call->ndr_push(push, ndr_inout_flags, object);
14967 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14968 0 : TALLOC_FREE(push);
14969 0 : PyErr_SetNdrError(err);
14970 0 : return NULL;
14971 : }
14972 0 : blob = ndr_push_blob(push);
14973 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
14974 0 : TALLOC_FREE(push);
14975 0 : return ret;
14976 : }
14977 :
14978 0 : static PyObject *py_winreg_SetKeySecurity_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14979 : {
14980 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
14981 0 : PyObject *bigendian_obj = NULL;
14982 0 : PyObject *ndr64_obj = NULL;
14983 0 : libndr_flags ndr_push_flags = 0;
14984 :
14985 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
14986 : discard_const_p(char *, kwnames),
14987 : &bigendian_obj,
14988 : &ndr64_obj)) {
14989 0 : return NULL;
14990 : }
14991 :
14992 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14993 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14994 : }
14995 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14996 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
14997 : }
14998 :
14999 0 : return py_winreg_SetKeySecurity_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
15000 : }
15001 :
15002 0 : static PyObject *py_winreg_SetKeySecurity_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15003 : {
15004 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
15005 0 : PyObject *bigendian_obj = NULL;
15006 0 : PyObject *ndr64_obj = NULL;
15007 0 : libndr_flags ndr_push_flags = 0;
15008 :
15009 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
15010 : discard_const_p(char *, kwnames),
15011 : &bigendian_obj,
15012 : &ndr64_obj)) {
15013 0 : return NULL;
15014 : }
15015 :
15016 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15017 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
15018 : }
15019 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15020 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
15021 : }
15022 :
15023 0 : return py_winreg_SetKeySecurity_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
15024 : }
15025 :
15026 0 : static PyObject *py_winreg_SetKeySecurity_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
15027 : {
15028 0 : const struct ndr_interface_call *call = NULL;
15029 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(py_obj);
15030 0 : struct ndr_pull *pull = NULL;
15031 : enum ndr_err_code err;
15032 :
15033 0 : if (ndr_table_winreg.num_calls < 22) {
15034 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetKeySecurity_ndr_unpack");
15035 0 : return NULL;
15036 : }
15037 0 : call = &ndr_table_winreg.calls[21];
15038 :
15039 0 : pull = ndr_pull_init_blob(blob, object);
15040 0 : if (pull == NULL) {
15041 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
15042 0 : return NULL;
15043 : }
15044 :
15045 0 : pull->flags |= ndr_pull_flags;
15046 :
15047 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
15048 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
15049 0 : TALLOC_FREE(pull);
15050 0 : PyErr_SetNdrError(err);
15051 0 : return NULL;
15052 : }
15053 0 : if (!allow_remaining) {
15054 : uint32_t highest_ofs;
15055 :
15056 0 : if (pull->offset > pull->relative_highest_offset) {
15057 0 : highest_ofs = pull->offset;
15058 : } else {
15059 0 : highest_ofs = pull->relative_highest_offset;
15060 : }
15061 0 : if (highest_ofs < pull->data_size) {
15062 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
15063 : "not all bytes consumed ofs[%u] size[%u]",
15064 : highest_ofs, pull->data_size);
15065 0 : TALLOC_FREE(pull);
15066 0 : PyErr_SetNdrError(err);
15067 0 : return NULL;
15068 : }
15069 : }
15070 :
15071 0 : TALLOC_FREE(pull);
15072 0 : Py_RETURN_NONE;
15073 : }
15074 :
15075 0 : static PyObject *py_winreg_SetKeySecurity_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15076 : {
15077 : DATA_BLOB blob;
15078 0 : Py_ssize_t blob_length = 0;
15079 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15080 0 : PyObject *bigendian_obj = NULL;
15081 0 : PyObject *ndr64_obj = NULL;
15082 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15083 0 : PyObject *allow_remaining_obj = NULL;
15084 0 : bool allow_remaining = false;
15085 :
15086 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
15087 : discard_const_p(char *, kwnames),
15088 : &blob.data, &blob_length,
15089 : &bigendian_obj,
15090 : &ndr64_obj,
15091 : &allow_remaining_obj)) {
15092 0 : return NULL;
15093 : }
15094 0 : blob.length = blob_length;
15095 :
15096 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15097 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15098 : }
15099 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15100 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15101 : }
15102 :
15103 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15104 0 : allow_remaining = true;
15105 : }
15106 :
15107 0 : return py_winreg_SetKeySecurity_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
15108 : }
15109 :
15110 0 : static PyObject *py_winreg_SetKeySecurity_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15111 : {
15112 : DATA_BLOB blob;
15113 0 : Py_ssize_t blob_length = 0;
15114 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15115 0 : PyObject *bigendian_obj = NULL;
15116 0 : PyObject *ndr64_obj = NULL;
15117 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15118 0 : PyObject *allow_remaining_obj = NULL;
15119 0 : bool allow_remaining = false;
15120 :
15121 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
15122 : discard_const_p(char *, kwnames),
15123 : &blob.data, &blob_length,
15124 : &bigendian_obj,
15125 : &ndr64_obj,
15126 : &allow_remaining_obj)) {
15127 0 : return NULL;
15128 : }
15129 0 : blob.length = blob_length;
15130 :
15131 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15132 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15133 : }
15134 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15135 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15136 : }
15137 :
15138 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15139 0 : allow_remaining = true;
15140 : }
15141 :
15142 0 : return py_winreg_SetKeySecurity_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
15143 : }
15144 :
15145 0 : static PyObject *py_winreg_SetKeySecurity_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
15146 : {
15147 0 : const struct ndr_interface_call *call = NULL;
15148 0 : struct winreg_SetKeySecurity *object = pytalloc_get_ptr(py_obj);
15149 : PyObject *ret;
15150 : char *retstr;
15151 :
15152 0 : if (ndr_table_winreg.num_calls < 22) {
15153 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetKeySecurity_ndr_print");
15154 0 : return NULL;
15155 : }
15156 0 : call = &ndr_table_winreg.calls[21];
15157 :
15158 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
15159 0 : ret = PyUnicode_FromString(retstr);
15160 0 : TALLOC_FREE(retstr);
15161 :
15162 0 : return ret;
15163 : }
15164 :
15165 0 : static PyObject *py_winreg_SetKeySecurity_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15166 : {
15167 0 : return py_winreg_SetKeySecurity_ndr_print(py_obj, "winreg_SetKeySecurity_in", NDR_IN);
15168 : }
15169 :
15170 0 : static PyObject *py_winreg_SetKeySecurity_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15171 : {
15172 0 : return py_winreg_SetKeySecurity_ndr_print(py_obj, "winreg_SetKeySecurity_out", NDR_OUT);
15173 : }
15174 :
15175 : static PyMethodDef py_winreg_SetKeySecurity_methods[] = {
15176 : { "opnum", (PyCFunction)py_winreg_SetKeySecurity_ndr_opnum, METH_NOARGS|METH_CLASS,
15177 : "winreg.SetKeySecurity.opnum() -> 21 (0x15) " },
15178 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
15179 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
15180 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
15181 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
15182 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
15183 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
15184 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
15185 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
15186 : { "__ndr_print_in__", (PyCFunction)py_winreg_SetKeySecurity_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
15187 : { "__ndr_print_out__", (PyCFunction)py_winreg_SetKeySecurity_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
15188 : { NULL, NULL, 0, NULL }
15189 : };
15190 :
15191 :
15192 : static PyTypeObject winreg_SetKeySecurity_Type = {
15193 : PyVarObject_HEAD_INIT(NULL, 0)
15194 : .tp_name = "winreg.SetKeySecurity",
15195 : .tp_getset = py_winreg_SetKeySecurity_getsetters,
15196 : .tp_methods = py_winreg_SetKeySecurity_methods,
15197 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
15198 : .tp_new = py_winreg_SetKeySecurity_new,
15199 : };
15200 :
15201 0 : static bool pack_py_winreg_SetKeySecurity_args_in(PyObject *args, PyObject *kwargs, struct winreg_SetKeySecurity *r)
15202 : {
15203 : PyObject *py_handle;
15204 : PyObject *py_sec_info;
15205 : PyObject *py_sd;
15206 0 : const char *kwnames[] = {
15207 : "handle", "sec_info", "sd", NULL
15208 : };
15209 :
15210 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_SetKeySecurity", discard_const_p(char *, kwnames), &py_handle, &py_sec_info, &py_sd)) {
15211 0 : return false;
15212 : }
15213 :
15214 0 : if (py_handle == NULL) {
15215 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
15216 0 : return false;
15217 : }
15218 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
15219 0 : if (r->in.handle == NULL) {
15220 0 : PyErr_NoMemory();
15221 0 : return false;
15222 : }
15223 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
15224 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
15225 0 : PyErr_NoMemory();
15226 0 : return false;
15227 : }
15228 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
15229 0 : if (py_sec_info == NULL) {
15230 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.sec_info");
15231 0 : return false;
15232 : }
15233 : {
15234 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.sec_info));
15235 0 : if (PyLong_Check(py_sec_info)) {
15236 : unsigned long long test_var;
15237 0 : test_var = PyLong_AsUnsignedLongLong(py_sec_info);
15238 0 : if (PyErr_Occurred() != NULL) {
15239 0 : return false;
15240 : }
15241 0 : if (test_var > uint_max) {
15242 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15243 : PyLong_Type.tp_name, uint_max, test_var);
15244 0 : return false;
15245 : }
15246 0 : r->in.sec_info = test_var;
15247 : } else {
15248 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15249 : PyLong_Type.tp_name);
15250 0 : return false;
15251 : }
15252 : }
15253 0 : if (py_sd == NULL) {
15254 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.sd");
15255 0 : return false;
15256 : }
15257 0 : r->in.sd = talloc_ptrtype(r, r->in.sd);
15258 0 : if (r->in.sd == NULL) {
15259 0 : PyErr_NoMemory();
15260 0 : return false;
15261 : }
15262 0 : PY_CHECK_TYPE(&KeySecurityData_Type, py_sd, return false;);
15263 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sd)) == NULL) {
15264 0 : PyErr_NoMemory();
15265 0 : return false;
15266 : }
15267 0 : r->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(py_sd);
15268 0 : return true;
15269 : }
15270 :
15271 0 : static PyObject *unpack_py_winreg_SetKeySecurity_args_out(struct winreg_SetKeySecurity *r)
15272 : {
15273 : PyObject *result;
15274 0 : result = Py_None;
15275 0 : Py_INCREF(result);
15276 0 : if (!W_ERROR_IS_OK(r->out.result)) {
15277 0 : PyErr_SetWERROR(r->out.result);
15278 0 : return NULL;
15279 : }
15280 :
15281 0 : return result;
15282 : }
15283 :
15284 :
15285 0 : static PyObject *py_winreg_SetValue_in_get_handle(PyObject *obj, void *closure)
15286 : {
15287 0 : struct winreg_SetValue *object = pytalloc_get_ptr(obj);
15288 : PyObject *py_handle;
15289 0 : if (object->in.handle == NULL) {
15290 0 : Py_RETURN_NONE;
15291 : }
15292 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
15293 0 : return py_handle;
15294 : }
15295 :
15296 0 : static int py_winreg_SetValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
15297 : {
15298 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15299 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
15300 0 : if (value == NULL) {
15301 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
15302 0 : return -1;
15303 : }
15304 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
15305 0 : if (object->in.handle == NULL) {
15306 0 : PyErr_NoMemory();
15307 0 : return -1;
15308 : }
15309 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
15310 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
15311 0 : PyErr_NoMemory();
15312 0 : return -1;
15313 : }
15314 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
15315 0 : return 0;
15316 : }
15317 :
15318 0 : static PyObject *py_winreg_SetValue_in_get_name(PyObject *obj, void *closure)
15319 : {
15320 0 : struct winreg_SetValue *object = pytalloc_get_ptr(obj);
15321 : PyObject *py_name;
15322 0 : py_name = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.name);
15323 0 : return py_name;
15324 : }
15325 :
15326 0 : static int py_winreg_SetValue_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
15327 : {
15328 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15329 0 : if (value == NULL) {
15330 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.name");
15331 0 : return -1;
15332 : }
15333 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
15334 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
15335 0 : PyErr_NoMemory();
15336 0 : return -1;
15337 : }
15338 0 : object->in.name = *(struct winreg_String *)pytalloc_get_ptr(value);
15339 0 : return 0;
15340 : }
15341 :
15342 0 : static PyObject *py_winreg_SetValue_in_get_type(PyObject *obj, void *closure)
15343 : {
15344 0 : struct winreg_SetValue *object = pytalloc_get_ptr(obj);
15345 : PyObject *py_type;
15346 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(object->in.type));
15347 0 : return py_type;
15348 : }
15349 :
15350 0 : static int py_winreg_SetValue_in_set_type(PyObject *py_obj, PyObject *value, void *closure)
15351 : {
15352 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15353 0 : if (value == NULL) {
15354 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.type");
15355 0 : return -1;
15356 : }
15357 : {
15358 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.type));
15359 0 : if (PyLong_Check(value)) {
15360 : unsigned long long test_var;
15361 0 : test_var = PyLong_AsUnsignedLongLong(value);
15362 0 : if (PyErr_Occurred() != NULL) {
15363 0 : return -1;
15364 : }
15365 0 : if (test_var > uint_max) {
15366 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15367 : PyLong_Type.tp_name, uint_max, test_var);
15368 0 : return -1;
15369 : }
15370 0 : object->in.type = test_var;
15371 : } else {
15372 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15373 : PyLong_Type.tp_name);
15374 0 : return -1;
15375 : }
15376 : }
15377 0 : return 0;
15378 : }
15379 :
15380 0 : static PyObject *py_winreg_SetValue_in_get_data(PyObject *obj, void *closure)
15381 : {
15382 0 : struct winreg_SetValue *object = pytalloc_get_ptr(obj);
15383 : PyObject *py_data;
15384 0 : if (object->in.data == NULL) {
15385 0 : Py_RETURN_NONE;
15386 : }
15387 0 : py_data = PyList_New(object->in.size);
15388 0 : if (py_data == NULL) {
15389 0 : return NULL;
15390 : }
15391 : {
15392 : int data_cntr_1;
15393 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->in.size); data_cntr_1++) {
15394 : PyObject *py_data_1;
15395 0 : py_data_1 = PyLong_FromLong((uint16_t)((object->in.data)[data_cntr_1]));
15396 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
15397 : }
15398 : }
15399 0 : return py_data;
15400 : }
15401 :
15402 0 : static int py_winreg_SetValue_in_set_data(PyObject *py_obj, PyObject *value, void *closure)
15403 : {
15404 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15405 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data));
15406 0 : if (value == NULL) {
15407 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.data");
15408 0 : return -1;
15409 : }
15410 0 : object->in.data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data);
15411 0 : if (object->in.data == NULL) {
15412 0 : PyErr_NoMemory();
15413 0 : return -1;
15414 : }
15415 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
15416 : {
15417 : int data_cntr_1;
15418 0 : object->in.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data, PyList_GET_SIZE(value));
15419 0 : if (!object->in.data) { return -1; }
15420 0 : talloc_set_name_const(object->in.data, "ARRAY: object->in.data");
15421 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
15422 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
15423 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.data)[data_cntr_1]");
15424 0 : return -1;
15425 : }
15426 : {
15427 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->in.data)[data_cntr_1]));
15428 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
15429 : unsigned long long test_var;
15430 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
15431 0 : if (PyErr_Occurred() != NULL) {
15432 0 : return -1;
15433 : }
15434 0 : if (test_var > uint_max) {
15435 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15436 : PyLong_Type.tp_name, uint_max, test_var);
15437 0 : return -1;
15438 : }
15439 0 : (object->in.data)[data_cntr_1] = test_var;
15440 : } else {
15441 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15442 : PyLong_Type.tp_name);
15443 0 : return -1;
15444 : }
15445 : }
15446 : }
15447 : }
15448 0 : return 0;
15449 : }
15450 :
15451 0 : static PyObject *py_winreg_SetValue_in_get_size(PyObject *obj, void *closure)
15452 : {
15453 0 : struct winreg_SetValue *object = pytalloc_get_ptr(obj);
15454 : PyObject *py_size;
15455 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)(object->in.size));
15456 0 : return py_size;
15457 : }
15458 :
15459 0 : static int py_winreg_SetValue_in_set_size(PyObject *py_obj, PyObject *value, void *closure)
15460 : {
15461 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15462 0 : if (value == NULL) {
15463 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.size");
15464 0 : return -1;
15465 : }
15466 : {
15467 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.size));
15468 0 : if (PyLong_Check(value)) {
15469 : unsigned long long test_var;
15470 0 : test_var = PyLong_AsUnsignedLongLong(value);
15471 0 : if (PyErr_Occurred() != NULL) {
15472 0 : return -1;
15473 : }
15474 0 : if (test_var > uint_max) {
15475 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15476 : PyLong_Type.tp_name, uint_max, test_var);
15477 0 : return -1;
15478 : }
15479 0 : object->in.size = test_var;
15480 : } else {
15481 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15482 : PyLong_Type.tp_name);
15483 0 : return -1;
15484 : }
15485 : }
15486 0 : return 0;
15487 : }
15488 :
15489 0 : static PyObject *py_winreg_SetValue_get_result(PyObject *obj, void *closure)
15490 : {
15491 0 : struct winreg_SetValue *object = pytalloc_get_ptr(obj);
15492 : PyObject *py_result;
15493 0 : py_result = PyErr_FromWERROR(object->out.result);
15494 0 : return py_result;
15495 : }
15496 :
15497 0 : static int py_winreg_SetValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
15498 : {
15499 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15500 0 : if (value == NULL) {
15501 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
15502 0 : return -1;
15503 : }
15504 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
15505 0 : return 0;
15506 : }
15507 :
15508 : static PyGetSetDef py_winreg_SetValue_getsetters[] = {
15509 : {
15510 : .name = discard_const_p(char, "in_handle"),
15511 : .get = py_winreg_SetValue_in_get_handle,
15512 : .set = py_winreg_SetValue_in_set_handle,
15513 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
15514 : },
15515 : {
15516 : .name = discard_const_p(char, "in_name"),
15517 : .get = py_winreg_SetValue_in_get_name,
15518 : .set = py_winreg_SetValue_in_set_name,
15519 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
15520 : },
15521 : {
15522 : .name = discard_const_p(char, "in_type"),
15523 : .get = py_winreg_SetValue_in_get_type,
15524 : .set = py_winreg_SetValue_in_set_type,
15525 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
15526 : },
15527 : {
15528 : .name = discard_const_p(char, "in_data"),
15529 : .get = py_winreg_SetValue_in_get_data,
15530 : .set = py_winreg_SetValue_in_set_data,
15531 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
15532 : },
15533 : {
15534 : .name = discard_const_p(char, "in_size"),
15535 : .get = py_winreg_SetValue_in_get_size,
15536 : .set = py_winreg_SetValue_in_set_size,
15537 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
15538 : },
15539 : {
15540 : .name = discard_const_p(char, "result"),
15541 : .get = py_winreg_SetValue_get_result,
15542 : .set = py_winreg_SetValue_set_result,
15543 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
15544 : },
15545 : { .name = NULL }
15546 : };
15547 :
15548 0 : static PyObject *py_winreg_SetValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
15549 : {
15550 0 : PyObject *self = pytalloc_new(struct winreg_SetValue, type);
15551 0 : struct winreg_SetValue *_self = (struct winreg_SetValue *)pytalloc_get_ptr(self);
15552 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
15553 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
15554 0 : _self->in.data = talloc_zero(mem_ctx, uint8_t);
15555 0 : return self;
15556 : }
15557 :
15558 0 : static PyObject *py_winreg_SetValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
15559 : {
15560 :
15561 :
15562 0 : return PyLong_FromLong(22);
15563 : }
15564 :
15565 0 : static PyObject *py_winreg_SetValue_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
15566 : {
15567 0 : const struct ndr_interface_call *call = NULL;
15568 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15569 0 : PyObject *ret = NULL;
15570 0 : struct ndr_push *push = NULL;
15571 : DATA_BLOB blob;
15572 : enum ndr_err_code err;
15573 :
15574 0 : if (ndr_table_winreg.num_calls < 23) {
15575 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetValue_ndr_pack");
15576 0 : return NULL;
15577 : }
15578 0 : call = &ndr_table_winreg.calls[22];
15579 :
15580 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
15581 0 : if (push == NULL) {
15582 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
15583 0 : return NULL;
15584 : }
15585 :
15586 0 : push->flags |= ndr_push_flags;
15587 :
15588 0 : err = call->ndr_push(push, ndr_inout_flags, object);
15589 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
15590 0 : TALLOC_FREE(push);
15591 0 : PyErr_SetNdrError(err);
15592 0 : return NULL;
15593 : }
15594 0 : blob = ndr_push_blob(push);
15595 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
15596 0 : TALLOC_FREE(push);
15597 0 : return ret;
15598 : }
15599 :
15600 0 : static PyObject *py_winreg_SetValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15601 : {
15602 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
15603 0 : PyObject *bigendian_obj = NULL;
15604 0 : PyObject *ndr64_obj = NULL;
15605 0 : libndr_flags ndr_push_flags = 0;
15606 :
15607 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
15608 : discard_const_p(char *, kwnames),
15609 : &bigendian_obj,
15610 : &ndr64_obj)) {
15611 0 : return NULL;
15612 : }
15613 :
15614 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15615 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
15616 : }
15617 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15618 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
15619 : }
15620 :
15621 0 : return py_winreg_SetValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
15622 : }
15623 :
15624 0 : static PyObject *py_winreg_SetValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15625 : {
15626 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
15627 0 : PyObject *bigendian_obj = NULL;
15628 0 : PyObject *ndr64_obj = NULL;
15629 0 : libndr_flags ndr_push_flags = 0;
15630 :
15631 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
15632 : discard_const_p(char *, kwnames),
15633 : &bigendian_obj,
15634 : &ndr64_obj)) {
15635 0 : return NULL;
15636 : }
15637 :
15638 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15639 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
15640 : }
15641 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15642 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
15643 : }
15644 :
15645 0 : return py_winreg_SetValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
15646 : }
15647 :
15648 0 : static PyObject *py_winreg_SetValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
15649 : {
15650 0 : const struct ndr_interface_call *call = NULL;
15651 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15652 0 : struct ndr_pull *pull = NULL;
15653 : enum ndr_err_code err;
15654 :
15655 0 : if (ndr_table_winreg.num_calls < 23) {
15656 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetValue_ndr_unpack");
15657 0 : return NULL;
15658 : }
15659 0 : call = &ndr_table_winreg.calls[22];
15660 :
15661 0 : pull = ndr_pull_init_blob(blob, object);
15662 0 : if (pull == NULL) {
15663 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
15664 0 : return NULL;
15665 : }
15666 :
15667 0 : pull->flags |= ndr_pull_flags;
15668 :
15669 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
15670 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
15671 0 : TALLOC_FREE(pull);
15672 0 : PyErr_SetNdrError(err);
15673 0 : return NULL;
15674 : }
15675 0 : if (!allow_remaining) {
15676 : uint32_t highest_ofs;
15677 :
15678 0 : if (pull->offset > pull->relative_highest_offset) {
15679 0 : highest_ofs = pull->offset;
15680 : } else {
15681 0 : highest_ofs = pull->relative_highest_offset;
15682 : }
15683 0 : if (highest_ofs < pull->data_size) {
15684 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
15685 : "not all bytes consumed ofs[%u] size[%u]",
15686 : highest_ofs, pull->data_size);
15687 0 : TALLOC_FREE(pull);
15688 0 : PyErr_SetNdrError(err);
15689 0 : return NULL;
15690 : }
15691 : }
15692 :
15693 0 : TALLOC_FREE(pull);
15694 0 : Py_RETURN_NONE;
15695 : }
15696 :
15697 0 : static PyObject *py_winreg_SetValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15698 : {
15699 : DATA_BLOB blob;
15700 0 : Py_ssize_t blob_length = 0;
15701 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15702 0 : PyObject *bigendian_obj = NULL;
15703 0 : PyObject *ndr64_obj = NULL;
15704 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15705 0 : PyObject *allow_remaining_obj = NULL;
15706 0 : bool allow_remaining = false;
15707 :
15708 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
15709 : discard_const_p(char *, kwnames),
15710 : &blob.data, &blob_length,
15711 : &bigendian_obj,
15712 : &ndr64_obj,
15713 : &allow_remaining_obj)) {
15714 0 : return NULL;
15715 : }
15716 0 : blob.length = blob_length;
15717 :
15718 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15719 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15720 : }
15721 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15722 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15723 : }
15724 :
15725 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15726 0 : allow_remaining = true;
15727 : }
15728 :
15729 0 : return py_winreg_SetValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
15730 : }
15731 :
15732 0 : static PyObject *py_winreg_SetValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15733 : {
15734 : DATA_BLOB blob;
15735 0 : Py_ssize_t blob_length = 0;
15736 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15737 0 : PyObject *bigendian_obj = NULL;
15738 0 : PyObject *ndr64_obj = NULL;
15739 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15740 0 : PyObject *allow_remaining_obj = NULL;
15741 0 : bool allow_remaining = false;
15742 :
15743 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
15744 : discard_const_p(char *, kwnames),
15745 : &blob.data, &blob_length,
15746 : &bigendian_obj,
15747 : &ndr64_obj,
15748 : &allow_remaining_obj)) {
15749 0 : return NULL;
15750 : }
15751 0 : blob.length = blob_length;
15752 :
15753 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15754 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15755 : }
15756 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15757 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15758 : }
15759 :
15760 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15761 0 : allow_remaining = true;
15762 : }
15763 :
15764 0 : return py_winreg_SetValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
15765 : }
15766 :
15767 0 : static PyObject *py_winreg_SetValue_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
15768 : {
15769 0 : const struct ndr_interface_call *call = NULL;
15770 0 : struct winreg_SetValue *object = pytalloc_get_ptr(py_obj);
15771 : PyObject *ret;
15772 : char *retstr;
15773 :
15774 0 : if (ndr_table_winreg.num_calls < 23) {
15775 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetValue_ndr_print");
15776 0 : return NULL;
15777 : }
15778 0 : call = &ndr_table_winreg.calls[22];
15779 :
15780 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
15781 0 : ret = PyUnicode_FromString(retstr);
15782 0 : TALLOC_FREE(retstr);
15783 :
15784 0 : return ret;
15785 : }
15786 :
15787 0 : static PyObject *py_winreg_SetValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15788 : {
15789 0 : return py_winreg_SetValue_ndr_print(py_obj, "winreg_SetValue_in", NDR_IN);
15790 : }
15791 :
15792 0 : static PyObject *py_winreg_SetValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15793 : {
15794 0 : return py_winreg_SetValue_ndr_print(py_obj, "winreg_SetValue_out", NDR_OUT);
15795 : }
15796 :
15797 : static PyMethodDef py_winreg_SetValue_methods[] = {
15798 : { "opnum", (PyCFunction)py_winreg_SetValue_ndr_opnum, METH_NOARGS|METH_CLASS,
15799 : "winreg.SetValue.opnum() -> 22 (0x16) " },
15800 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
15801 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
15802 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
15803 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
15804 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
15805 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
15806 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
15807 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
15808 : { "__ndr_print_in__", (PyCFunction)py_winreg_SetValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
15809 : { "__ndr_print_out__", (PyCFunction)py_winreg_SetValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
15810 : { NULL, NULL, 0, NULL }
15811 : };
15812 :
15813 :
15814 : static PyTypeObject winreg_SetValue_Type = {
15815 : PyVarObject_HEAD_INIT(NULL, 0)
15816 : .tp_name = "winreg.SetValue",
15817 : .tp_getset = py_winreg_SetValue_getsetters,
15818 : .tp_methods = py_winreg_SetValue_methods,
15819 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
15820 : .tp_new = py_winreg_SetValue_new,
15821 : };
15822 :
15823 0 : static bool pack_py_winreg_SetValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_SetValue *r)
15824 : {
15825 : PyObject *py_handle;
15826 : PyObject *py_name;
15827 : PyObject *py_type;
15828 : PyObject *py_data;
15829 0 : const char *kwnames[] = {
15830 : "handle", "name", "type", "data", NULL
15831 : };
15832 :
15833 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_SetValue", discard_const_p(char *, kwnames), &py_handle, &py_name, &py_type, &py_data)) {
15834 0 : return false;
15835 : }
15836 :
15837 0 : if (py_handle == NULL) {
15838 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
15839 0 : return false;
15840 : }
15841 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
15842 0 : if (r->in.handle == NULL) {
15843 0 : PyErr_NoMemory();
15844 0 : return false;
15845 : }
15846 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
15847 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
15848 0 : PyErr_NoMemory();
15849 0 : return false;
15850 : }
15851 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
15852 0 : if (py_name == NULL) {
15853 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.name");
15854 0 : return false;
15855 : }
15856 0 : PY_CHECK_TYPE(&winreg_String_Type, py_name, return false;);
15857 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
15858 0 : PyErr_NoMemory();
15859 0 : return false;
15860 : }
15861 0 : r->in.name = *(struct winreg_String *)pytalloc_get_ptr(py_name);
15862 0 : if (py_type == NULL) {
15863 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.type");
15864 0 : return false;
15865 : }
15866 : {
15867 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.type));
15868 0 : if (PyLong_Check(py_type)) {
15869 : unsigned long long test_var;
15870 0 : test_var = PyLong_AsUnsignedLongLong(py_type);
15871 0 : if (PyErr_Occurred() != NULL) {
15872 0 : return false;
15873 : }
15874 0 : if (test_var > uint_max) {
15875 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15876 : PyLong_Type.tp_name, uint_max, test_var);
15877 0 : return false;
15878 : }
15879 0 : r->in.type = test_var;
15880 : } else {
15881 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15882 : PyLong_Type.tp_name);
15883 0 : return false;
15884 : }
15885 : }
15886 0 : if (py_data == NULL) {
15887 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.data");
15888 0 : return false;
15889 : }
15890 0 : r->in.data = talloc_ptrtype(r, r->in.data);
15891 0 : if (r->in.data == NULL) {
15892 0 : PyErr_NoMemory();
15893 0 : return false;
15894 : }
15895 0 : PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
15896 : {
15897 : int data_cntr_1;
15898 0 : r->in.data = talloc_array_ptrtype(r, r->in.data, PyList_GET_SIZE(py_data));
15899 0 : if (!r->in.data) { return false; }
15900 0 : talloc_set_name_const(r->in.data, "ARRAY: r->in.data");
15901 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(py_data); data_cntr_1++) {
15902 0 : if (PyList_GET_ITEM(py_data, data_cntr_1) == NULL) {
15903 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.data)[data_cntr_1]");
15904 0 : return false;
15905 : }
15906 : {
15907 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((r->in.data)[data_cntr_1]));
15908 0 : if (PyLong_Check(PyList_GET_ITEM(py_data, data_cntr_1))) {
15909 : unsigned long long test_var;
15910 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_data, data_cntr_1));
15911 0 : if (PyErr_Occurred() != NULL) {
15912 0 : return false;
15913 : }
15914 0 : if (test_var > uint_max) {
15915 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15916 : PyLong_Type.tp_name, uint_max, test_var);
15917 0 : return false;
15918 : }
15919 0 : (r->in.data)[data_cntr_1] = test_var;
15920 : } else {
15921 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15922 : PyLong_Type.tp_name);
15923 0 : return false;
15924 : }
15925 : }
15926 : }
15927 : }
15928 0 : PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
15929 0 : r->in.size = PyList_GET_SIZE(py_data);
15930 0 : return true;
15931 : }
15932 :
15933 0 : static PyObject *unpack_py_winreg_SetValue_args_out(struct winreg_SetValue *r)
15934 : {
15935 : PyObject *result;
15936 0 : result = Py_None;
15937 0 : Py_INCREF(result);
15938 0 : if (!W_ERROR_IS_OK(r->out.result)) {
15939 0 : PyErr_SetWERROR(r->out.result);
15940 0 : return NULL;
15941 : }
15942 :
15943 0 : return result;
15944 : }
15945 :
15946 :
15947 0 : static PyObject *py_winreg_UnLoadKey_in_get_handle(PyObject *obj, void *closure)
15948 : {
15949 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(obj);
15950 : PyObject *py_handle;
15951 0 : if (object->in.handle == NULL) {
15952 0 : Py_RETURN_NONE;
15953 : }
15954 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
15955 0 : return py_handle;
15956 : }
15957 :
15958 0 : static int py_winreg_UnLoadKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
15959 : {
15960 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(py_obj);
15961 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
15962 0 : if (value == NULL) {
15963 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
15964 0 : return -1;
15965 : }
15966 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
15967 0 : if (object->in.handle == NULL) {
15968 0 : PyErr_NoMemory();
15969 0 : return -1;
15970 : }
15971 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
15972 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
15973 0 : PyErr_NoMemory();
15974 0 : return -1;
15975 : }
15976 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
15977 0 : return 0;
15978 : }
15979 :
15980 0 : static PyObject *py_winreg_UnLoadKey_in_get_subkey(PyObject *obj, void *closure)
15981 : {
15982 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(obj);
15983 : PyObject *py_subkey;
15984 0 : if (object->in.subkey == NULL) {
15985 0 : Py_RETURN_NONE;
15986 : }
15987 0 : py_subkey = pytalloc_reference_ex(&winreg_String_Type, object->in.subkey, object->in.subkey);
15988 0 : return py_subkey;
15989 : }
15990 :
15991 0 : static int py_winreg_UnLoadKey_in_set_subkey(PyObject *py_obj, PyObject *value, void *closure)
15992 : {
15993 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(py_obj);
15994 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.subkey));
15995 0 : if (value == NULL) {
15996 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.subkey");
15997 0 : return -1;
15998 : }
15999 0 : object->in.subkey = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.subkey);
16000 0 : if (object->in.subkey == NULL) {
16001 0 : PyErr_NoMemory();
16002 0 : return -1;
16003 : }
16004 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
16005 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
16006 0 : PyErr_NoMemory();
16007 0 : return -1;
16008 : }
16009 0 : object->in.subkey = (struct winreg_String *)pytalloc_get_ptr(value);
16010 0 : return 0;
16011 : }
16012 :
16013 0 : static PyObject *py_winreg_UnLoadKey_get_result(PyObject *obj, void *closure)
16014 : {
16015 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(obj);
16016 : PyObject *py_result;
16017 0 : py_result = PyErr_FromWERROR(object->out.result);
16018 0 : return py_result;
16019 : }
16020 :
16021 0 : static int py_winreg_UnLoadKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
16022 : {
16023 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(py_obj);
16024 0 : if (value == NULL) {
16025 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
16026 0 : return -1;
16027 : }
16028 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
16029 0 : return 0;
16030 : }
16031 :
16032 : static PyGetSetDef py_winreg_UnLoadKey_getsetters[] = {
16033 : {
16034 : .name = discard_const_p(char, "in_handle"),
16035 : .get = py_winreg_UnLoadKey_in_get_handle,
16036 : .set = py_winreg_UnLoadKey_in_set_handle,
16037 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
16038 : },
16039 : {
16040 : .name = discard_const_p(char, "in_subkey"),
16041 : .get = py_winreg_UnLoadKey_in_get_subkey,
16042 : .set = py_winreg_UnLoadKey_in_set_subkey,
16043 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
16044 : },
16045 : {
16046 : .name = discard_const_p(char, "result"),
16047 : .get = py_winreg_UnLoadKey_get_result,
16048 : .set = py_winreg_UnLoadKey_set_result,
16049 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
16050 : },
16051 : { .name = NULL }
16052 : };
16053 :
16054 0 : static PyObject *py_winreg_UnLoadKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
16055 : {
16056 0 : PyObject *self = pytalloc_new(struct winreg_UnLoadKey, type);
16057 0 : struct winreg_UnLoadKey *_self = (struct winreg_UnLoadKey *)pytalloc_get_ptr(self);
16058 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
16059 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
16060 0 : _self->in.subkey = talloc_zero(mem_ctx, struct winreg_String);
16061 0 : return self;
16062 : }
16063 :
16064 0 : static PyObject *py_winreg_UnLoadKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
16065 : {
16066 :
16067 :
16068 0 : return PyLong_FromLong(23);
16069 : }
16070 :
16071 0 : static PyObject *py_winreg_UnLoadKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
16072 : {
16073 0 : const struct ndr_interface_call *call = NULL;
16074 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(py_obj);
16075 0 : PyObject *ret = NULL;
16076 0 : struct ndr_push *push = NULL;
16077 : DATA_BLOB blob;
16078 : enum ndr_err_code err;
16079 :
16080 0 : if (ndr_table_winreg.num_calls < 24) {
16081 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_UnLoadKey_ndr_pack");
16082 0 : return NULL;
16083 : }
16084 0 : call = &ndr_table_winreg.calls[23];
16085 :
16086 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
16087 0 : if (push == NULL) {
16088 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16089 0 : return NULL;
16090 : }
16091 :
16092 0 : push->flags |= ndr_push_flags;
16093 :
16094 0 : err = call->ndr_push(push, ndr_inout_flags, object);
16095 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16096 0 : TALLOC_FREE(push);
16097 0 : PyErr_SetNdrError(err);
16098 0 : return NULL;
16099 : }
16100 0 : blob = ndr_push_blob(push);
16101 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
16102 0 : TALLOC_FREE(push);
16103 0 : return ret;
16104 : }
16105 :
16106 0 : static PyObject *py_winreg_UnLoadKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16107 : {
16108 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16109 0 : PyObject *bigendian_obj = NULL;
16110 0 : PyObject *ndr64_obj = NULL;
16111 0 : libndr_flags ndr_push_flags = 0;
16112 :
16113 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
16114 : discard_const_p(char *, kwnames),
16115 : &bigendian_obj,
16116 : &ndr64_obj)) {
16117 0 : return NULL;
16118 : }
16119 :
16120 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16121 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16122 : }
16123 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16124 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16125 : }
16126 :
16127 0 : return py_winreg_UnLoadKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
16128 : }
16129 :
16130 0 : static PyObject *py_winreg_UnLoadKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16131 : {
16132 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16133 0 : PyObject *bigendian_obj = NULL;
16134 0 : PyObject *ndr64_obj = NULL;
16135 0 : libndr_flags ndr_push_flags = 0;
16136 :
16137 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
16138 : discard_const_p(char *, kwnames),
16139 : &bigendian_obj,
16140 : &ndr64_obj)) {
16141 0 : return NULL;
16142 : }
16143 :
16144 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16145 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16146 : }
16147 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16148 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16149 : }
16150 :
16151 0 : return py_winreg_UnLoadKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
16152 : }
16153 :
16154 0 : static PyObject *py_winreg_UnLoadKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
16155 : {
16156 0 : const struct ndr_interface_call *call = NULL;
16157 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(py_obj);
16158 0 : struct ndr_pull *pull = NULL;
16159 : enum ndr_err_code err;
16160 :
16161 0 : if (ndr_table_winreg.num_calls < 24) {
16162 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_UnLoadKey_ndr_unpack");
16163 0 : return NULL;
16164 : }
16165 0 : call = &ndr_table_winreg.calls[23];
16166 :
16167 0 : pull = ndr_pull_init_blob(blob, object);
16168 0 : if (pull == NULL) {
16169 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16170 0 : return NULL;
16171 : }
16172 :
16173 0 : pull->flags |= ndr_pull_flags;
16174 :
16175 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
16176 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16177 0 : TALLOC_FREE(pull);
16178 0 : PyErr_SetNdrError(err);
16179 0 : return NULL;
16180 : }
16181 0 : if (!allow_remaining) {
16182 : uint32_t highest_ofs;
16183 :
16184 0 : if (pull->offset > pull->relative_highest_offset) {
16185 0 : highest_ofs = pull->offset;
16186 : } else {
16187 0 : highest_ofs = pull->relative_highest_offset;
16188 : }
16189 0 : if (highest_ofs < pull->data_size) {
16190 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
16191 : "not all bytes consumed ofs[%u] size[%u]",
16192 : highest_ofs, pull->data_size);
16193 0 : TALLOC_FREE(pull);
16194 0 : PyErr_SetNdrError(err);
16195 0 : return NULL;
16196 : }
16197 : }
16198 :
16199 0 : TALLOC_FREE(pull);
16200 0 : Py_RETURN_NONE;
16201 : }
16202 :
16203 0 : static PyObject *py_winreg_UnLoadKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16204 : {
16205 : DATA_BLOB blob;
16206 0 : Py_ssize_t blob_length = 0;
16207 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16208 0 : PyObject *bigendian_obj = NULL;
16209 0 : PyObject *ndr64_obj = NULL;
16210 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16211 0 : PyObject *allow_remaining_obj = NULL;
16212 0 : bool allow_remaining = false;
16213 :
16214 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
16215 : discard_const_p(char *, kwnames),
16216 : &blob.data, &blob_length,
16217 : &bigendian_obj,
16218 : &ndr64_obj,
16219 : &allow_remaining_obj)) {
16220 0 : return NULL;
16221 : }
16222 0 : blob.length = blob_length;
16223 :
16224 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16225 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16226 : }
16227 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16228 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16229 : }
16230 :
16231 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16232 0 : allow_remaining = true;
16233 : }
16234 :
16235 0 : return py_winreg_UnLoadKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
16236 : }
16237 :
16238 0 : static PyObject *py_winreg_UnLoadKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16239 : {
16240 : DATA_BLOB blob;
16241 0 : Py_ssize_t blob_length = 0;
16242 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16243 0 : PyObject *bigendian_obj = NULL;
16244 0 : PyObject *ndr64_obj = NULL;
16245 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16246 0 : PyObject *allow_remaining_obj = NULL;
16247 0 : bool allow_remaining = false;
16248 :
16249 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
16250 : discard_const_p(char *, kwnames),
16251 : &blob.data, &blob_length,
16252 : &bigendian_obj,
16253 : &ndr64_obj,
16254 : &allow_remaining_obj)) {
16255 0 : return NULL;
16256 : }
16257 0 : blob.length = blob_length;
16258 :
16259 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16260 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16261 : }
16262 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16263 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16264 : }
16265 :
16266 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16267 0 : allow_remaining = true;
16268 : }
16269 :
16270 0 : return py_winreg_UnLoadKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
16271 : }
16272 :
16273 0 : static PyObject *py_winreg_UnLoadKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
16274 : {
16275 0 : const struct ndr_interface_call *call = NULL;
16276 0 : struct winreg_UnLoadKey *object = pytalloc_get_ptr(py_obj);
16277 : PyObject *ret;
16278 : char *retstr;
16279 :
16280 0 : if (ndr_table_winreg.num_calls < 24) {
16281 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_UnLoadKey_ndr_print");
16282 0 : return NULL;
16283 : }
16284 0 : call = &ndr_table_winreg.calls[23];
16285 :
16286 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
16287 0 : ret = PyUnicode_FromString(retstr);
16288 0 : TALLOC_FREE(retstr);
16289 :
16290 0 : return ret;
16291 : }
16292 :
16293 0 : static PyObject *py_winreg_UnLoadKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16294 : {
16295 0 : return py_winreg_UnLoadKey_ndr_print(py_obj, "winreg_UnLoadKey_in", NDR_IN);
16296 : }
16297 :
16298 0 : static PyObject *py_winreg_UnLoadKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16299 : {
16300 0 : return py_winreg_UnLoadKey_ndr_print(py_obj, "winreg_UnLoadKey_out", NDR_OUT);
16301 : }
16302 :
16303 : static PyMethodDef py_winreg_UnLoadKey_methods[] = {
16304 : { "opnum", (PyCFunction)py_winreg_UnLoadKey_ndr_opnum, METH_NOARGS|METH_CLASS,
16305 : "winreg.UnLoadKey.opnum() -> 23 (0x17) " },
16306 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
16307 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
16308 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
16309 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
16310 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
16311 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
16312 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
16313 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
16314 : { "__ndr_print_in__", (PyCFunction)py_winreg_UnLoadKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
16315 : { "__ndr_print_out__", (PyCFunction)py_winreg_UnLoadKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
16316 : { NULL, NULL, 0, NULL }
16317 : };
16318 :
16319 :
16320 : static PyTypeObject winreg_UnLoadKey_Type = {
16321 : PyVarObject_HEAD_INIT(NULL, 0)
16322 : .tp_name = "winreg.UnLoadKey",
16323 : .tp_getset = py_winreg_UnLoadKey_getsetters,
16324 : .tp_methods = py_winreg_UnLoadKey_methods,
16325 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
16326 : .tp_new = py_winreg_UnLoadKey_new,
16327 : };
16328 :
16329 0 : static bool pack_py_winreg_UnLoadKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_UnLoadKey *r)
16330 : {
16331 : PyObject *py_handle;
16332 : PyObject *py_subkey;
16333 0 : const char *kwnames[] = {
16334 : "handle", "subkey", NULL
16335 : };
16336 :
16337 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_UnLoadKey", discard_const_p(char *, kwnames), &py_handle, &py_subkey)) {
16338 0 : return false;
16339 : }
16340 :
16341 0 : if (py_handle == NULL) {
16342 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
16343 0 : return false;
16344 : }
16345 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
16346 0 : if (r->in.handle == NULL) {
16347 0 : PyErr_NoMemory();
16348 0 : return false;
16349 : }
16350 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
16351 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
16352 0 : PyErr_NoMemory();
16353 0 : return false;
16354 : }
16355 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
16356 0 : if (py_subkey == NULL) {
16357 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.subkey");
16358 0 : return false;
16359 : }
16360 0 : r->in.subkey = talloc_ptrtype(r, r->in.subkey);
16361 0 : if (r->in.subkey == NULL) {
16362 0 : PyErr_NoMemory();
16363 0 : return false;
16364 : }
16365 0 : PY_CHECK_TYPE(&winreg_String_Type, py_subkey, return false;);
16366 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_subkey)) == NULL) {
16367 0 : PyErr_NoMemory();
16368 0 : return false;
16369 : }
16370 0 : r->in.subkey = (struct winreg_String *)pytalloc_get_ptr(py_subkey);
16371 0 : return true;
16372 : }
16373 :
16374 0 : static PyObject *unpack_py_winreg_UnLoadKey_args_out(struct winreg_UnLoadKey *r)
16375 : {
16376 : PyObject *result;
16377 0 : result = Py_None;
16378 0 : Py_INCREF(result);
16379 0 : if (!W_ERROR_IS_OK(r->out.result)) {
16380 0 : PyErr_SetWERROR(r->out.result);
16381 0 : return NULL;
16382 : }
16383 :
16384 0 : return result;
16385 : }
16386 :
16387 :
16388 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_hostname(PyObject *obj, void *closure)
16389 : {
16390 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(obj);
16391 : PyObject *py_hostname;
16392 0 : if (object->in.hostname == NULL) {
16393 0 : Py_RETURN_NONE;
16394 : }
16395 0 : if (object->in.hostname == NULL) {
16396 0 : py_hostname = Py_None;
16397 0 : Py_INCREF(py_hostname);
16398 : } else {
16399 0 : py_hostname = PyLong_FromLong((uint16_t)(*object->in.hostname));
16400 : }
16401 0 : return py_hostname;
16402 : }
16403 :
16404 0 : static int py_winreg_InitiateSystemShutdown_in_set_hostname(PyObject *py_obj, PyObject *value, void *closure)
16405 : {
16406 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16407 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.hostname));
16408 0 : if (value == NULL) {
16409 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.hostname");
16410 0 : return -1;
16411 : }
16412 0 : if (value == Py_None) {
16413 0 : object->in.hostname = NULL;
16414 : } else {
16415 0 : object->in.hostname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.hostname);
16416 0 : if (object->in.hostname == NULL) {
16417 0 : PyErr_NoMemory();
16418 0 : return -1;
16419 : }
16420 : {
16421 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.hostname));
16422 0 : if (PyLong_Check(value)) {
16423 : unsigned long long test_var;
16424 0 : test_var = PyLong_AsUnsignedLongLong(value);
16425 0 : if (PyErr_Occurred() != NULL) {
16426 0 : return -1;
16427 : }
16428 0 : if (test_var > uint_max) {
16429 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16430 : PyLong_Type.tp_name, uint_max, test_var);
16431 0 : return -1;
16432 : }
16433 0 : *object->in.hostname = test_var;
16434 : } else {
16435 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16436 : PyLong_Type.tp_name);
16437 0 : return -1;
16438 : }
16439 : }
16440 : }
16441 0 : return 0;
16442 : }
16443 :
16444 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_message(PyObject *obj, void *closure)
16445 : {
16446 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(obj);
16447 : PyObject *py_message;
16448 0 : if (object->in.message == NULL) {
16449 0 : Py_RETURN_NONE;
16450 : }
16451 0 : if (object->in.message == NULL) {
16452 0 : py_message = Py_None;
16453 0 : Py_INCREF(py_message);
16454 : } else {
16455 0 : py_message = pytalloc_reference_ex(lsa_StringLarge_Type, object->in.message, object->in.message);
16456 : }
16457 0 : return py_message;
16458 : }
16459 :
16460 0 : static int py_winreg_InitiateSystemShutdown_in_set_message(PyObject *py_obj, PyObject *value, void *closure)
16461 : {
16462 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16463 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.message));
16464 0 : if (value == NULL) {
16465 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.message");
16466 0 : return -1;
16467 : }
16468 0 : if (value == Py_None) {
16469 0 : object->in.message = NULL;
16470 : } else {
16471 0 : object->in.message = NULL;
16472 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, value, return -1;);
16473 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
16474 0 : PyErr_NoMemory();
16475 0 : return -1;
16476 : }
16477 0 : object->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(value);
16478 : }
16479 0 : return 0;
16480 : }
16481 :
16482 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_timeout(PyObject *obj, void *closure)
16483 : {
16484 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(obj);
16485 : PyObject *py_timeout;
16486 0 : py_timeout = PyLong_FromUnsignedLongLong((uint32_t)(object->in.timeout));
16487 0 : return py_timeout;
16488 : }
16489 :
16490 0 : static int py_winreg_InitiateSystemShutdown_in_set_timeout(PyObject *py_obj, PyObject *value, void *closure)
16491 : {
16492 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16493 0 : if (value == NULL) {
16494 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.timeout");
16495 0 : return -1;
16496 : }
16497 : {
16498 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.timeout));
16499 0 : if (PyLong_Check(value)) {
16500 : unsigned long long test_var;
16501 0 : test_var = PyLong_AsUnsignedLongLong(value);
16502 0 : if (PyErr_Occurred() != NULL) {
16503 0 : return -1;
16504 : }
16505 0 : if (test_var > uint_max) {
16506 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16507 : PyLong_Type.tp_name, uint_max, test_var);
16508 0 : return -1;
16509 : }
16510 0 : object->in.timeout = test_var;
16511 : } else {
16512 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16513 : PyLong_Type.tp_name);
16514 0 : return -1;
16515 : }
16516 : }
16517 0 : return 0;
16518 : }
16519 :
16520 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_force_apps(PyObject *obj, void *closure)
16521 : {
16522 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(obj);
16523 : PyObject *py_force_apps;
16524 0 : py_force_apps = PyLong_FromLong((uint16_t)(object->in.force_apps));
16525 0 : return py_force_apps;
16526 : }
16527 :
16528 0 : static int py_winreg_InitiateSystemShutdown_in_set_force_apps(PyObject *py_obj, PyObject *value, void *closure)
16529 : {
16530 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16531 0 : if (value == NULL) {
16532 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.force_apps");
16533 0 : return -1;
16534 : }
16535 : {
16536 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.force_apps));
16537 0 : if (PyLong_Check(value)) {
16538 : unsigned long long test_var;
16539 0 : test_var = PyLong_AsUnsignedLongLong(value);
16540 0 : if (PyErr_Occurred() != NULL) {
16541 0 : return -1;
16542 : }
16543 0 : if (test_var > uint_max) {
16544 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16545 : PyLong_Type.tp_name, uint_max, test_var);
16546 0 : return -1;
16547 : }
16548 0 : object->in.force_apps = test_var;
16549 : } else {
16550 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16551 : PyLong_Type.tp_name);
16552 0 : return -1;
16553 : }
16554 : }
16555 0 : return 0;
16556 : }
16557 :
16558 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_do_reboot(PyObject *obj, void *closure)
16559 : {
16560 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(obj);
16561 : PyObject *py_do_reboot;
16562 0 : py_do_reboot = PyLong_FromLong((uint16_t)(object->in.do_reboot));
16563 0 : return py_do_reboot;
16564 : }
16565 :
16566 0 : static int py_winreg_InitiateSystemShutdown_in_set_do_reboot(PyObject *py_obj, PyObject *value, void *closure)
16567 : {
16568 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16569 0 : if (value == NULL) {
16570 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.do_reboot");
16571 0 : return -1;
16572 : }
16573 : {
16574 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.do_reboot));
16575 0 : if (PyLong_Check(value)) {
16576 : unsigned long long test_var;
16577 0 : test_var = PyLong_AsUnsignedLongLong(value);
16578 0 : if (PyErr_Occurred() != NULL) {
16579 0 : return -1;
16580 : }
16581 0 : if (test_var > uint_max) {
16582 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16583 : PyLong_Type.tp_name, uint_max, test_var);
16584 0 : return -1;
16585 : }
16586 0 : object->in.do_reboot = test_var;
16587 : } else {
16588 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16589 : PyLong_Type.tp_name);
16590 0 : return -1;
16591 : }
16592 : }
16593 0 : return 0;
16594 : }
16595 :
16596 0 : static PyObject *py_winreg_InitiateSystemShutdown_get_result(PyObject *obj, void *closure)
16597 : {
16598 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(obj);
16599 : PyObject *py_result;
16600 0 : py_result = PyErr_FromWERROR(object->out.result);
16601 0 : return py_result;
16602 : }
16603 :
16604 0 : static int py_winreg_InitiateSystemShutdown_set_result(PyObject *py_obj, PyObject *value, void *closure)
16605 : {
16606 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16607 0 : if (value == NULL) {
16608 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
16609 0 : return -1;
16610 : }
16611 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
16612 0 : return 0;
16613 : }
16614 :
16615 : static PyGetSetDef py_winreg_InitiateSystemShutdown_getsetters[] = {
16616 : {
16617 : .name = discard_const_p(char, "in_hostname"),
16618 : .get = py_winreg_InitiateSystemShutdown_in_get_hostname,
16619 : .set = py_winreg_InitiateSystemShutdown_in_set_hostname,
16620 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
16621 : },
16622 : {
16623 : .name = discard_const_p(char, "in_message"),
16624 : .get = py_winreg_InitiateSystemShutdown_in_get_message,
16625 : .set = py_winreg_InitiateSystemShutdown_in_set_message,
16626 : .doc = discard_const_p(char, "PIDL-generated element of base type lsa_StringLarge")
16627 : },
16628 : {
16629 : .name = discard_const_p(char, "in_timeout"),
16630 : .get = py_winreg_InitiateSystemShutdown_in_get_timeout,
16631 : .set = py_winreg_InitiateSystemShutdown_in_set_timeout,
16632 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
16633 : },
16634 : {
16635 : .name = discard_const_p(char, "in_force_apps"),
16636 : .get = py_winreg_InitiateSystemShutdown_in_get_force_apps,
16637 : .set = py_winreg_InitiateSystemShutdown_in_set_force_apps,
16638 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
16639 : },
16640 : {
16641 : .name = discard_const_p(char, "in_do_reboot"),
16642 : .get = py_winreg_InitiateSystemShutdown_in_get_do_reboot,
16643 : .set = py_winreg_InitiateSystemShutdown_in_set_do_reboot,
16644 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
16645 : },
16646 : {
16647 : .name = discard_const_p(char, "result"),
16648 : .get = py_winreg_InitiateSystemShutdown_get_result,
16649 : .set = py_winreg_InitiateSystemShutdown_set_result,
16650 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
16651 : },
16652 : { .name = NULL }
16653 : };
16654 :
16655 0 : static PyObject *py_winreg_InitiateSystemShutdown_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
16656 : {
16657 0 : PyObject *self = pytalloc_new(struct winreg_InitiateSystemShutdown, type);
16658 0 : return self;
16659 : }
16660 :
16661 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
16662 : {
16663 :
16664 :
16665 0 : return PyLong_FromLong(24);
16666 : }
16667 :
16668 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
16669 : {
16670 0 : const struct ndr_interface_call *call = NULL;
16671 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16672 0 : PyObject *ret = NULL;
16673 0 : struct ndr_push *push = NULL;
16674 : DATA_BLOB blob;
16675 : enum ndr_err_code err;
16676 :
16677 0 : if (ndr_table_winreg.num_calls < 25) {
16678 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdown_ndr_pack");
16679 0 : return NULL;
16680 : }
16681 0 : call = &ndr_table_winreg.calls[24];
16682 :
16683 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
16684 0 : if (push == NULL) {
16685 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16686 0 : return NULL;
16687 : }
16688 :
16689 0 : push->flags |= ndr_push_flags;
16690 :
16691 0 : err = call->ndr_push(push, ndr_inout_flags, object);
16692 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16693 0 : TALLOC_FREE(push);
16694 0 : PyErr_SetNdrError(err);
16695 0 : return NULL;
16696 : }
16697 0 : blob = ndr_push_blob(push);
16698 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
16699 0 : TALLOC_FREE(push);
16700 0 : return ret;
16701 : }
16702 :
16703 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16704 : {
16705 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16706 0 : PyObject *bigendian_obj = NULL;
16707 0 : PyObject *ndr64_obj = NULL;
16708 0 : libndr_flags ndr_push_flags = 0;
16709 :
16710 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
16711 : discard_const_p(char *, kwnames),
16712 : &bigendian_obj,
16713 : &ndr64_obj)) {
16714 0 : return NULL;
16715 : }
16716 :
16717 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16718 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16719 : }
16720 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16721 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16722 : }
16723 :
16724 0 : return py_winreg_InitiateSystemShutdown_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
16725 : }
16726 :
16727 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16728 : {
16729 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16730 0 : PyObject *bigendian_obj = NULL;
16731 0 : PyObject *ndr64_obj = NULL;
16732 0 : libndr_flags ndr_push_flags = 0;
16733 :
16734 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
16735 : discard_const_p(char *, kwnames),
16736 : &bigendian_obj,
16737 : &ndr64_obj)) {
16738 0 : return NULL;
16739 : }
16740 :
16741 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16742 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16743 : }
16744 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16745 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16746 : }
16747 :
16748 0 : return py_winreg_InitiateSystemShutdown_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
16749 : }
16750 :
16751 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
16752 : {
16753 0 : const struct ndr_interface_call *call = NULL;
16754 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16755 0 : struct ndr_pull *pull = NULL;
16756 : enum ndr_err_code err;
16757 :
16758 0 : if (ndr_table_winreg.num_calls < 25) {
16759 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdown_ndr_unpack");
16760 0 : return NULL;
16761 : }
16762 0 : call = &ndr_table_winreg.calls[24];
16763 :
16764 0 : pull = ndr_pull_init_blob(blob, object);
16765 0 : if (pull == NULL) {
16766 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16767 0 : return NULL;
16768 : }
16769 :
16770 0 : pull->flags |= ndr_pull_flags;
16771 :
16772 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
16773 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16774 0 : TALLOC_FREE(pull);
16775 0 : PyErr_SetNdrError(err);
16776 0 : return NULL;
16777 : }
16778 0 : if (!allow_remaining) {
16779 : uint32_t highest_ofs;
16780 :
16781 0 : if (pull->offset > pull->relative_highest_offset) {
16782 0 : highest_ofs = pull->offset;
16783 : } else {
16784 0 : highest_ofs = pull->relative_highest_offset;
16785 : }
16786 0 : if (highest_ofs < pull->data_size) {
16787 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
16788 : "not all bytes consumed ofs[%u] size[%u]",
16789 : highest_ofs, pull->data_size);
16790 0 : TALLOC_FREE(pull);
16791 0 : PyErr_SetNdrError(err);
16792 0 : return NULL;
16793 : }
16794 : }
16795 :
16796 0 : TALLOC_FREE(pull);
16797 0 : Py_RETURN_NONE;
16798 : }
16799 :
16800 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16801 : {
16802 : DATA_BLOB blob;
16803 0 : Py_ssize_t blob_length = 0;
16804 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16805 0 : PyObject *bigendian_obj = NULL;
16806 0 : PyObject *ndr64_obj = NULL;
16807 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16808 0 : PyObject *allow_remaining_obj = NULL;
16809 0 : bool allow_remaining = false;
16810 :
16811 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
16812 : discard_const_p(char *, kwnames),
16813 : &blob.data, &blob_length,
16814 : &bigendian_obj,
16815 : &ndr64_obj,
16816 : &allow_remaining_obj)) {
16817 0 : return NULL;
16818 : }
16819 0 : blob.length = blob_length;
16820 :
16821 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16822 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16823 : }
16824 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16825 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16826 : }
16827 :
16828 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16829 0 : allow_remaining = true;
16830 : }
16831 :
16832 0 : return py_winreg_InitiateSystemShutdown_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
16833 : }
16834 :
16835 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16836 : {
16837 : DATA_BLOB blob;
16838 0 : Py_ssize_t blob_length = 0;
16839 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16840 0 : PyObject *bigendian_obj = NULL;
16841 0 : PyObject *ndr64_obj = NULL;
16842 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16843 0 : PyObject *allow_remaining_obj = NULL;
16844 0 : bool allow_remaining = false;
16845 :
16846 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
16847 : discard_const_p(char *, kwnames),
16848 : &blob.data, &blob_length,
16849 : &bigendian_obj,
16850 : &ndr64_obj,
16851 : &allow_remaining_obj)) {
16852 0 : return NULL;
16853 : }
16854 0 : blob.length = blob_length;
16855 :
16856 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16857 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16858 : }
16859 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16860 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16861 : }
16862 :
16863 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16864 0 : allow_remaining = true;
16865 : }
16866 :
16867 0 : return py_winreg_InitiateSystemShutdown_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
16868 : }
16869 :
16870 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
16871 : {
16872 0 : const struct ndr_interface_call *call = NULL;
16873 0 : struct winreg_InitiateSystemShutdown *object = pytalloc_get_ptr(py_obj);
16874 : PyObject *ret;
16875 : char *retstr;
16876 :
16877 0 : if (ndr_table_winreg.num_calls < 25) {
16878 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdown_ndr_print");
16879 0 : return NULL;
16880 : }
16881 0 : call = &ndr_table_winreg.calls[24];
16882 :
16883 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
16884 0 : ret = PyUnicode_FromString(retstr);
16885 0 : TALLOC_FREE(retstr);
16886 :
16887 0 : return ret;
16888 : }
16889 :
16890 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16891 : {
16892 0 : return py_winreg_InitiateSystemShutdown_ndr_print(py_obj, "winreg_InitiateSystemShutdown_in", NDR_IN);
16893 : }
16894 :
16895 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16896 : {
16897 0 : return py_winreg_InitiateSystemShutdown_ndr_print(py_obj, "winreg_InitiateSystemShutdown_out", NDR_OUT);
16898 : }
16899 :
16900 : static PyMethodDef py_winreg_InitiateSystemShutdown_methods[] = {
16901 : { "opnum", (PyCFunction)py_winreg_InitiateSystemShutdown_ndr_opnum, METH_NOARGS|METH_CLASS,
16902 : "winreg.InitiateSystemShutdown.opnum() -> 24 (0x18) " },
16903 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
16904 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
16905 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
16906 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
16907 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
16908 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
16909 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
16910 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
16911 : { "__ndr_print_in__", (PyCFunction)py_winreg_InitiateSystemShutdown_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
16912 : { "__ndr_print_out__", (PyCFunction)py_winreg_InitiateSystemShutdown_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
16913 : { NULL, NULL, 0, NULL }
16914 : };
16915 :
16916 :
16917 : static PyTypeObject winreg_InitiateSystemShutdown_Type = {
16918 : PyVarObject_HEAD_INIT(NULL, 0)
16919 : .tp_name = "winreg.InitiateSystemShutdown",
16920 : .tp_getset = py_winreg_InitiateSystemShutdown_getsetters,
16921 : .tp_methods = py_winreg_InitiateSystemShutdown_methods,
16922 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
16923 : .tp_new = py_winreg_InitiateSystemShutdown_new,
16924 : };
16925 :
16926 0 : static bool pack_py_winreg_InitiateSystemShutdown_args_in(PyObject *args, PyObject *kwargs, struct winreg_InitiateSystemShutdown *r)
16927 : {
16928 : PyObject *py_hostname;
16929 : PyObject *py_message;
16930 : PyObject *py_timeout;
16931 : PyObject *py_force_apps;
16932 : PyObject *py_do_reboot;
16933 0 : const char *kwnames[] = {
16934 : "hostname", "message", "timeout", "force_apps", "do_reboot", NULL
16935 : };
16936 :
16937 0 : 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)) {
16938 0 : return false;
16939 : }
16940 :
16941 0 : if (py_hostname == NULL) {
16942 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.hostname");
16943 0 : return false;
16944 : }
16945 0 : if (py_hostname == Py_None) {
16946 0 : r->in.hostname = NULL;
16947 : } else {
16948 0 : r->in.hostname = talloc_ptrtype(r, r->in.hostname);
16949 0 : if (r->in.hostname == NULL) {
16950 0 : PyErr_NoMemory();
16951 0 : return false;
16952 : }
16953 : {
16954 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.hostname));
16955 0 : if (PyLong_Check(py_hostname)) {
16956 : unsigned long long test_var;
16957 0 : test_var = PyLong_AsUnsignedLongLong(py_hostname);
16958 0 : if (PyErr_Occurred() != NULL) {
16959 0 : return false;
16960 : }
16961 0 : if (test_var > uint_max) {
16962 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16963 : PyLong_Type.tp_name, uint_max, test_var);
16964 0 : return false;
16965 : }
16966 0 : *r->in.hostname = test_var;
16967 : } else {
16968 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16969 : PyLong_Type.tp_name);
16970 0 : return false;
16971 : }
16972 : }
16973 : }
16974 0 : if (py_message == NULL) {
16975 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.message");
16976 0 : return false;
16977 : }
16978 0 : if (py_message == Py_None) {
16979 0 : r->in.message = NULL;
16980 : } else {
16981 0 : r->in.message = NULL;
16982 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
16983 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_message)) == NULL) {
16984 0 : PyErr_NoMemory();
16985 0 : return false;
16986 : }
16987 0 : r->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(py_message);
16988 : }
16989 0 : if (py_timeout == NULL) {
16990 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.timeout");
16991 0 : return false;
16992 : }
16993 : {
16994 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.timeout));
16995 0 : if (PyLong_Check(py_timeout)) {
16996 : unsigned long long test_var;
16997 0 : test_var = PyLong_AsUnsignedLongLong(py_timeout);
16998 0 : if (PyErr_Occurred() != NULL) {
16999 0 : return false;
17000 : }
17001 0 : if (test_var > uint_max) {
17002 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17003 : PyLong_Type.tp_name, uint_max, test_var);
17004 0 : return false;
17005 : }
17006 0 : r->in.timeout = test_var;
17007 : } else {
17008 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17009 : PyLong_Type.tp_name);
17010 0 : return false;
17011 : }
17012 : }
17013 0 : if (py_force_apps == NULL) {
17014 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.force_apps");
17015 0 : return false;
17016 : }
17017 : {
17018 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.force_apps));
17019 0 : if (PyLong_Check(py_force_apps)) {
17020 : unsigned long long test_var;
17021 0 : test_var = PyLong_AsUnsignedLongLong(py_force_apps);
17022 0 : if (PyErr_Occurred() != NULL) {
17023 0 : return false;
17024 : }
17025 0 : if (test_var > uint_max) {
17026 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17027 : PyLong_Type.tp_name, uint_max, test_var);
17028 0 : return false;
17029 : }
17030 0 : r->in.force_apps = test_var;
17031 : } else {
17032 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17033 : PyLong_Type.tp_name);
17034 0 : return false;
17035 : }
17036 : }
17037 0 : if (py_do_reboot == NULL) {
17038 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.do_reboot");
17039 0 : return false;
17040 : }
17041 : {
17042 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.do_reboot));
17043 0 : if (PyLong_Check(py_do_reboot)) {
17044 : unsigned long long test_var;
17045 0 : test_var = PyLong_AsUnsignedLongLong(py_do_reboot);
17046 0 : if (PyErr_Occurred() != NULL) {
17047 0 : return false;
17048 : }
17049 0 : if (test_var > uint_max) {
17050 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17051 : PyLong_Type.tp_name, uint_max, test_var);
17052 0 : return false;
17053 : }
17054 0 : r->in.do_reboot = test_var;
17055 : } else {
17056 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17057 : PyLong_Type.tp_name);
17058 0 : return false;
17059 : }
17060 : }
17061 0 : return true;
17062 : }
17063 :
17064 0 : static PyObject *unpack_py_winreg_InitiateSystemShutdown_args_out(struct winreg_InitiateSystemShutdown *r)
17065 : {
17066 : PyObject *result;
17067 0 : result = Py_None;
17068 0 : Py_INCREF(result);
17069 0 : if (!W_ERROR_IS_OK(r->out.result)) {
17070 0 : PyErr_SetWERROR(r->out.result);
17071 0 : return NULL;
17072 : }
17073 :
17074 0 : return result;
17075 : }
17076 :
17077 :
17078 0 : static PyObject *py_winreg_AbortSystemShutdown_in_get_server(PyObject *obj, void *closure)
17079 : {
17080 0 : struct winreg_AbortSystemShutdown *object = pytalloc_get_ptr(obj);
17081 : PyObject *py_server;
17082 0 : if (object->in.server == NULL) {
17083 0 : Py_RETURN_NONE;
17084 : }
17085 0 : if (object->in.server == NULL) {
17086 0 : py_server = Py_None;
17087 0 : Py_INCREF(py_server);
17088 : } else {
17089 0 : py_server = PyLong_FromLong((uint16_t)(*object->in.server));
17090 : }
17091 0 : return py_server;
17092 : }
17093 :
17094 0 : static int py_winreg_AbortSystemShutdown_in_set_server(PyObject *py_obj, PyObject *value, void *closure)
17095 : {
17096 0 : struct winreg_AbortSystemShutdown *object = pytalloc_get_ptr(py_obj);
17097 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.server));
17098 0 : if (value == NULL) {
17099 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.server");
17100 0 : return -1;
17101 : }
17102 0 : if (value == Py_None) {
17103 0 : object->in.server = NULL;
17104 : } else {
17105 0 : object->in.server = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.server);
17106 0 : if (object->in.server == NULL) {
17107 0 : PyErr_NoMemory();
17108 0 : return -1;
17109 : }
17110 : {
17111 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.server));
17112 0 : if (PyLong_Check(value)) {
17113 : unsigned long long test_var;
17114 0 : test_var = PyLong_AsUnsignedLongLong(value);
17115 0 : if (PyErr_Occurred() != NULL) {
17116 0 : return -1;
17117 : }
17118 0 : if (test_var > uint_max) {
17119 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17120 : PyLong_Type.tp_name, uint_max, test_var);
17121 0 : return -1;
17122 : }
17123 0 : *object->in.server = test_var;
17124 : } else {
17125 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17126 : PyLong_Type.tp_name);
17127 0 : return -1;
17128 : }
17129 : }
17130 : }
17131 0 : return 0;
17132 : }
17133 :
17134 0 : static PyObject *py_winreg_AbortSystemShutdown_get_result(PyObject *obj, void *closure)
17135 : {
17136 0 : struct winreg_AbortSystemShutdown *object = pytalloc_get_ptr(obj);
17137 : PyObject *py_result;
17138 0 : py_result = PyErr_FromWERROR(object->out.result);
17139 0 : return py_result;
17140 : }
17141 :
17142 0 : static int py_winreg_AbortSystemShutdown_set_result(PyObject *py_obj, PyObject *value, void *closure)
17143 : {
17144 0 : struct winreg_AbortSystemShutdown *object = pytalloc_get_ptr(py_obj);
17145 0 : if (value == NULL) {
17146 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
17147 0 : return -1;
17148 : }
17149 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
17150 0 : return 0;
17151 : }
17152 :
17153 : static PyGetSetDef py_winreg_AbortSystemShutdown_getsetters[] = {
17154 : {
17155 : .name = discard_const_p(char, "in_server"),
17156 : .get = py_winreg_AbortSystemShutdown_in_get_server,
17157 : .set = py_winreg_AbortSystemShutdown_in_set_server,
17158 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
17159 : },
17160 : {
17161 : .name = discard_const_p(char, "result"),
17162 : .get = py_winreg_AbortSystemShutdown_get_result,
17163 : .set = py_winreg_AbortSystemShutdown_set_result,
17164 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
17165 : },
17166 : { .name = NULL }
17167 : };
17168 :
17169 0 : static PyObject *py_winreg_AbortSystemShutdown_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
17170 : {
17171 0 : PyObject *self = pytalloc_new(struct winreg_AbortSystemShutdown, type);
17172 0 : return self;
17173 : }
17174 :
17175 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
17176 : {
17177 :
17178 :
17179 0 : return PyLong_FromLong(25);
17180 : }
17181 :
17182 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
17183 : {
17184 0 : const struct ndr_interface_call *call = NULL;
17185 0 : struct winreg_AbortSystemShutdown *object = pytalloc_get_ptr(py_obj);
17186 0 : PyObject *ret = NULL;
17187 0 : struct ndr_push *push = NULL;
17188 : DATA_BLOB blob;
17189 : enum ndr_err_code err;
17190 :
17191 0 : if (ndr_table_winreg.num_calls < 26) {
17192 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_AbortSystemShutdown_ndr_pack");
17193 0 : return NULL;
17194 : }
17195 0 : call = &ndr_table_winreg.calls[25];
17196 :
17197 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
17198 0 : if (push == NULL) {
17199 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17200 0 : return NULL;
17201 : }
17202 :
17203 0 : push->flags |= ndr_push_flags;
17204 :
17205 0 : err = call->ndr_push(push, ndr_inout_flags, object);
17206 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17207 0 : TALLOC_FREE(push);
17208 0 : PyErr_SetNdrError(err);
17209 0 : return NULL;
17210 : }
17211 0 : blob = ndr_push_blob(push);
17212 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
17213 0 : TALLOC_FREE(push);
17214 0 : return ret;
17215 : }
17216 :
17217 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17218 : {
17219 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17220 0 : PyObject *bigendian_obj = NULL;
17221 0 : PyObject *ndr64_obj = NULL;
17222 0 : libndr_flags ndr_push_flags = 0;
17223 :
17224 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
17225 : discard_const_p(char *, kwnames),
17226 : &bigendian_obj,
17227 : &ndr64_obj)) {
17228 0 : return NULL;
17229 : }
17230 :
17231 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17232 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17233 : }
17234 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17235 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17236 : }
17237 :
17238 0 : return py_winreg_AbortSystemShutdown_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
17239 : }
17240 :
17241 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17242 : {
17243 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17244 0 : PyObject *bigendian_obj = NULL;
17245 0 : PyObject *ndr64_obj = NULL;
17246 0 : libndr_flags ndr_push_flags = 0;
17247 :
17248 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
17249 : discard_const_p(char *, kwnames),
17250 : &bigendian_obj,
17251 : &ndr64_obj)) {
17252 0 : return NULL;
17253 : }
17254 :
17255 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17256 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17257 : }
17258 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17259 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17260 : }
17261 :
17262 0 : return py_winreg_AbortSystemShutdown_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
17263 : }
17264 :
17265 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
17266 : {
17267 0 : const struct ndr_interface_call *call = NULL;
17268 0 : struct winreg_AbortSystemShutdown *object = pytalloc_get_ptr(py_obj);
17269 0 : struct ndr_pull *pull = NULL;
17270 : enum ndr_err_code err;
17271 :
17272 0 : if (ndr_table_winreg.num_calls < 26) {
17273 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_AbortSystemShutdown_ndr_unpack");
17274 0 : return NULL;
17275 : }
17276 0 : call = &ndr_table_winreg.calls[25];
17277 :
17278 0 : pull = ndr_pull_init_blob(blob, object);
17279 0 : if (pull == NULL) {
17280 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17281 0 : return NULL;
17282 : }
17283 :
17284 0 : pull->flags |= ndr_pull_flags;
17285 :
17286 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
17287 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17288 0 : TALLOC_FREE(pull);
17289 0 : PyErr_SetNdrError(err);
17290 0 : return NULL;
17291 : }
17292 0 : if (!allow_remaining) {
17293 : uint32_t highest_ofs;
17294 :
17295 0 : if (pull->offset > pull->relative_highest_offset) {
17296 0 : highest_ofs = pull->offset;
17297 : } else {
17298 0 : highest_ofs = pull->relative_highest_offset;
17299 : }
17300 0 : if (highest_ofs < pull->data_size) {
17301 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
17302 : "not all bytes consumed ofs[%u] size[%u]",
17303 : highest_ofs, pull->data_size);
17304 0 : TALLOC_FREE(pull);
17305 0 : PyErr_SetNdrError(err);
17306 0 : return NULL;
17307 : }
17308 : }
17309 :
17310 0 : TALLOC_FREE(pull);
17311 0 : Py_RETURN_NONE;
17312 : }
17313 :
17314 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17315 : {
17316 : DATA_BLOB blob;
17317 0 : Py_ssize_t blob_length = 0;
17318 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17319 0 : PyObject *bigendian_obj = NULL;
17320 0 : PyObject *ndr64_obj = NULL;
17321 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17322 0 : PyObject *allow_remaining_obj = NULL;
17323 0 : bool allow_remaining = false;
17324 :
17325 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
17326 : discard_const_p(char *, kwnames),
17327 : &blob.data, &blob_length,
17328 : &bigendian_obj,
17329 : &ndr64_obj,
17330 : &allow_remaining_obj)) {
17331 0 : return NULL;
17332 : }
17333 0 : blob.length = blob_length;
17334 :
17335 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17336 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17337 : }
17338 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17339 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17340 : }
17341 :
17342 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17343 0 : allow_remaining = true;
17344 : }
17345 :
17346 0 : return py_winreg_AbortSystemShutdown_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
17347 : }
17348 :
17349 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17350 : {
17351 : DATA_BLOB blob;
17352 0 : Py_ssize_t blob_length = 0;
17353 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17354 0 : PyObject *bigendian_obj = NULL;
17355 0 : PyObject *ndr64_obj = NULL;
17356 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17357 0 : PyObject *allow_remaining_obj = NULL;
17358 0 : bool allow_remaining = false;
17359 :
17360 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
17361 : discard_const_p(char *, kwnames),
17362 : &blob.data, &blob_length,
17363 : &bigendian_obj,
17364 : &ndr64_obj,
17365 : &allow_remaining_obj)) {
17366 0 : return NULL;
17367 : }
17368 0 : blob.length = blob_length;
17369 :
17370 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17371 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17372 : }
17373 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17374 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17375 : }
17376 :
17377 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17378 0 : allow_remaining = true;
17379 : }
17380 :
17381 0 : return py_winreg_AbortSystemShutdown_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
17382 : }
17383 :
17384 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
17385 : {
17386 0 : const struct ndr_interface_call *call = NULL;
17387 0 : struct winreg_AbortSystemShutdown *object = pytalloc_get_ptr(py_obj);
17388 : PyObject *ret;
17389 : char *retstr;
17390 :
17391 0 : if (ndr_table_winreg.num_calls < 26) {
17392 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_AbortSystemShutdown_ndr_print");
17393 0 : return NULL;
17394 : }
17395 0 : call = &ndr_table_winreg.calls[25];
17396 :
17397 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
17398 0 : ret = PyUnicode_FromString(retstr);
17399 0 : TALLOC_FREE(retstr);
17400 :
17401 0 : return ret;
17402 : }
17403 :
17404 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17405 : {
17406 0 : return py_winreg_AbortSystemShutdown_ndr_print(py_obj, "winreg_AbortSystemShutdown_in", NDR_IN);
17407 : }
17408 :
17409 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17410 : {
17411 0 : return py_winreg_AbortSystemShutdown_ndr_print(py_obj, "winreg_AbortSystemShutdown_out", NDR_OUT);
17412 : }
17413 :
17414 : static PyMethodDef py_winreg_AbortSystemShutdown_methods[] = {
17415 : { "opnum", (PyCFunction)py_winreg_AbortSystemShutdown_ndr_opnum, METH_NOARGS|METH_CLASS,
17416 : "winreg.AbortSystemShutdown.opnum() -> 25 (0x19) " },
17417 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
17418 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
17419 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
17420 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
17421 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
17422 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
17423 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
17424 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
17425 : { "__ndr_print_in__", (PyCFunction)py_winreg_AbortSystemShutdown_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
17426 : { "__ndr_print_out__", (PyCFunction)py_winreg_AbortSystemShutdown_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
17427 : { NULL, NULL, 0, NULL }
17428 : };
17429 :
17430 :
17431 : static PyTypeObject winreg_AbortSystemShutdown_Type = {
17432 : PyVarObject_HEAD_INIT(NULL, 0)
17433 : .tp_name = "winreg.AbortSystemShutdown",
17434 : .tp_getset = py_winreg_AbortSystemShutdown_getsetters,
17435 : .tp_methods = py_winreg_AbortSystemShutdown_methods,
17436 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
17437 : .tp_new = py_winreg_AbortSystemShutdown_new,
17438 : };
17439 :
17440 0 : static bool pack_py_winreg_AbortSystemShutdown_args_in(PyObject *args, PyObject *kwargs, struct winreg_AbortSystemShutdown *r)
17441 : {
17442 : PyObject *py_server;
17443 0 : const char *kwnames[] = {
17444 : "server", NULL
17445 : };
17446 :
17447 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_AbortSystemShutdown", discard_const_p(char *, kwnames), &py_server)) {
17448 0 : return false;
17449 : }
17450 :
17451 0 : if (py_server == NULL) {
17452 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.server");
17453 0 : return false;
17454 : }
17455 0 : if (py_server == Py_None) {
17456 0 : r->in.server = NULL;
17457 : } else {
17458 0 : r->in.server = talloc_ptrtype(r, r->in.server);
17459 0 : if (r->in.server == NULL) {
17460 0 : PyErr_NoMemory();
17461 0 : return false;
17462 : }
17463 : {
17464 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.server));
17465 0 : if (PyLong_Check(py_server)) {
17466 : unsigned long long test_var;
17467 0 : test_var = PyLong_AsUnsignedLongLong(py_server);
17468 0 : if (PyErr_Occurred() != NULL) {
17469 0 : return false;
17470 : }
17471 0 : if (test_var > uint_max) {
17472 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17473 : PyLong_Type.tp_name, uint_max, test_var);
17474 0 : return false;
17475 : }
17476 0 : *r->in.server = test_var;
17477 : } else {
17478 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17479 : PyLong_Type.tp_name);
17480 0 : return false;
17481 : }
17482 : }
17483 : }
17484 0 : return true;
17485 : }
17486 :
17487 0 : static PyObject *unpack_py_winreg_AbortSystemShutdown_args_out(struct winreg_AbortSystemShutdown *r)
17488 : {
17489 : PyObject *result;
17490 0 : result = Py_None;
17491 0 : Py_INCREF(result);
17492 0 : if (!W_ERROR_IS_OK(r->out.result)) {
17493 0 : PyErr_SetWERROR(r->out.result);
17494 0 : return NULL;
17495 : }
17496 :
17497 0 : return result;
17498 : }
17499 :
17500 :
17501 0 : static PyObject *py_winreg_GetVersion_in_get_handle(PyObject *obj, void *closure)
17502 : {
17503 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(obj);
17504 : PyObject *py_handle;
17505 0 : if (object->in.handle == NULL) {
17506 0 : Py_RETURN_NONE;
17507 : }
17508 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
17509 0 : return py_handle;
17510 : }
17511 :
17512 0 : static int py_winreg_GetVersion_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
17513 : {
17514 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(py_obj);
17515 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
17516 0 : if (value == NULL) {
17517 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
17518 0 : return -1;
17519 : }
17520 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
17521 0 : if (object->in.handle == NULL) {
17522 0 : PyErr_NoMemory();
17523 0 : return -1;
17524 : }
17525 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
17526 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
17527 0 : PyErr_NoMemory();
17528 0 : return -1;
17529 : }
17530 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
17531 0 : return 0;
17532 : }
17533 :
17534 0 : static PyObject *py_winreg_GetVersion_out_get_version(PyObject *obj, void *closure)
17535 : {
17536 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(obj);
17537 : PyObject *py_version;
17538 0 : if (object->out.version == NULL) {
17539 0 : Py_RETURN_NONE;
17540 : }
17541 0 : py_version = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.version));
17542 0 : return py_version;
17543 : }
17544 :
17545 0 : static int py_winreg_GetVersion_out_set_version(PyObject *py_obj, PyObject *value, void *closure)
17546 : {
17547 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(py_obj);
17548 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.version));
17549 0 : if (value == NULL) {
17550 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.version");
17551 0 : return -1;
17552 : }
17553 0 : object->out.version = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.version);
17554 0 : if (object->out.version == NULL) {
17555 0 : PyErr_NoMemory();
17556 0 : return -1;
17557 : }
17558 : {
17559 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.version));
17560 0 : if (PyLong_Check(value)) {
17561 : unsigned long long test_var;
17562 0 : test_var = PyLong_AsUnsignedLongLong(value);
17563 0 : if (PyErr_Occurred() != NULL) {
17564 0 : return -1;
17565 : }
17566 0 : if (test_var > uint_max) {
17567 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17568 : PyLong_Type.tp_name, uint_max, test_var);
17569 0 : return -1;
17570 : }
17571 0 : *object->out.version = test_var;
17572 : } else {
17573 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17574 : PyLong_Type.tp_name);
17575 0 : return -1;
17576 : }
17577 : }
17578 0 : return 0;
17579 : }
17580 :
17581 0 : static PyObject *py_winreg_GetVersion_get_result(PyObject *obj, void *closure)
17582 : {
17583 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(obj);
17584 : PyObject *py_result;
17585 0 : py_result = PyErr_FromWERROR(object->out.result);
17586 0 : return py_result;
17587 : }
17588 :
17589 0 : static int py_winreg_GetVersion_set_result(PyObject *py_obj, PyObject *value, void *closure)
17590 : {
17591 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(py_obj);
17592 0 : if (value == NULL) {
17593 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
17594 0 : return -1;
17595 : }
17596 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
17597 0 : return 0;
17598 : }
17599 :
17600 : static PyGetSetDef py_winreg_GetVersion_getsetters[] = {
17601 : {
17602 : .name = discard_const_p(char, "in_handle"),
17603 : .get = py_winreg_GetVersion_in_get_handle,
17604 : .set = py_winreg_GetVersion_in_set_handle,
17605 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
17606 : },
17607 : {
17608 : .name = discard_const_p(char, "out_version"),
17609 : .get = py_winreg_GetVersion_out_get_version,
17610 : .set = py_winreg_GetVersion_out_set_version,
17611 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
17612 : },
17613 : {
17614 : .name = discard_const_p(char, "result"),
17615 : .get = py_winreg_GetVersion_get_result,
17616 : .set = py_winreg_GetVersion_set_result,
17617 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
17618 : },
17619 : { .name = NULL }
17620 : };
17621 :
17622 0 : static PyObject *py_winreg_GetVersion_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
17623 : {
17624 0 : PyObject *self = pytalloc_new(struct winreg_GetVersion, type);
17625 0 : struct winreg_GetVersion *_self = (struct winreg_GetVersion *)pytalloc_get_ptr(self);
17626 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
17627 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
17628 0 : _self->out.version = talloc_zero(mem_ctx, uint32_t);
17629 0 : return self;
17630 : }
17631 :
17632 0 : static PyObject *py_winreg_GetVersion_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
17633 : {
17634 :
17635 :
17636 0 : return PyLong_FromLong(26);
17637 : }
17638 :
17639 0 : static PyObject *py_winreg_GetVersion_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
17640 : {
17641 0 : const struct ndr_interface_call *call = NULL;
17642 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(py_obj);
17643 0 : PyObject *ret = NULL;
17644 0 : struct ndr_push *push = NULL;
17645 : DATA_BLOB blob;
17646 : enum ndr_err_code err;
17647 :
17648 0 : if (ndr_table_winreg.num_calls < 27) {
17649 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetVersion_ndr_pack");
17650 0 : return NULL;
17651 : }
17652 0 : call = &ndr_table_winreg.calls[26];
17653 :
17654 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
17655 0 : if (push == NULL) {
17656 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17657 0 : return NULL;
17658 : }
17659 :
17660 0 : push->flags |= ndr_push_flags;
17661 :
17662 0 : err = call->ndr_push(push, ndr_inout_flags, object);
17663 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17664 0 : TALLOC_FREE(push);
17665 0 : PyErr_SetNdrError(err);
17666 0 : return NULL;
17667 : }
17668 0 : blob = ndr_push_blob(push);
17669 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
17670 0 : TALLOC_FREE(push);
17671 0 : return ret;
17672 : }
17673 :
17674 0 : static PyObject *py_winreg_GetVersion_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17675 : {
17676 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17677 0 : PyObject *bigendian_obj = NULL;
17678 0 : PyObject *ndr64_obj = NULL;
17679 0 : libndr_flags ndr_push_flags = 0;
17680 :
17681 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
17682 : discard_const_p(char *, kwnames),
17683 : &bigendian_obj,
17684 : &ndr64_obj)) {
17685 0 : return NULL;
17686 : }
17687 :
17688 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17689 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17690 : }
17691 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17692 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17693 : }
17694 :
17695 0 : return py_winreg_GetVersion_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
17696 : }
17697 :
17698 0 : static PyObject *py_winreg_GetVersion_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17699 : {
17700 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17701 0 : PyObject *bigendian_obj = NULL;
17702 0 : PyObject *ndr64_obj = NULL;
17703 0 : libndr_flags ndr_push_flags = 0;
17704 :
17705 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
17706 : discard_const_p(char *, kwnames),
17707 : &bigendian_obj,
17708 : &ndr64_obj)) {
17709 0 : return NULL;
17710 : }
17711 :
17712 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17713 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17714 : }
17715 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17716 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17717 : }
17718 :
17719 0 : return py_winreg_GetVersion_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
17720 : }
17721 :
17722 0 : static PyObject *py_winreg_GetVersion_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
17723 : {
17724 0 : const struct ndr_interface_call *call = NULL;
17725 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(py_obj);
17726 0 : struct ndr_pull *pull = NULL;
17727 : enum ndr_err_code err;
17728 :
17729 0 : if (ndr_table_winreg.num_calls < 27) {
17730 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetVersion_ndr_unpack");
17731 0 : return NULL;
17732 : }
17733 0 : call = &ndr_table_winreg.calls[26];
17734 :
17735 0 : pull = ndr_pull_init_blob(blob, object);
17736 0 : if (pull == NULL) {
17737 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17738 0 : return NULL;
17739 : }
17740 :
17741 0 : pull->flags |= ndr_pull_flags;
17742 :
17743 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
17744 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17745 0 : TALLOC_FREE(pull);
17746 0 : PyErr_SetNdrError(err);
17747 0 : return NULL;
17748 : }
17749 0 : if (!allow_remaining) {
17750 : uint32_t highest_ofs;
17751 :
17752 0 : if (pull->offset > pull->relative_highest_offset) {
17753 0 : highest_ofs = pull->offset;
17754 : } else {
17755 0 : highest_ofs = pull->relative_highest_offset;
17756 : }
17757 0 : if (highest_ofs < pull->data_size) {
17758 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
17759 : "not all bytes consumed ofs[%u] size[%u]",
17760 : highest_ofs, pull->data_size);
17761 0 : TALLOC_FREE(pull);
17762 0 : PyErr_SetNdrError(err);
17763 0 : return NULL;
17764 : }
17765 : }
17766 :
17767 0 : TALLOC_FREE(pull);
17768 0 : Py_RETURN_NONE;
17769 : }
17770 :
17771 0 : static PyObject *py_winreg_GetVersion_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17772 : {
17773 : DATA_BLOB blob;
17774 0 : Py_ssize_t blob_length = 0;
17775 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17776 0 : PyObject *bigendian_obj = NULL;
17777 0 : PyObject *ndr64_obj = NULL;
17778 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17779 0 : PyObject *allow_remaining_obj = NULL;
17780 0 : bool allow_remaining = false;
17781 :
17782 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
17783 : discard_const_p(char *, kwnames),
17784 : &blob.data, &blob_length,
17785 : &bigendian_obj,
17786 : &ndr64_obj,
17787 : &allow_remaining_obj)) {
17788 0 : return NULL;
17789 : }
17790 0 : blob.length = blob_length;
17791 :
17792 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17793 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17794 : }
17795 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17796 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17797 : }
17798 :
17799 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17800 0 : allow_remaining = true;
17801 : }
17802 :
17803 0 : return py_winreg_GetVersion_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
17804 : }
17805 :
17806 0 : static PyObject *py_winreg_GetVersion_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17807 : {
17808 : DATA_BLOB blob;
17809 0 : Py_ssize_t blob_length = 0;
17810 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17811 0 : PyObject *bigendian_obj = NULL;
17812 0 : PyObject *ndr64_obj = NULL;
17813 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17814 0 : PyObject *allow_remaining_obj = NULL;
17815 0 : bool allow_remaining = false;
17816 :
17817 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
17818 : discard_const_p(char *, kwnames),
17819 : &blob.data, &blob_length,
17820 : &bigendian_obj,
17821 : &ndr64_obj,
17822 : &allow_remaining_obj)) {
17823 0 : return NULL;
17824 : }
17825 0 : blob.length = blob_length;
17826 :
17827 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17828 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17829 : }
17830 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17831 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17832 : }
17833 :
17834 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17835 0 : allow_remaining = true;
17836 : }
17837 :
17838 0 : return py_winreg_GetVersion_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
17839 : }
17840 :
17841 0 : static PyObject *py_winreg_GetVersion_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
17842 : {
17843 0 : const struct ndr_interface_call *call = NULL;
17844 0 : struct winreg_GetVersion *object = pytalloc_get_ptr(py_obj);
17845 : PyObject *ret;
17846 : char *retstr;
17847 :
17848 0 : if (ndr_table_winreg.num_calls < 27) {
17849 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetVersion_ndr_print");
17850 0 : return NULL;
17851 : }
17852 0 : call = &ndr_table_winreg.calls[26];
17853 :
17854 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
17855 0 : ret = PyUnicode_FromString(retstr);
17856 0 : TALLOC_FREE(retstr);
17857 :
17858 0 : return ret;
17859 : }
17860 :
17861 0 : static PyObject *py_winreg_GetVersion_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17862 : {
17863 0 : return py_winreg_GetVersion_ndr_print(py_obj, "winreg_GetVersion_in", NDR_IN);
17864 : }
17865 :
17866 0 : static PyObject *py_winreg_GetVersion_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17867 : {
17868 0 : return py_winreg_GetVersion_ndr_print(py_obj, "winreg_GetVersion_out", NDR_OUT);
17869 : }
17870 :
17871 : static PyMethodDef py_winreg_GetVersion_methods[] = {
17872 : { "opnum", (PyCFunction)py_winreg_GetVersion_ndr_opnum, METH_NOARGS|METH_CLASS,
17873 : "winreg.GetVersion.opnum() -> 26 (0x1a) " },
17874 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
17875 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
17876 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
17877 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
17878 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
17879 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
17880 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
17881 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
17882 : { "__ndr_print_in__", (PyCFunction)py_winreg_GetVersion_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
17883 : { "__ndr_print_out__", (PyCFunction)py_winreg_GetVersion_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
17884 : { NULL, NULL, 0, NULL }
17885 : };
17886 :
17887 :
17888 : static PyTypeObject winreg_GetVersion_Type = {
17889 : PyVarObject_HEAD_INIT(NULL, 0)
17890 : .tp_name = "winreg.GetVersion",
17891 : .tp_getset = py_winreg_GetVersion_getsetters,
17892 : .tp_methods = py_winreg_GetVersion_methods,
17893 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
17894 : .tp_new = py_winreg_GetVersion_new,
17895 : };
17896 :
17897 1 : static bool pack_py_winreg_GetVersion_args_in(PyObject *args, PyObject *kwargs, struct winreg_GetVersion *r)
17898 : {
17899 : PyObject *py_handle;
17900 1 : const char *kwnames[] = {
17901 : "handle", NULL
17902 : };
17903 :
17904 1 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_GetVersion", discard_const_p(char *, kwnames), &py_handle)) {
17905 0 : return false;
17906 : }
17907 :
17908 1 : if (py_handle == NULL) {
17909 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
17910 0 : return false;
17911 : }
17912 1 : r->in.handle = talloc_ptrtype(r, r->in.handle);
17913 1 : if (r->in.handle == NULL) {
17914 0 : PyErr_NoMemory();
17915 0 : return false;
17916 : }
17917 1 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
17918 1 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
17919 0 : PyErr_NoMemory();
17920 0 : return false;
17921 : }
17922 1 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
17923 1 : return true;
17924 : }
17925 :
17926 1 : static PyObject *unpack_py_winreg_GetVersion_args_out(struct winreg_GetVersion *r)
17927 : {
17928 : PyObject *result;
17929 : PyObject *py_version;
17930 1 : py_version = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.version));
17931 1 : result = py_version;
17932 1 : if (!W_ERROR_IS_OK(r->out.result)) {
17933 0 : PyErr_SetWERROR(r->out.result);
17934 0 : return NULL;
17935 : }
17936 :
17937 1 : return result;
17938 : }
17939 :
17940 :
17941 0 : static PyObject *py_winreg_OpenHKCC_in_get_system_name(PyObject *obj, void *closure)
17942 : {
17943 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(obj);
17944 : PyObject *py_system_name;
17945 0 : if (object->in.system_name == NULL) {
17946 0 : Py_RETURN_NONE;
17947 : }
17948 0 : if (object->in.system_name == NULL) {
17949 0 : py_system_name = Py_None;
17950 0 : Py_INCREF(py_system_name);
17951 : } else {
17952 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
17953 : }
17954 0 : return py_system_name;
17955 : }
17956 :
17957 0 : static int py_winreg_OpenHKCC_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
17958 : {
17959 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(py_obj);
17960 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
17961 0 : if (value == NULL) {
17962 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
17963 0 : return -1;
17964 : }
17965 0 : if (value == Py_None) {
17966 0 : object->in.system_name = NULL;
17967 : } else {
17968 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
17969 0 : if (object->in.system_name == NULL) {
17970 0 : PyErr_NoMemory();
17971 0 : return -1;
17972 : }
17973 : {
17974 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
17975 0 : if (PyLong_Check(value)) {
17976 : unsigned long long test_var;
17977 0 : test_var = PyLong_AsUnsignedLongLong(value);
17978 0 : if (PyErr_Occurred() != NULL) {
17979 0 : return -1;
17980 : }
17981 0 : if (test_var > uint_max) {
17982 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17983 : PyLong_Type.tp_name, uint_max, test_var);
17984 0 : return -1;
17985 : }
17986 0 : *object->in.system_name = test_var;
17987 : } else {
17988 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17989 : PyLong_Type.tp_name);
17990 0 : return -1;
17991 : }
17992 : }
17993 : }
17994 0 : return 0;
17995 : }
17996 :
17997 0 : static PyObject *py_winreg_OpenHKCC_in_get_access_mask(PyObject *obj, void *closure)
17998 : {
17999 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(obj);
18000 : PyObject *py_access_mask;
18001 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
18002 0 : return py_access_mask;
18003 : }
18004 :
18005 0 : static int py_winreg_OpenHKCC_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
18006 : {
18007 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(py_obj);
18008 0 : if (value == NULL) {
18009 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
18010 0 : return -1;
18011 : }
18012 : {
18013 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
18014 0 : if (PyLong_Check(value)) {
18015 : unsigned long long test_var;
18016 0 : test_var = PyLong_AsUnsignedLongLong(value);
18017 0 : if (PyErr_Occurred() != NULL) {
18018 0 : return -1;
18019 : }
18020 0 : if (test_var > uint_max) {
18021 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18022 : PyLong_Type.tp_name, uint_max, test_var);
18023 0 : return -1;
18024 : }
18025 0 : object->in.access_mask = test_var;
18026 : } else {
18027 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18028 : PyLong_Type.tp_name);
18029 0 : return -1;
18030 : }
18031 : }
18032 0 : return 0;
18033 : }
18034 :
18035 0 : static PyObject *py_winreg_OpenHKCC_out_get_handle(PyObject *obj, void *closure)
18036 : {
18037 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(obj);
18038 : PyObject *py_handle;
18039 0 : if (object->out.handle == NULL) {
18040 0 : Py_RETURN_NONE;
18041 : }
18042 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
18043 0 : return py_handle;
18044 : }
18045 :
18046 0 : static int py_winreg_OpenHKCC_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
18047 : {
18048 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(py_obj);
18049 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
18050 0 : if (value == NULL) {
18051 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
18052 0 : return -1;
18053 : }
18054 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
18055 0 : if (object->out.handle == NULL) {
18056 0 : PyErr_NoMemory();
18057 0 : return -1;
18058 : }
18059 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
18060 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
18061 0 : PyErr_NoMemory();
18062 0 : return -1;
18063 : }
18064 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
18065 0 : return 0;
18066 : }
18067 :
18068 0 : static PyObject *py_winreg_OpenHKCC_get_result(PyObject *obj, void *closure)
18069 : {
18070 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(obj);
18071 : PyObject *py_result;
18072 0 : py_result = PyErr_FromWERROR(object->out.result);
18073 0 : return py_result;
18074 : }
18075 :
18076 0 : static int py_winreg_OpenHKCC_set_result(PyObject *py_obj, PyObject *value, void *closure)
18077 : {
18078 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(py_obj);
18079 0 : if (value == NULL) {
18080 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
18081 0 : return -1;
18082 : }
18083 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
18084 0 : return 0;
18085 : }
18086 :
18087 : static PyGetSetDef py_winreg_OpenHKCC_getsetters[] = {
18088 : {
18089 : .name = discard_const_p(char, "in_system_name"),
18090 : .get = py_winreg_OpenHKCC_in_get_system_name,
18091 : .set = py_winreg_OpenHKCC_in_set_system_name,
18092 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
18093 : },
18094 : {
18095 : .name = discard_const_p(char, "in_access_mask"),
18096 : .get = py_winreg_OpenHKCC_in_get_access_mask,
18097 : .set = py_winreg_OpenHKCC_in_set_access_mask,
18098 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
18099 : },
18100 : {
18101 : .name = discard_const_p(char, "out_handle"),
18102 : .get = py_winreg_OpenHKCC_out_get_handle,
18103 : .set = py_winreg_OpenHKCC_out_set_handle,
18104 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
18105 : },
18106 : {
18107 : .name = discard_const_p(char, "result"),
18108 : .get = py_winreg_OpenHKCC_get_result,
18109 : .set = py_winreg_OpenHKCC_set_result,
18110 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
18111 : },
18112 : { .name = NULL }
18113 : };
18114 :
18115 0 : static PyObject *py_winreg_OpenHKCC_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
18116 : {
18117 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKCC, type);
18118 0 : struct winreg_OpenHKCC *_self = (struct winreg_OpenHKCC *)pytalloc_get_ptr(self);
18119 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
18120 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
18121 0 : return self;
18122 : }
18123 :
18124 0 : static PyObject *py_winreg_OpenHKCC_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
18125 : {
18126 :
18127 :
18128 0 : return PyLong_FromLong(27);
18129 : }
18130 :
18131 0 : static PyObject *py_winreg_OpenHKCC_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
18132 : {
18133 0 : const struct ndr_interface_call *call = NULL;
18134 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(py_obj);
18135 0 : PyObject *ret = NULL;
18136 0 : struct ndr_push *push = NULL;
18137 : DATA_BLOB blob;
18138 : enum ndr_err_code err;
18139 :
18140 0 : if (ndr_table_winreg.num_calls < 28) {
18141 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCC_ndr_pack");
18142 0 : return NULL;
18143 : }
18144 0 : call = &ndr_table_winreg.calls[27];
18145 :
18146 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
18147 0 : if (push == NULL) {
18148 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18149 0 : return NULL;
18150 : }
18151 :
18152 0 : push->flags |= ndr_push_flags;
18153 :
18154 0 : err = call->ndr_push(push, ndr_inout_flags, object);
18155 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18156 0 : TALLOC_FREE(push);
18157 0 : PyErr_SetNdrError(err);
18158 0 : return NULL;
18159 : }
18160 0 : blob = ndr_push_blob(push);
18161 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
18162 0 : TALLOC_FREE(push);
18163 0 : return ret;
18164 : }
18165 :
18166 0 : static PyObject *py_winreg_OpenHKCC_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18167 : {
18168 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18169 0 : PyObject *bigendian_obj = NULL;
18170 0 : PyObject *ndr64_obj = NULL;
18171 0 : libndr_flags ndr_push_flags = 0;
18172 :
18173 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
18174 : discard_const_p(char *, kwnames),
18175 : &bigendian_obj,
18176 : &ndr64_obj)) {
18177 0 : return NULL;
18178 : }
18179 :
18180 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18181 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18182 : }
18183 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18184 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18185 : }
18186 :
18187 0 : return py_winreg_OpenHKCC_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
18188 : }
18189 :
18190 0 : static PyObject *py_winreg_OpenHKCC_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18191 : {
18192 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18193 0 : PyObject *bigendian_obj = NULL;
18194 0 : PyObject *ndr64_obj = NULL;
18195 0 : libndr_flags ndr_push_flags = 0;
18196 :
18197 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
18198 : discard_const_p(char *, kwnames),
18199 : &bigendian_obj,
18200 : &ndr64_obj)) {
18201 0 : return NULL;
18202 : }
18203 :
18204 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18205 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18206 : }
18207 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18208 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18209 : }
18210 :
18211 0 : return py_winreg_OpenHKCC_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
18212 : }
18213 :
18214 0 : static PyObject *py_winreg_OpenHKCC_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
18215 : {
18216 0 : const struct ndr_interface_call *call = NULL;
18217 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(py_obj);
18218 0 : struct ndr_pull *pull = NULL;
18219 : enum ndr_err_code err;
18220 :
18221 0 : if (ndr_table_winreg.num_calls < 28) {
18222 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCC_ndr_unpack");
18223 0 : return NULL;
18224 : }
18225 0 : call = &ndr_table_winreg.calls[27];
18226 :
18227 0 : pull = ndr_pull_init_blob(blob, object);
18228 0 : if (pull == NULL) {
18229 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18230 0 : return NULL;
18231 : }
18232 :
18233 0 : pull->flags |= ndr_pull_flags;
18234 :
18235 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
18236 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18237 0 : TALLOC_FREE(pull);
18238 0 : PyErr_SetNdrError(err);
18239 0 : return NULL;
18240 : }
18241 0 : if (!allow_remaining) {
18242 : uint32_t highest_ofs;
18243 :
18244 0 : if (pull->offset > pull->relative_highest_offset) {
18245 0 : highest_ofs = pull->offset;
18246 : } else {
18247 0 : highest_ofs = pull->relative_highest_offset;
18248 : }
18249 0 : if (highest_ofs < pull->data_size) {
18250 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
18251 : "not all bytes consumed ofs[%u] size[%u]",
18252 : highest_ofs, pull->data_size);
18253 0 : TALLOC_FREE(pull);
18254 0 : PyErr_SetNdrError(err);
18255 0 : return NULL;
18256 : }
18257 : }
18258 :
18259 0 : TALLOC_FREE(pull);
18260 0 : Py_RETURN_NONE;
18261 : }
18262 :
18263 0 : static PyObject *py_winreg_OpenHKCC_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18264 : {
18265 : DATA_BLOB blob;
18266 0 : Py_ssize_t blob_length = 0;
18267 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18268 0 : PyObject *bigendian_obj = NULL;
18269 0 : PyObject *ndr64_obj = NULL;
18270 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18271 0 : PyObject *allow_remaining_obj = NULL;
18272 0 : bool allow_remaining = false;
18273 :
18274 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
18275 : discard_const_p(char *, kwnames),
18276 : &blob.data, &blob_length,
18277 : &bigendian_obj,
18278 : &ndr64_obj,
18279 : &allow_remaining_obj)) {
18280 0 : return NULL;
18281 : }
18282 0 : blob.length = blob_length;
18283 :
18284 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18285 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18286 : }
18287 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18288 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18289 : }
18290 :
18291 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18292 0 : allow_remaining = true;
18293 : }
18294 :
18295 0 : return py_winreg_OpenHKCC_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
18296 : }
18297 :
18298 0 : static PyObject *py_winreg_OpenHKCC_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18299 : {
18300 : DATA_BLOB blob;
18301 0 : Py_ssize_t blob_length = 0;
18302 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18303 0 : PyObject *bigendian_obj = NULL;
18304 0 : PyObject *ndr64_obj = NULL;
18305 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18306 0 : PyObject *allow_remaining_obj = NULL;
18307 0 : bool allow_remaining = false;
18308 :
18309 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
18310 : discard_const_p(char *, kwnames),
18311 : &blob.data, &blob_length,
18312 : &bigendian_obj,
18313 : &ndr64_obj,
18314 : &allow_remaining_obj)) {
18315 0 : return NULL;
18316 : }
18317 0 : blob.length = blob_length;
18318 :
18319 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18320 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18321 : }
18322 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18323 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18324 : }
18325 :
18326 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18327 0 : allow_remaining = true;
18328 : }
18329 :
18330 0 : return py_winreg_OpenHKCC_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
18331 : }
18332 :
18333 0 : static PyObject *py_winreg_OpenHKCC_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
18334 : {
18335 0 : const struct ndr_interface_call *call = NULL;
18336 0 : struct winreg_OpenHKCC *object = pytalloc_get_ptr(py_obj);
18337 : PyObject *ret;
18338 : char *retstr;
18339 :
18340 0 : if (ndr_table_winreg.num_calls < 28) {
18341 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCC_ndr_print");
18342 0 : return NULL;
18343 : }
18344 0 : call = &ndr_table_winreg.calls[27];
18345 :
18346 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
18347 0 : ret = PyUnicode_FromString(retstr);
18348 0 : TALLOC_FREE(retstr);
18349 :
18350 0 : return ret;
18351 : }
18352 :
18353 0 : static PyObject *py_winreg_OpenHKCC_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18354 : {
18355 0 : return py_winreg_OpenHKCC_ndr_print(py_obj, "winreg_OpenHKCC_in", NDR_IN);
18356 : }
18357 :
18358 0 : static PyObject *py_winreg_OpenHKCC_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18359 : {
18360 0 : return py_winreg_OpenHKCC_ndr_print(py_obj, "winreg_OpenHKCC_out", NDR_OUT);
18361 : }
18362 :
18363 : static PyMethodDef py_winreg_OpenHKCC_methods[] = {
18364 : { "opnum", (PyCFunction)py_winreg_OpenHKCC_ndr_opnum, METH_NOARGS|METH_CLASS,
18365 : "winreg.OpenHKCC.opnum() -> 27 (0x1b) " },
18366 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
18367 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
18368 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
18369 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
18370 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
18371 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
18372 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
18373 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
18374 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKCC_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
18375 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKCC_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
18376 : { NULL, NULL, 0, NULL }
18377 : };
18378 :
18379 :
18380 : static PyTypeObject winreg_OpenHKCC_Type = {
18381 : PyVarObject_HEAD_INIT(NULL, 0)
18382 : .tp_name = "winreg.OpenHKCC",
18383 : .tp_getset = py_winreg_OpenHKCC_getsetters,
18384 : .tp_methods = py_winreg_OpenHKCC_methods,
18385 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
18386 : .tp_new = py_winreg_OpenHKCC_new,
18387 : };
18388 :
18389 0 : static bool pack_py_winreg_OpenHKCC_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCC *r)
18390 : {
18391 : PyObject *py_system_name;
18392 : PyObject *py_access_mask;
18393 0 : const char *kwnames[] = {
18394 : "system_name", "access_mask", NULL
18395 : };
18396 :
18397 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCC", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
18398 0 : return false;
18399 : }
18400 :
18401 0 : if (py_system_name == NULL) {
18402 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
18403 0 : return false;
18404 : }
18405 0 : if (py_system_name == Py_None) {
18406 0 : r->in.system_name = NULL;
18407 : } else {
18408 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
18409 0 : if (r->in.system_name == NULL) {
18410 0 : PyErr_NoMemory();
18411 0 : return false;
18412 : }
18413 : {
18414 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
18415 0 : if (PyLong_Check(py_system_name)) {
18416 : unsigned long long test_var;
18417 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
18418 0 : if (PyErr_Occurred() != NULL) {
18419 0 : return false;
18420 : }
18421 0 : if (test_var > uint_max) {
18422 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18423 : PyLong_Type.tp_name, uint_max, test_var);
18424 0 : return false;
18425 : }
18426 0 : *r->in.system_name = test_var;
18427 : } else {
18428 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18429 : PyLong_Type.tp_name);
18430 0 : return false;
18431 : }
18432 : }
18433 : }
18434 0 : if (py_access_mask == NULL) {
18435 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
18436 0 : return false;
18437 : }
18438 : {
18439 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
18440 0 : if (PyLong_Check(py_access_mask)) {
18441 : unsigned long long test_var;
18442 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
18443 0 : if (PyErr_Occurred() != NULL) {
18444 0 : return false;
18445 : }
18446 0 : if (test_var > uint_max) {
18447 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18448 : PyLong_Type.tp_name, uint_max, test_var);
18449 0 : return false;
18450 : }
18451 0 : r->in.access_mask = test_var;
18452 : } else {
18453 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18454 : PyLong_Type.tp_name);
18455 0 : return false;
18456 : }
18457 : }
18458 0 : return true;
18459 : }
18460 :
18461 0 : static PyObject *unpack_py_winreg_OpenHKCC_args_out(struct winreg_OpenHKCC *r)
18462 : {
18463 : PyObject *result;
18464 : PyObject *py_handle;
18465 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
18466 0 : result = py_handle;
18467 0 : if (!W_ERROR_IS_OK(r->out.result)) {
18468 0 : PyErr_SetWERROR(r->out.result);
18469 0 : return NULL;
18470 : }
18471 :
18472 0 : return result;
18473 : }
18474 :
18475 :
18476 0 : static PyObject *py_winreg_OpenHKDD_in_get_system_name(PyObject *obj, void *closure)
18477 : {
18478 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(obj);
18479 : PyObject *py_system_name;
18480 0 : if (object->in.system_name == NULL) {
18481 0 : Py_RETURN_NONE;
18482 : }
18483 0 : if (object->in.system_name == NULL) {
18484 0 : py_system_name = Py_None;
18485 0 : Py_INCREF(py_system_name);
18486 : } else {
18487 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
18488 : }
18489 0 : return py_system_name;
18490 : }
18491 :
18492 0 : static int py_winreg_OpenHKDD_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
18493 : {
18494 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(py_obj);
18495 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
18496 0 : if (value == NULL) {
18497 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
18498 0 : return -1;
18499 : }
18500 0 : if (value == Py_None) {
18501 0 : object->in.system_name = NULL;
18502 : } else {
18503 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
18504 0 : if (object->in.system_name == NULL) {
18505 0 : PyErr_NoMemory();
18506 0 : return -1;
18507 : }
18508 : {
18509 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
18510 0 : if (PyLong_Check(value)) {
18511 : unsigned long long test_var;
18512 0 : test_var = PyLong_AsUnsignedLongLong(value);
18513 0 : if (PyErr_Occurred() != NULL) {
18514 0 : return -1;
18515 : }
18516 0 : if (test_var > uint_max) {
18517 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18518 : PyLong_Type.tp_name, uint_max, test_var);
18519 0 : return -1;
18520 : }
18521 0 : *object->in.system_name = test_var;
18522 : } else {
18523 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18524 : PyLong_Type.tp_name);
18525 0 : return -1;
18526 : }
18527 : }
18528 : }
18529 0 : return 0;
18530 : }
18531 :
18532 0 : static PyObject *py_winreg_OpenHKDD_in_get_access_mask(PyObject *obj, void *closure)
18533 : {
18534 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(obj);
18535 : PyObject *py_access_mask;
18536 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
18537 0 : return py_access_mask;
18538 : }
18539 :
18540 0 : static int py_winreg_OpenHKDD_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
18541 : {
18542 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(py_obj);
18543 0 : if (value == NULL) {
18544 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
18545 0 : return -1;
18546 : }
18547 : {
18548 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
18549 0 : if (PyLong_Check(value)) {
18550 : unsigned long long test_var;
18551 0 : test_var = PyLong_AsUnsignedLongLong(value);
18552 0 : if (PyErr_Occurred() != NULL) {
18553 0 : return -1;
18554 : }
18555 0 : if (test_var > uint_max) {
18556 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18557 : PyLong_Type.tp_name, uint_max, test_var);
18558 0 : return -1;
18559 : }
18560 0 : object->in.access_mask = test_var;
18561 : } else {
18562 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18563 : PyLong_Type.tp_name);
18564 0 : return -1;
18565 : }
18566 : }
18567 0 : return 0;
18568 : }
18569 :
18570 0 : static PyObject *py_winreg_OpenHKDD_out_get_handle(PyObject *obj, void *closure)
18571 : {
18572 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(obj);
18573 : PyObject *py_handle;
18574 0 : if (object->out.handle == NULL) {
18575 0 : Py_RETURN_NONE;
18576 : }
18577 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
18578 0 : return py_handle;
18579 : }
18580 :
18581 0 : static int py_winreg_OpenHKDD_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
18582 : {
18583 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(py_obj);
18584 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
18585 0 : if (value == NULL) {
18586 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
18587 0 : return -1;
18588 : }
18589 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
18590 0 : if (object->out.handle == NULL) {
18591 0 : PyErr_NoMemory();
18592 0 : return -1;
18593 : }
18594 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
18595 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
18596 0 : PyErr_NoMemory();
18597 0 : return -1;
18598 : }
18599 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
18600 0 : return 0;
18601 : }
18602 :
18603 0 : static PyObject *py_winreg_OpenHKDD_get_result(PyObject *obj, void *closure)
18604 : {
18605 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(obj);
18606 : PyObject *py_result;
18607 0 : py_result = PyErr_FromWERROR(object->out.result);
18608 0 : return py_result;
18609 : }
18610 :
18611 0 : static int py_winreg_OpenHKDD_set_result(PyObject *py_obj, PyObject *value, void *closure)
18612 : {
18613 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(py_obj);
18614 0 : if (value == NULL) {
18615 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
18616 0 : return -1;
18617 : }
18618 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
18619 0 : return 0;
18620 : }
18621 :
18622 : static PyGetSetDef py_winreg_OpenHKDD_getsetters[] = {
18623 : {
18624 : .name = discard_const_p(char, "in_system_name"),
18625 : .get = py_winreg_OpenHKDD_in_get_system_name,
18626 : .set = py_winreg_OpenHKDD_in_set_system_name,
18627 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
18628 : },
18629 : {
18630 : .name = discard_const_p(char, "in_access_mask"),
18631 : .get = py_winreg_OpenHKDD_in_get_access_mask,
18632 : .set = py_winreg_OpenHKDD_in_set_access_mask,
18633 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
18634 : },
18635 : {
18636 : .name = discard_const_p(char, "out_handle"),
18637 : .get = py_winreg_OpenHKDD_out_get_handle,
18638 : .set = py_winreg_OpenHKDD_out_set_handle,
18639 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
18640 : },
18641 : {
18642 : .name = discard_const_p(char, "result"),
18643 : .get = py_winreg_OpenHKDD_get_result,
18644 : .set = py_winreg_OpenHKDD_set_result,
18645 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
18646 : },
18647 : { .name = NULL }
18648 : };
18649 :
18650 0 : static PyObject *py_winreg_OpenHKDD_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
18651 : {
18652 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKDD, type);
18653 0 : struct winreg_OpenHKDD *_self = (struct winreg_OpenHKDD *)pytalloc_get_ptr(self);
18654 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
18655 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
18656 0 : return self;
18657 : }
18658 :
18659 0 : static PyObject *py_winreg_OpenHKDD_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
18660 : {
18661 :
18662 :
18663 0 : return PyLong_FromLong(28);
18664 : }
18665 :
18666 0 : static PyObject *py_winreg_OpenHKDD_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
18667 : {
18668 0 : const struct ndr_interface_call *call = NULL;
18669 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(py_obj);
18670 0 : PyObject *ret = NULL;
18671 0 : struct ndr_push *push = NULL;
18672 : DATA_BLOB blob;
18673 : enum ndr_err_code err;
18674 :
18675 0 : if (ndr_table_winreg.num_calls < 29) {
18676 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKDD_ndr_pack");
18677 0 : return NULL;
18678 : }
18679 0 : call = &ndr_table_winreg.calls[28];
18680 :
18681 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
18682 0 : if (push == NULL) {
18683 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18684 0 : return NULL;
18685 : }
18686 :
18687 0 : push->flags |= ndr_push_flags;
18688 :
18689 0 : err = call->ndr_push(push, ndr_inout_flags, object);
18690 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18691 0 : TALLOC_FREE(push);
18692 0 : PyErr_SetNdrError(err);
18693 0 : return NULL;
18694 : }
18695 0 : blob = ndr_push_blob(push);
18696 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
18697 0 : TALLOC_FREE(push);
18698 0 : return ret;
18699 : }
18700 :
18701 0 : static PyObject *py_winreg_OpenHKDD_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18702 : {
18703 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18704 0 : PyObject *bigendian_obj = NULL;
18705 0 : PyObject *ndr64_obj = NULL;
18706 0 : libndr_flags ndr_push_flags = 0;
18707 :
18708 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
18709 : discard_const_p(char *, kwnames),
18710 : &bigendian_obj,
18711 : &ndr64_obj)) {
18712 0 : return NULL;
18713 : }
18714 :
18715 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18716 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18717 : }
18718 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18719 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18720 : }
18721 :
18722 0 : return py_winreg_OpenHKDD_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
18723 : }
18724 :
18725 0 : static PyObject *py_winreg_OpenHKDD_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18726 : {
18727 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18728 0 : PyObject *bigendian_obj = NULL;
18729 0 : PyObject *ndr64_obj = NULL;
18730 0 : libndr_flags ndr_push_flags = 0;
18731 :
18732 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
18733 : discard_const_p(char *, kwnames),
18734 : &bigendian_obj,
18735 : &ndr64_obj)) {
18736 0 : return NULL;
18737 : }
18738 :
18739 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18740 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18741 : }
18742 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18743 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18744 : }
18745 :
18746 0 : return py_winreg_OpenHKDD_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
18747 : }
18748 :
18749 0 : static PyObject *py_winreg_OpenHKDD_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
18750 : {
18751 0 : const struct ndr_interface_call *call = NULL;
18752 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(py_obj);
18753 0 : struct ndr_pull *pull = NULL;
18754 : enum ndr_err_code err;
18755 :
18756 0 : if (ndr_table_winreg.num_calls < 29) {
18757 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKDD_ndr_unpack");
18758 0 : return NULL;
18759 : }
18760 0 : call = &ndr_table_winreg.calls[28];
18761 :
18762 0 : pull = ndr_pull_init_blob(blob, object);
18763 0 : if (pull == NULL) {
18764 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18765 0 : return NULL;
18766 : }
18767 :
18768 0 : pull->flags |= ndr_pull_flags;
18769 :
18770 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
18771 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18772 0 : TALLOC_FREE(pull);
18773 0 : PyErr_SetNdrError(err);
18774 0 : return NULL;
18775 : }
18776 0 : if (!allow_remaining) {
18777 : uint32_t highest_ofs;
18778 :
18779 0 : if (pull->offset > pull->relative_highest_offset) {
18780 0 : highest_ofs = pull->offset;
18781 : } else {
18782 0 : highest_ofs = pull->relative_highest_offset;
18783 : }
18784 0 : if (highest_ofs < pull->data_size) {
18785 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
18786 : "not all bytes consumed ofs[%u] size[%u]",
18787 : highest_ofs, pull->data_size);
18788 0 : TALLOC_FREE(pull);
18789 0 : PyErr_SetNdrError(err);
18790 0 : return NULL;
18791 : }
18792 : }
18793 :
18794 0 : TALLOC_FREE(pull);
18795 0 : Py_RETURN_NONE;
18796 : }
18797 :
18798 0 : static PyObject *py_winreg_OpenHKDD_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18799 : {
18800 : DATA_BLOB blob;
18801 0 : Py_ssize_t blob_length = 0;
18802 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18803 0 : PyObject *bigendian_obj = NULL;
18804 0 : PyObject *ndr64_obj = NULL;
18805 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18806 0 : PyObject *allow_remaining_obj = NULL;
18807 0 : bool allow_remaining = false;
18808 :
18809 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
18810 : discard_const_p(char *, kwnames),
18811 : &blob.data, &blob_length,
18812 : &bigendian_obj,
18813 : &ndr64_obj,
18814 : &allow_remaining_obj)) {
18815 0 : return NULL;
18816 : }
18817 0 : blob.length = blob_length;
18818 :
18819 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18820 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18821 : }
18822 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18823 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18824 : }
18825 :
18826 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18827 0 : allow_remaining = true;
18828 : }
18829 :
18830 0 : return py_winreg_OpenHKDD_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
18831 : }
18832 :
18833 0 : static PyObject *py_winreg_OpenHKDD_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18834 : {
18835 : DATA_BLOB blob;
18836 0 : Py_ssize_t blob_length = 0;
18837 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18838 0 : PyObject *bigendian_obj = NULL;
18839 0 : PyObject *ndr64_obj = NULL;
18840 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18841 0 : PyObject *allow_remaining_obj = NULL;
18842 0 : bool allow_remaining = false;
18843 :
18844 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
18845 : discard_const_p(char *, kwnames),
18846 : &blob.data, &blob_length,
18847 : &bigendian_obj,
18848 : &ndr64_obj,
18849 : &allow_remaining_obj)) {
18850 0 : return NULL;
18851 : }
18852 0 : blob.length = blob_length;
18853 :
18854 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18855 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18856 : }
18857 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18858 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18859 : }
18860 :
18861 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18862 0 : allow_remaining = true;
18863 : }
18864 :
18865 0 : return py_winreg_OpenHKDD_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
18866 : }
18867 :
18868 0 : static PyObject *py_winreg_OpenHKDD_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
18869 : {
18870 0 : const struct ndr_interface_call *call = NULL;
18871 0 : struct winreg_OpenHKDD *object = pytalloc_get_ptr(py_obj);
18872 : PyObject *ret;
18873 : char *retstr;
18874 :
18875 0 : if (ndr_table_winreg.num_calls < 29) {
18876 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKDD_ndr_print");
18877 0 : return NULL;
18878 : }
18879 0 : call = &ndr_table_winreg.calls[28];
18880 :
18881 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
18882 0 : ret = PyUnicode_FromString(retstr);
18883 0 : TALLOC_FREE(retstr);
18884 :
18885 0 : return ret;
18886 : }
18887 :
18888 0 : static PyObject *py_winreg_OpenHKDD_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18889 : {
18890 0 : return py_winreg_OpenHKDD_ndr_print(py_obj, "winreg_OpenHKDD_in", NDR_IN);
18891 : }
18892 :
18893 0 : static PyObject *py_winreg_OpenHKDD_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18894 : {
18895 0 : return py_winreg_OpenHKDD_ndr_print(py_obj, "winreg_OpenHKDD_out", NDR_OUT);
18896 : }
18897 :
18898 : static PyMethodDef py_winreg_OpenHKDD_methods[] = {
18899 : { "opnum", (PyCFunction)py_winreg_OpenHKDD_ndr_opnum, METH_NOARGS|METH_CLASS,
18900 : "winreg.OpenHKDD.opnum() -> 28 (0x1c) " },
18901 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
18902 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
18903 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
18904 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
18905 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
18906 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
18907 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
18908 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
18909 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKDD_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
18910 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKDD_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
18911 : { NULL, NULL, 0, NULL }
18912 : };
18913 :
18914 :
18915 : static PyTypeObject winreg_OpenHKDD_Type = {
18916 : PyVarObject_HEAD_INIT(NULL, 0)
18917 : .tp_name = "winreg.OpenHKDD",
18918 : .tp_getset = py_winreg_OpenHKDD_getsetters,
18919 : .tp_methods = py_winreg_OpenHKDD_methods,
18920 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
18921 : .tp_new = py_winreg_OpenHKDD_new,
18922 : };
18923 :
18924 0 : static bool pack_py_winreg_OpenHKDD_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKDD *r)
18925 : {
18926 : PyObject *py_system_name;
18927 : PyObject *py_access_mask;
18928 0 : const char *kwnames[] = {
18929 : "system_name", "access_mask", NULL
18930 : };
18931 :
18932 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKDD", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
18933 0 : return false;
18934 : }
18935 :
18936 0 : if (py_system_name == NULL) {
18937 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
18938 0 : return false;
18939 : }
18940 0 : if (py_system_name == Py_None) {
18941 0 : r->in.system_name = NULL;
18942 : } else {
18943 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
18944 0 : if (r->in.system_name == NULL) {
18945 0 : PyErr_NoMemory();
18946 0 : return false;
18947 : }
18948 : {
18949 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
18950 0 : if (PyLong_Check(py_system_name)) {
18951 : unsigned long long test_var;
18952 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
18953 0 : if (PyErr_Occurred() != NULL) {
18954 0 : return false;
18955 : }
18956 0 : if (test_var > uint_max) {
18957 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18958 : PyLong_Type.tp_name, uint_max, test_var);
18959 0 : return false;
18960 : }
18961 0 : *r->in.system_name = test_var;
18962 : } else {
18963 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18964 : PyLong_Type.tp_name);
18965 0 : return false;
18966 : }
18967 : }
18968 : }
18969 0 : if (py_access_mask == NULL) {
18970 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
18971 0 : return false;
18972 : }
18973 : {
18974 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
18975 0 : if (PyLong_Check(py_access_mask)) {
18976 : unsigned long long test_var;
18977 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
18978 0 : if (PyErr_Occurred() != NULL) {
18979 0 : return false;
18980 : }
18981 0 : if (test_var > uint_max) {
18982 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18983 : PyLong_Type.tp_name, uint_max, test_var);
18984 0 : return false;
18985 : }
18986 0 : r->in.access_mask = test_var;
18987 : } else {
18988 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18989 : PyLong_Type.tp_name);
18990 0 : return false;
18991 : }
18992 : }
18993 0 : return true;
18994 : }
18995 :
18996 0 : static PyObject *unpack_py_winreg_OpenHKDD_args_out(struct winreg_OpenHKDD *r)
18997 : {
18998 : PyObject *result;
18999 : PyObject *py_handle;
19000 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
19001 0 : result = py_handle;
19002 0 : if (!W_ERROR_IS_OK(r->out.result)) {
19003 0 : PyErr_SetWERROR(r->out.result);
19004 0 : return NULL;
19005 : }
19006 :
19007 0 : return result;
19008 : }
19009 :
19010 :
19011 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_key_handle(PyObject *obj, void *closure)
19012 : {
19013 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19014 : PyObject *py_key_handle;
19015 0 : if (object->in.key_handle == NULL) {
19016 0 : Py_RETURN_NONE;
19017 : }
19018 0 : py_key_handle = pytalloc_reference_ex(policy_handle_Type, object->in.key_handle, object->in.key_handle);
19019 0 : return py_key_handle;
19020 : }
19021 :
19022 0 : static int py_winreg_QueryMultipleValues_in_set_key_handle(PyObject *py_obj, PyObject *value, void *closure)
19023 : {
19024 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19025 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.key_handle));
19026 0 : if (value == NULL) {
19027 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.key_handle");
19028 0 : return -1;
19029 : }
19030 0 : object->in.key_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.key_handle);
19031 0 : if (object->in.key_handle == NULL) {
19032 0 : PyErr_NoMemory();
19033 0 : return -1;
19034 : }
19035 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
19036 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
19037 0 : PyErr_NoMemory();
19038 0 : return -1;
19039 : }
19040 0 : object->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(value);
19041 0 : return 0;
19042 : }
19043 :
19044 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_values_in(PyObject *obj, void *closure)
19045 : {
19046 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19047 : PyObject *py_values_in;
19048 0 : if (object->in.values_in == NULL) {
19049 0 : Py_RETURN_NONE;
19050 : }
19051 0 : py_values_in = PyList_New(object->in.num_values);
19052 0 : if (py_values_in == NULL) {
19053 0 : return NULL;
19054 : }
19055 : {
19056 : int values_in_cntr_1;
19057 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < (object->in.num_values); values_in_cntr_1++) {
19058 : PyObject *py_values_in_1;
19059 0 : py_values_in_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->in.values_in, &(object->in.values_in)[values_in_cntr_1]);
19060 0 : PyList_SetItem(py_values_in, values_in_cntr_1, py_values_in_1);
19061 : }
19062 : }
19063 0 : return py_values_in;
19064 : }
19065 :
19066 0 : static int py_winreg_QueryMultipleValues_in_set_values_in(PyObject *py_obj, PyObject *value, void *closure)
19067 : {
19068 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19069 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.values_in));
19070 0 : if (value == NULL) {
19071 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.values_in");
19072 0 : return -1;
19073 : }
19074 0 : object->in.values_in = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in);
19075 0 : if (object->in.values_in == NULL) {
19076 0 : PyErr_NoMemory();
19077 0 : return -1;
19078 : }
19079 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19080 : {
19081 : int values_in_cntr_1;
19082 0 : object->in.values_in = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in, PyList_GET_SIZE(value));
19083 0 : if (!object->in.values_in) { return -1; }
19084 0 : talloc_set_name_const(object->in.values_in, "ARRAY: object->in.values_in");
19085 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(value); values_in_cntr_1++) {
19086 0 : if (PyList_GET_ITEM(value, values_in_cntr_1) == NULL) {
19087 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.values_in)[values_in_cntr_1]");
19088 0 : return -1;
19089 : }
19090 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_in_cntr_1), return -1;);
19091 0 : if (talloc_reference(object->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_in_cntr_1))) == NULL) {
19092 0 : PyErr_NoMemory();
19093 0 : return -1;
19094 : }
19095 0 : (object->in.values_in)[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_in_cntr_1));
19096 : }
19097 : }
19098 0 : return 0;
19099 : }
19100 :
19101 0 : static PyObject *py_winreg_QueryMultipleValues_out_get_values_out(PyObject *obj, void *closure)
19102 : {
19103 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19104 : PyObject *py_values_out;
19105 0 : if (object->out.values_out == NULL) {
19106 0 : Py_RETURN_NONE;
19107 : }
19108 0 : py_values_out = PyList_New(object->in.num_values);
19109 0 : if (py_values_out == NULL) {
19110 0 : return NULL;
19111 : }
19112 : {
19113 : int values_out_cntr_1;
19114 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (object->in.num_values); values_out_cntr_1++) {
19115 : PyObject *py_values_out_1;
19116 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->out.values_out, &(object->out.values_out)[values_out_cntr_1]);
19117 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
19118 : }
19119 : }
19120 0 : return py_values_out;
19121 : }
19122 :
19123 0 : static int py_winreg_QueryMultipleValues_out_set_values_out(PyObject *py_obj, PyObject *value, void *closure)
19124 : {
19125 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19126 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.values_out));
19127 0 : if (value == NULL) {
19128 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.values_out");
19129 0 : return -1;
19130 : }
19131 0 : object->out.values_out = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out);
19132 0 : if (object->out.values_out == NULL) {
19133 0 : PyErr_NoMemory();
19134 0 : return -1;
19135 : }
19136 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19137 : {
19138 : int values_out_cntr_1;
19139 0 : object->out.values_out = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out, PyList_GET_SIZE(value));
19140 0 : if (!object->out.values_out) { return -1; }
19141 0 : talloc_set_name_const(object->out.values_out, "ARRAY: object->out.values_out");
19142 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < PyList_GET_SIZE(value); values_out_cntr_1++) {
19143 0 : if (PyList_GET_ITEM(value, values_out_cntr_1) == NULL) {
19144 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->out.values_out)[values_out_cntr_1]");
19145 0 : return -1;
19146 : }
19147 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_out_cntr_1), return -1;);
19148 0 : if (talloc_reference(object->out.values_out, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_out_cntr_1))) == NULL) {
19149 0 : PyErr_NoMemory();
19150 0 : return -1;
19151 : }
19152 0 : (object->out.values_out)[values_out_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_out_cntr_1));
19153 : }
19154 : }
19155 0 : return 0;
19156 : }
19157 :
19158 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_num_values(PyObject *obj, void *closure)
19159 : {
19160 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19161 : PyObject *py_num_values;
19162 0 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)(object->in.num_values));
19163 0 : return py_num_values;
19164 : }
19165 :
19166 0 : static int py_winreg_QueryMultipleValues_in_set_num_values(PyObject *py_obj, PyObject *value, void *closure)
19167 : {
19168 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19169 0 : if (value == NULL) {
19170 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.num_values");
19171 0 : return -1;
19172 : }
19173 : {
19174 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.num_values));
19175 0 : if (PyLong_Check(value)) {
19176 : unsigned long long test_var;
19177 0 : test_var = PyLong_AsUnsignedLongLong(value);
19178 0 : if (PyErr_Occurred() != NULL) {
19179 0 : return -1;
19180 : }
19181 0 : if (test_var > uint_max) {
19182 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19183 : PyLong_Type.tp_name, uint_max, test_var);
19184 0 : return -1;
19185 : }
19186 0 : object->in.num_values = test_var;
19187 : } else {
19188 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19189 : PyLong_Type.tp_name);
19190 0 : return -1;
19191 : }
19192 : }
19193 0 : return 0;
19194 : }
19195 :
19196 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_buffer(PyObject *obj, void *closure)
19197 : {
19198 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19199 : PyObject *py_buffer;
19200 0 : if (object->in.buffer == NULL) {
19201 0 : Py_RETURN_NONE;
19202 : }
19203 0 : if (object->in.buffer == NULL) {
19204 0 : py_buffer = Py_None;
19205 0 : Py_INCREF(py_buffer);
19206 : } else {
19207 0 : py_buffer = PyList_New(*object->in.buffer_size);
19208 0 : if (py_buffer == NULL) {
19209 0 : return NULL;
19210 : }
19211 : {
19212 : int buffer_cntr_1;
19213 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->in.buffer_size); buffer_cntr_1++) {
19214 : PyObject *py_buffer_1;
19215 0 : py_buffer_1 = PyLong_FromLong((uint16_t)((object->in.buffer)[buffer_cntr_1]));
19216 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
19217 : }
19218 : }
19219 : }
19220 0 : return py_buffer;
19221 : }
19222 :
19223 0 : static int py_winreg_QueryMultipleValues_in_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
19224 : {
19225 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19226 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer));
19227 0 : if (value == NULL) {
19228 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.buffer");
19229 0 : return -1;
19230 : }
19231 0 : if (value == Py_None) {
19232 0 : object->in.buffer = NULL;
19233 : } else {
19234 0 : object->in.buffer = NULL;
19235 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19236 : {
19237 : int buffer_cntr_1;
19238 0 : object->in.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer, PyList_GET_SIZE(value));
19239 0 : if (!object->in.buffer) { return -1; }
19240 0 : talloc_set_name_const(object->in.buffer, "ARRAY: object->in.buffer");
19241 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
19242 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
19243 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.buffer)[buffer_cntr_1]");
19244 0 : return -1;
19245 : }
19246 : {
19247 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->in.buffer)[buffer_cntr_1]));
19248 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
19249 : unsigned long long test_var;
19250 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
19251 0 : if (PyErr_Occurred() != NULL) {
19252 0 : return -1;
19253 : }
19254 0 : if (test_var > uint_max) {
19255 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19256 : PyLong_Type.tp_name, uint_max, test_var);
19257 0 : return -1;
19258 : }
19259 0 : (object->in.buffer)[buffer_cntr_1] = test_var;
19260 : } else {
19261 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19262 : PyLong_Type.tp_name);
19263 0 : return -1;
19264 : }
19265 : }
19266 : }
19267 : }
19268 : }
19269 0 : return 0;
19270 : }
19271 :
19272 0 : static PyObject *py_winreg_QueryMultipleValues_out_get_buffer(PyObject *obj, void *closure)
19273 : {
19274 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19275 : PyObject *py_buffer;
19276 0 : if (object->out.buffer == NULL) {
19277 0 : Py_RETURN_NONE;
19278 : }
19279 0 : if (object->out.buffer == NULL) {
19280 0 : py_buffer = Py_None;
19281 0 : Py_INCREF(py_buffer);
19282 : } else {
19283 0 : py_buffer = PyList_New(*object->out.buffer_size);
19284 0 : if (py_buffer == NULL) {
19285 0 : return NULL;
19286 : }
19287 : {
19288 : int buffer_cntr_1;
19289 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->out.buffer_size); buffer_cntr_1++) {
19290 : PyObject *py_buffer_1;
19291 0 : py_buffer_1 = PyLong_FromLong((uint16_t)((object->out.buffer)[buffer_cntr_1]));
19292 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
19293 : }
19294 : }
19295 : }
19296 0 : return py_buffer;
19297 : }
19298 :
19299 0 : static int py_winreg_QueryMultipleValues_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
19300 : {
19301 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19302 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer));
19303 0 : if (value == NULL) {
19304 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.buffer");
19305 0 : return -1;
19306 : }
19307 0 : if (value == Py_None) {
19308 0 : object->out.buffer = NULL;
19309 : } else {
19310 0 : object->out.buffer = NULL;
19311 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19312 : {
19313 : int buffer_cntr_1;
19314 0 : object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value));
19315 0 : if (!object->out.buffer) { return -1; }
19316 0 : talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer");
19317 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
19318 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
19319 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->out.buffer)[buffer_cntr_1]");
19320 0 : return -1;
19321 : }
19322 : {
19323 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->out.buffer)[buffer_cntr_1]));
19324 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
19325 : unsigned long long test_var;
19326 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
19327 0 : if (PyErr_Occurred() != NULL) {
19328 0 : return -1;
19329 : }
19330 0 : if (test_var > uint_max) {
19331 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19332 : PyLong_Type.tp_name, uint_max, test_var);
19333 0 : return -1;
19334 : }
19335 0 : (object->out.buffer)[buffer_cntr_1] = test_var;
19336 : } else {
19337 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19338 : PyLong_Type.tp_name);
19339 0 : return -1;
19340 : }
19341 : }
19342 : }
19343 : }
19344 : }
19345 0 : return 0;
19346 : }
19347 :
19348 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_buffer_size(PyObject *obj, void *closure)
19349 : {
19350 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19351 : PyObject *py_buffer_size;
19352 0 : if (object->in.buffer_size == NULL) {
19353 0 : Py_RETURN_NONE;
19354 : }
19355 0 : py_buffer_size = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.buffer_size));
19356 0 : return py_buffer_size;
19357 : }
19358 :
19359 0 : static int py_winreg_QueryMultipleValues_in_set_buffer_size(PyObject *py_obj, PyObject *value, void *closure)
19360 : {
19361 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19362 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer_size));
19363 0 : if (value == NULL) {
19364 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.buffer_size");
19365 0 : return -1;
19366 : }
19367 0 : object->in.buffer_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer_size);
19368 0 : if (object->in.buffer_size == NULL) {
19369 0 : PyErr_NoMemory();
19370 0 : return -1;
19371 : }
19372 : {
19373 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.buffer_size));
19374 0 : if (PyLong_Check(value)) {
19375 : unsigned long long test_var;
19376 0 : test_var = PyLong_AsUnsignedLongLong(value);
19377 0 : if (PyErr_Occurred() != NULL) {
19378 0 : return -1;
19379 : }
19380 0 : if (test_var > uint_max) {
19381 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19382 : PyLong_Type.tp_name, uint_max, test_var);
19383 0 : return -1;
19384 : }
19385 0 : *object->in.buffer_size = test_var;
19386 : } else {
19387 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19388 : PyLong_Type.tp_name);
19389 0 : return -1;
19390 : }
19391 : }
19392 0 : return 0;
19393 : }
19394 :
19395 0 : static PyObject *py_winreg_QueryMultipleValues_out_get_buffer_size(PyObject *obj, void *closure)
19396 : {
19397 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19398 : PyObject *py_buffer_size;
19399 0 : if (object->out.buffer_size == NULL) {
19400 0 : Py_RETURN_NONE;
19401 : }
19402 0 : py_buffer_size = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.buffer_size));
19403 0 : return py_buffer_size;
19404 : }
19405 :
19406 0 : static int py_winreg_QueryMultipleValues_out_set_buffer_size(PyObject *py_obj, PyObject *value, void *closure)
19407 : {
19408 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19409 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer_size));
19410 0 : if (value == NULL) {
19411 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.buffer_size");
19412 0 : return -1;
19413 : }
19414 0 : object->out.buffer_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer_size);
19415 0 : if (object->out.buffer_size == NULL) {
19416 0 : PyErr_NoMemory();
19417 0 : return -1;
19418 : }
19419 : {
19420 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.buffer_size));
19421 0 : if (PyLong_Check(value)) {
19422 : unsigned long long test_var;
19423 0 : test_var = PyLong_AsUnsignedLongLong(value);
19424 0 : if (PyErr_Occurred() != NULL) {
19425 0 : return -1;
19426 : }
19427 0 : if (test_var > uint_max) {
19428 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19429 : PyLong_Type.tp_name, uint_max, test_var);
19430 0 : return -1;
19431 : }
19432 0 : *object->out.buffer_size = test_var;
19433 : } else {
19434 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19435 : PyLong_Type.tp_name);
19436 0 : return -1;
19437 : }
19438 : }
19439 0 : return 0;
19440 : }
19441 :
19442 0 : static PyObject *py_winreg_QueryMultipleValues_get_result(PyObject *obj, void *closure)
19443 : {
19444 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(obj);
19445 : PyObject *py_result;
19446 0 : py_result = PyErr_FromWERROR(object->out.result);
19447 0 : return py_result;
19448 : }
19449 :
19450 0 : static int py_winreg_QueryMultipleValues_set_result(PyObject *py_obj, PyObject *value, void *closure)
19451 : {
19452 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19453 0 : if (value == NULL) {
19454 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
19455 0 : return -1;
19456 : }
19457 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
19458 0 : return 0;
19459 : }
19460 :
19461 : static PyGetSetDef py_winreg_QueryMultipleValues_getsetters[] = {
19462 : {
19463 : .name = discard_const_p(char, "in_key_handle"),
19464 : .get = py_winreg_QueryMultipleValues_in_get_key_handle,
19465 : .set = py_winreg_QueryMultipleValues_in_set_key_handle,
19466 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
19467 : },
19468 : {
19469 : .name = discard_const_p(char, "in_values_in"),
19470 : .get = py_winreg_QueryMultipleValues_in_get_values_in,
19471 : .set = py_winreg_QueryMultipleValues_in_set_values_in,
19472 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
19473 : },
19474 : {
19475 : .name = discard_const_p(char, "out_values_out"),
19476 : .get = py_winreg_QueryMultipleValues_out_get_values_out,
19477 : .set = py_winreg_QueryMultipleValues_out_set_values_out,
19478 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
19479 : },
19480 : {
19481 : .name = discard_const_p(char, "in_num_values"),
19482 : .get = py_winreg_QueryMultipleValues_in_get_num_values,
19483 : .set = py_winreg_QueryMultipleValues_in_set_num_values,
19484 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
19485 : },
19486 : {
19487 : .name = discard_const_p(char, "in_buffer"),
19488 : .get = py_winreg_QueryMultipleValues_in_get_buffer,
19489 : .set = py_winreg_QueryMultipleValues_in_set_buffer,
19490 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
19491 : },
19492 : {
19493 : .name = discard_const_p(char, "out_buffer"),
19494 : .get = py_winreg_QueryMultipleValues_out_get_buffer,
19495 : .set = py_winreg_QueryMultipleValues_out_set_buffer,
19496 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
19497 : },
19498 : {
19499 : .name = discard_const_p(char, "in_buffer_size"),
19500 : .get = py_winreg_QueryMultipleValues_in_get_buffer_size,
19501 : .set = py_winreg_QueryMultipleValues_in_set_buffer_size,
19502 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
19503 : },
19504 : {
19505 : .name = discard_const_p(char, "out_buffer_size"),
19506 : .get = py_winreg_QueryMultipleValues_out_get_buffer_size,
19507 : .set = py_winreg_QueryMultipleValues_out_set_buffer_size,
19508 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
19509 : },
19510 : {
19511 : .name = discard_const_p(char, "result"),
19512 : .get = py_winreg_QueryMultipleValues_get_result,
19513 : .set = py_winreg_QueryMultipleValues_set_result,
19514 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
19515 : },
19516 : { .name = NULL }
19517 : };
19518 :
19519 0 : static PyObject *py_winreg_QueryMultipleValues_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
19520 : {
19521 0 : PyObject *self = pytalloc_new(struct winreg_QueryMultipleValues, type);
19522 0 : struct winreg_QueryMultipleValues *_self = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(self);
19523 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
19524 0 : _self->in.key_handle = talloc_zero(mem_ctx, struct policy_handle);
19525 0 : _self->in.values_in = talloc_zero(mem_ctx, struct QueryMultipleValue);
19526 0 : _self->out.values_out = talloc_zero(mem_ctx, struct QueryMultipleValue);
19527 0 : _self->in.buffer_size = talloc_zero(mem_ctx, uint32_t);
19528 0 : _self->out.buffer_size = talloc_zero(mem_ctx, uint32_t);
19529 0 : return self;
19530 : }
19531 :
19532 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
19533 : {
19534 :
19535 :
19536 0 : return PyLong_FromLong(29);
19537 : }
19538 :
19539 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
19540 : {
19541 0 : const struct ndr_interface_call *call = NULL;
19542 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19543 0 : PyObject *ret = NULL;
19544 0 : struct ndr_push *push = NULL;
19545 : DATA_BLOB blob;
19546 : enum ndr_err_code err;
19547 :
19548 0 : if (ndr_table_winreg.num_calls < 30) {
19549 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues_ndr_pack");
19550 0 : return NULL;
19551 : }
19552 0 : call = &ndr_table_winreg.calls[29];
19553 :
19554 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
19555 0 : if (push == NULL) {
19556 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
19557 0 : return NULL;
19558 : }
19559 :
19560 0 : push->flags |= ndr_push_flags;
19561 :
19562 0 : err = call->ndr_push(push, ndr_inout_flags, object);
19563 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
19564 0 : TALLOC_FREE(push);
19565 0 : PyErr_SetNdrError(err);
19566 0 : return NULL;
19567 : }
19568 0 : blob = ndr_push_blob(push);
19569 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
19570 0 : TALLOC_FREE(push);
19571 0 : return ret;
19572 : }
19573 :
19574 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19575 : {
19576 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
19577 0 : PyObject *bigendian_obj = NULL;
19578 0 : PyObject *ndr64_obj = NULL;
19579 0 : libndr_flags ndr_push_flags = 0;
19580 :
19581 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
19582 : discard_const_p(char *, kwnames),
19583 : &bigendian_obj,
19584 : &ndr64_obj)) {
19585 0 : return NULL;
19586 : }
19587 :
19588 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19589 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
19590 : }
19591 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19592 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
19593 : }
19594 :
19595 0 : return py_winreg_QueryMultipleValues_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
19596 : }
19597 :
19598 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19599 : {
19600 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
19601 0 : PyObject *bigendian_obj = NULL;
19602 0 : PyObject *ndr64_obj = NULL;
19603 0 : libndr_flags ndr_push_flags = 0;
19604 :
19605 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
19606 : discard_const_p(char *, kwnames),
19607 : &bigendian_obj,
19608 : &ndr64_obj)) {
19609 0 : return NULL;
19610 : }
19611 :
19612 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19613 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
19614 : }
19615 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19616 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
19617 : }
19618 :
19619 0 : return py_winreg_QueryMultipleValues_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
19620 : }
19621 :
19622 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
19623 : {
19624 0 : const struct ndr_interface_call *call = NULL;
19625 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19626 0 : struct ndr_pull *pull = NULL;
19627 : enum ndr_err_code err;
19628 :
19629 0 : if (ndr_table_winreg.num_calls < 30) {
19630 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues_ndr_unpack");
19631 0 : return NULL;
19632 : }
19633 0 : call = &ndr_table_winreg.calls[29];
19634 :
19635 0 : pull = ndr_pull_init_blob(blob, object);
19636 0 : if (pull == NULL) {
19637 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
19638 0 : return NULL;
19639 : }
19640 :
19641 0 : pull->flags |= ndr_pull_flags;
19642 :
19643 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
19644 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
19645 0 : TALLOC_FREE(pull);
19646 0 : PyErr_SetNdrError(err);
19647 0 : return NULL;
19648 : }
19649 0 : if (!allow_remaining) {
19650 : uint32_t highest_ofs;
19651 :
19652 0 : if (pull->offset > pull->relative_highest_offset) {
19653 0 : highest_ofs = pull->offset;
19654 : } else {
19655 0 : highest_ofs = pull->relative_highest_offset;
19656 : }
19657 0 : if (highest_ofs < pull->data_size) {
19658 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
19659 : "not all bytes consumed ofs[%u] size[%u]",
19660 : highest_ofs, pull->data_size);
19661 0 : TALLOC_FREE(pull);
19662 0 : PyErr_SetNdrError(err);
19663 0 : return NULL;
19664 : }
19665 : }
19666 :
19667 0 : TALLOC_FREE(pull);
19668 0 : Py_RETURN_NONE;
19669 : }
19670 :
19671 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19672 : {
19673 : DATA_BLOB blob;
19674 0 : Py_ssize_t blob_length = 0;
19675 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
19676 0 : PyObject *bigendian_obj = NULL;
19677 0 : PyObject *ndr64_obj = NULL;
19678 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
19679 0 : PyObject *allow_remaining_obj = NULL;
19680 0 : bool allow_remaining = false;
19681 :
19682 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
19683 : discard_const_p(char *, kwnames),
19684 : &blob.data, &blob_length,
19685 : &bigendian_obj,
19686 : &ndr64_obj,
19687 : &allow_remaining_obj)) {
19688 0 : return NULL;
19689 : }
19690 0 : blob.length = blob_length;
19691 :
19692 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19693 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
19694 : }
19695 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19696 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
19697 : }
19698 :
19699 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
19700 0 : allow_remaining = true;
19701 : }
19702 :
19703 0 : return py_winreg_QueryMultipleValues_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
19704 : }
19705 :
19706 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19707 : {
19708 : DATA_BLOB blob;
19709 0 : Py_ssize_t blob_length = 0;
19710 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
19711 0 : PyObject *bigendian_obj = NULL;
19712 0 : PyObject *ndr64_obj = NULL;
19713 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
19714 0 : PyObject *allow_remaining_obj = NULL;
19715 0 : bool allow_remaining = false;
19716 :
19717 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
19718 : discard_const_p(char *, kwnames),
19719 : &blob.data, &blob_length,
19720 : &bigendian_obj,
19721 : &ndr64_obj,
19722 : &allow_remaining_obj)) {
19723 0 : return NULL;
19724 : }
19725 0 : blob.length = blob_length;
19726 :
19727 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19728 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
19729 : }
19730 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19731 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
19732 : }
19733 :
19734 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
19735 0 : allow_remaining = true;
19736 : }
19737 :
19738 0 : return py_winreg_QueryMultipleValues_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
19739 : }
19740 :
19741 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
19742 : {
19743 0 : const struct ndr_interface_call *call = NULL;
19744 0 : struct winreg_QueryMultipleValues *object = pytalloc_get_ptr(py_obj);
19745 : PyObject *ret;
19746 : char *retstr;
19747 :
19748 0 : if (ndr_table_winreg.num_calls < 30) {
19749 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues_ndr_print");
19750 0 : return NULL;
19751 : }
19752 0 : call = &ndr_table_winreg.calls[29];
19753 :
19754 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
19755 0 : ret = PyUnicode_FromString(retstr);
19756 0 : TALLOC_FREE(retstr);
19757 :
19758 0 : return ret;
19759 : }
19760 :
19761 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
19762 : {
19763 0 : return py_winreg_QueryMultipleValues_ndr_print(py_obj, "winreg_QueryMultipleValues_in", NDR_IN);
19764 : }
19765 :
19766 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
19767 : {
19768 0 : return py_winreg_QueryMultipleValues_ndr_print(py_obj, "winreg_QueryMultipleValues_out", NDR_OUT);
19769 : }
19770 :
19771 : static PyMethodDef py_winreg_QueryMultipleValues_methods[] = {
19772 : { "opnum", (PyCFunction)py_winreg_QueryMultipleValues_ndr_opnum, METH_NOARGS|METH_CLASS,
19773 : "winreg.QueryMultipleValues.opnum() -> 29 (0x1d) " },
19774 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
19775 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
19776 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
19777 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
19778 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
19779 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
19780 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
19781 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
19782 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryMultipleValues_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
19783 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryMultipleValues_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
19784 : { NULL, NULL, 0, NULL }
19785 : };
19786 :
19787 :
19788 : static PyTypeObject winreg_QueryMultipleValues_Type = {
19789 : PyVarObject_HEAD_INIT(NULL, 0)
19790 : .tp_name = "winreg.QueryMultipleValues",
19791 : .tp_getset = py_winreg_QueryMultipleValues_getsetters,
19792 : .tp_methods = py_winreg_QueryMultipleValues_methods,
19793 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
19794 : .tp_new = py_winreg_QueryMultipleValues_new,
19795 : };
19796 :
19797 0 : static bool pack_py_winreg_QueryMultipleValues_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryMultipleValues *r)
19798 : {
19799 : PyObject *py_key_handle;
19800 : PyObject *py_values_in;
19801 : PyObject *py_buffer;
19802 0 : const char *kwnames[] = {
19803 : "key_handle", "values_in", "buffer", NULL
19804 : };
19805 :
19806 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_QueryMultipleValues", discard_const_p(char *, kwnames), &py_key_handle, &py_values_in, &py_buffer)) {
19807 0 : return false;
19808 : }
19809 :
19810 0 : if (py_key_handle == NULL) {
19811 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.key_handle");
19812 0 : return false;
19813 : }
19814 0 : r->in.key_handle = talloc_ptrtype(r, r->in.key_handle);
19815 0 : if (r->in.key_handle == NULL) {
19816 0 : PyErr_NoMemory();
19817 0 : return false;
19818 : }
19819 0 : PY_CHECK_TYPE(policy_handle_Type, py_key_handle, return false;);
19820 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key_handle)) == NULL) {
19821 0 : PyErr_NoMemory();
19822 0 : return false;
19823 : }
19824 0 : r->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(py_key_handle);
19825 0 : if (py_values_in == NULL) {
19826 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.values_in");
19827 0 : return false;
19828 : }
19829 0 : r->in.values_in = talloc_ptrtype(r, r->in.values_in);
19830 0 : if (r->in.values_in == NULL) {
19831 0 : PyErr_NoMemory();
19832 0 : return false;
19833 : }
19834 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
19835 : {
19836 : int values_in_cntr_1;
19837 0 : r->in.values_in = talloc_array_ptrtype(r, r->in.values_in, PyList_GET_SIZE(py_values_in));
19838 0 : if (!r->in.values_in) { return false; }
19839 0 : talloc_set_name_const(r->in.values_in, "ARRAY: r->in.values_in");
19840 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(py_values_in); values_in_cntr_1++) {
19841 0 : if (PyList_GET_ITEM(py_values_in, values_in_cntr_1) == NULL) {
19842 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.values_in)[values_in_cntr_1]");
19843 0 : return false;
19844 : }
19845 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(py_values_in, values_in_cntr_1), return false;);
19846 0 : if (talloc_reference(r->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(py_values_in, values_in_cntr_1))) == NULL) {
19847 0 : PyErr_NoMemory();
19848 0 : return false;
19849 : }
19850 0 : (r->in.values_in)[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(py_values_in, values_in_cntr_1));
19851 : }
19852 : }
19853 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
19854 0 : r->in.num_values = PyList_GET_SIZE(py_values_in);
19855 0 : if (py_buffer == NULL) {
19856 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.buffer");
19857 0 : return false;
19858 : }
19859 0 : if (py_buffer == Py_None) {
19860 0 : r->in.buffer = NULL;
19861 : } else {
19862 0 : r->in.buffer = NULL;
19863 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
19864 : {
19865 : int buffer_cntr_1;
19866 0 : r->in.buffer = talloc_array_ptrtype(r, r->in.buffer, PyList_GET_SIZE(py_buffer));
19867 0 : if (!r->in.buffer) { return false; }
19868 0 : talloc_set_name_const(r->in.buffer, "ARRAY: r->in.buffer");
19869 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(py_buffer); buffer_cntr_1++) {
19870 0 : if (PyList_GET_ITEM(py_buffer, buffer_cntr_1) == NULL) {
19871 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.buffer)[buffer_cntr_1]");
19872 0 : return false;
19873 : }
19874 : {
19875 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((r->in.buffer)[buffer_cntr_1]));
19876 0 : if (PyLong_Check(PyList_GET_ITEM(py_buffer, buffer_cntr_1))) {
19877 : unsigned long long test_var;
19878 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_buffer, buffer_cntr_1));
19879 0 : if (PyErr_Occurred() != NULL) {
19880 0 : return false;
19881 : }
19882 0 : if (test_var > uint_max) {
19883 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19884 : PyLong_Type.tp_name, uint_max, test_var);
19885 0 : return false;
19886 : }
19887 0 : (r->in.buffer)[buffer_cntr_1] = test_var;
19888 : } else {
19889 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19890 : PyLong_Type.tp_name);
19891 0 : return false;
19892 : }
19893 : }
19894 : }
19895 : }
19896 : }
19897 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
19898 0 : r->in.buffer_size = talloc_ptrtype(r, r->in.buffer_size);
19899 0 : if (r->in.buffer_size == NULL) {
19900 0 : PyErr_NoMemory();
19901 0 : return false;
19902 : }
19903 0 : *r->in.buffer_size = PyList_GET_SIZE(py_buffer);
19904 0 : return true;
19905 : }
19906 :
19907 0 : static PyObject *unpack_py_winreg_QueryMultipleValues_args_out(struct winreg_QueryMultipleValues *r)
19908 : {
19909 : PyObject *result;
19910 : PyObject *py_values_out;
19911 : PyObject *py_buffer;
19912 0 : result = PyTuple_New(2);
19913 0 : py_values_out = PyList_New(r->in.num_values);
19914 0 : if (py_values_out == NULL) {
19915 0 : return NULL;
19916 : }
19917 : {
19918 : int values_out_cntr_1;
19919 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (r->in.num_values); values_out_cntr_1++) {
19920 : PyObject *py_values_out_1;
19921 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, r->out.values_out, &(r->out.values_out)[values_out_cntr_1]);
19922 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
19923 : }
19924 : }
19925 0 : PyTuple_SetItem(result, 0, py_values_out);
19926 0 : if (r->out.buffer == NULL) {
19927 0 : py_buffer = Py_None;
19928 0 : Py_INCREF(py_buffer);
19929 : } else {
19930 0 : py_buffer = PyList_New(*r->out.buffer_size);
19931 0 : if (py_buffer == NULL) {
19932 0 : return NULL;
19933 : }
19934 : {
19935 : int buffer_cntr_1;
19936 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*r->out.buffer_size); buffer_cntr_1++) {
19937 : PyObject *py_buffer_1;
19938 0 : py_buffer_1 = PyLong_FromLong((uint16_t)((r->out.buffer)[buffer_cntr_1]));
19939 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
19940 : }
19941 : }
19942 : }
19943 0 : PyTuple_SetItem(result, 1, py_buffer);
19944 0 : if (!W_ERROR_IS_OK(r->out.result)) {
19945 0 : PyErr_SetWERROR(r->out.result);
19946 0 : return NULL;
19947 : }
19948 :
19949 0 : return result;
19950 : }
19951 :
19952 :
19953 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_hostname(PyObject *obj, void *closure)
19954 : {
19955 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(obj);
19956 : PyObject *py_hostname;
19957 0 : if (object->in.hostname == NULL) {
19958 0 : Py_RETURN_NONE;
19959 : }
19960 0 : if (object->in.hostname == NULL) {
19961 0 : py_hostname = Py_None;
19962 0 : Py_INCREF(py_hostname);
19963 : } else {
19964 0 : py_hostname = PyLong_FromLong((uint16_t)(*object->in.hostname));
19965 : }
19966 0 : return py_hostname;
19967 : }
19968 :
19969 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_hostname(PyObject *py_obj, PyObject *value, void *closure)
19970 : {
19971 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
19972 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.hostname));
19973 0 : if (value == NULL) {
19974 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.hostname");
19975 0 : return -1;
19976 : }
19977 0 : if (value == Py_None) {
19978 0 : object->in.hostname = NULL;
19979 : } else {
19980 0 : object->in.hostname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.hostname);
19981 0 : if (object->in.hostname == NULL) {
19982 0 : PyErr_NoMemory();
19983 0 : return -1;
19984 : }
19985 : {
19986 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.hostname));
19987 0 : if (PyLong_Check(value)) {
19988 : unsigned long long test_var;
19989 0 : test_var = PyLong_AsUnsignedLongLong(value);
19990 0 : if (PyErr_Occurred() != NULL) {
19991 0 : return -1;
19992 : }
19993 0 : if (test_var > uint_max) {
19994 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19995 : PyLong_Type.tp_name, uint_max, test_var);
19996 0 : return -1;
19997 : }
19998 0 : *object->in.hostname = test_var;
19999 : } else {
20000 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20001 : PyLong_Type.tp_name);
20002 0 : return -1;
20003 : }
20004 : }
20005 : }
20006 0 : return 0;
20007 : }
20008 :
20009 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_message(PyObject *obj, void *closure)
20010 : {
20011 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(obj);
20012 : PyObject *py_message;
20013 0 : if (object->in.message == NULL) {
20014 0 : Py_RETURN_NONE;
20015 : }
20016 0 : if (object->in.message == NULL) {
20017 0 : py_message = Py_None;
20018 0 : Py_INCREF(py_message);
20019 : } else {
20020 0 : py_message = pytalloc_reference_ex(lsa_StringLarge_Type, object->in.message, object->in.message);
20021 : }
20022 0 : return py_message;
20023 : }
20024 :
20025 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_message(PyObject *py_obj, PyObject *value, void *closure)
20026 : {
20027 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20028 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.message));
20029 0 : if (value == NULL) {
20030 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.message");
20031 0 : return -1;
20032 : }
20033 0 : if (value == Py_None) {
20034 0 : object->in.message = NULL;
20035 : } else {
20036 0 : object->in.message = NULL;
20037 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, value, return -1;);
20038 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20039 0 : PyErr_NoMemory();
20040 0 : return -1;
20041 : }
20042 0 : object->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(value);
20043 : }
20044 0 : return 0;
20045 : }
20046 :
20047 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_timeout(PyObject *obj, void *closure)
20048 : {
20049 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(obj);
20050 : PyObject *py_timeout;
20051 0 : py_timeout = PyLong_FromUnsignedLongLong((uint32_t)(object->in.timeout));
20052 0 : return py_timeout;
20053 : }
20054 :
20055 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_timeout(PyObject *py_obj, PyObject *value, void *closure)
20056 : {
20057 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20058 0 : if (value == NULL) {
20059 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.timeout");
20060 0 : return -1;
20061 : }
20062 : {
20063 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.timeout));
20064 0 : if (PyLong_Check(value)) {
20065 : unsigned long long test_var;
20066 0 : test_var = PyLong_AsUnsignedLongLong(value);
20067 0 : if (PyErr_Occurred() != NULL) {
20068 0 : return -1;
20069 : }
20070 0 : if (test_var > uint_max) {
20071 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20072 : PyLong_Type.tp_name, uint_max, test_var);
20073 0 : return -1;
20074 : }
20075 0 : object->in.timeout = test_var;
20076 : } else {
20077 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20078 : PyLong_Type.tp_name);
20079 0 : return -1;
20080 : }
20081 : }
20082 0 : return 0;
20083 : }
20084 :
20085 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_force_apps(PyObject *obj, void *closure)
20086 : {
20087 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(obj);
20088 : PyObject *py_force_apps;
20089 0 : py_force_apps = PyLong_FromLong((uint16_t)(object->in.force_apps));
20090 0 : return py_force_apps;
20091 : }
20092 :
20093 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_force_apps(PyObject *py_obj, PyObject *value, void *closure)
20094 : {
20095 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20096 0 : if (value == NULL) {
20097 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.force_apps");
20098 0 : return -1;
20099 : }
20100 : {
20101 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.force_apps));
20102 0 : if (PyLong_Check(value)) {
20103 : unsigned long long test_var;
20104 0 : test_var = PyLong_AsUnsignedLongLong(value);
20105 0 : if (PyErr_Occurred() != NULL) {
20106 0 : return -1;
20107 : }
20108 0 : if (test_var > uint_max) {
20109 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20110 : PyLong_Type.tp_name, uint_max, test_var);
20111 0 : return -1;
20112 : }
20113 0 : object->in.force_apps = test_var;
20114 : } else {
20115 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20116 : PyLong_Type.tp_name);
20117 0 : return -1;
20118 : }
20119 : }
20120 0 : return 0;
20121 : }
20122 :
20123 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_do_reboot(PyObject *obj, void *closure)
20124 : {
20125 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(obj);
20126 : PyObject *py_do_reboot;
20127 0 : py_do_reboot = PyLong_FromLong((uint16_t)(object->in.do_reboot));
20128 0 : return py_do_reboot;
20129 : }
20130 :
20131 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_do_reboot(PyObject *py_obj, PyObject *value, void *closure)
20132 : {
20133 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20134 0 : if (value == NULL) {
20135 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.do_reboot");
20136 0 : return -1;
20137 : }
20138 : {
20139 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.do_reboot));
20140 0 : if (PyLong_Check(value)) {
20141 : unsigned long long test_var;
20142 0 : test_var = PyLong_AsUnsignedLongLong(value);
20143 0 : if (PyErr_Occurred() != NULL) {
20144 0 : return -1;
20145 : }
20146 0 : if (test_var > uint_max) {
20147 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20148 : PyLong_Type.tp_name, uint_max, test_var);
20149 0 : return -1;
20150 : }
20151 0 : object->in.do_reboot = test_var;
20152 : } else {
20153 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20154 : PyLong_Type.tp_name);
20155 0 : return -1;
20156 : }
20157 : }
20158 0 : return 0;
20159 : }
20160 :
20161 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_reason(PyObject *obj, void *closure)
20162 : {
20163 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(obj);
20164 : PyObject *py_reason;
20165 0 : py_reason = PyLong_FromUnsignedLongLong((uint32_t)(object->in.reason));
20166 0 : return py_reason;
20167 : }
20168 :
20169 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_reason(PyObject *py_obj, PyObject *value, void *closure)
20170 : {
20171 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20172 0 : if (value == NULL) {
20173 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.reason");
20174 0 : return -1;
20175 : }
20176 : {
20177 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.reason));
20178 0 : if (PyLong_Check(value)) {
20179 : unsigned long long test_var;
20180 0 : test_var = PyLong_AsUnsignedLongLong(value);
20181 0 : if (PyErr_Occurred() != NULL) {
20182 0 : return -1;
20183 : }
20184 0 : if (test_var > uint_max) {
20185 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20186 : PyLong_Type.tp_name, uint_max, test_var);
20187 0 : return -1;
20188 : }
20189 0 : object->in.reason = test_var;
20190 : } else {
20191 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20192 : PyLong_Type.tp_name);
20193 0 : return -1;
20194 : }
20195 : }
20196 0 : return 0;
20197 : }
20198 :
20199 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_get_result(PyObject *obj, void *closure)
20200 : {
20201 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(obj);
20202 : PyObject *py_result;
20203 0 : py_result = PyErr_FromWERROR(object->out.result);
20204 0 : return py_result;
20205 : }
20206 :
20207 0 : static int py_winreg_InitiateSystemShutdownEx_set_result(PyObject *py_obj, PyObject *value, void *closure)
20208 : {
20209 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20210 0 : if (value == NULL) {
20211 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
20212 0 : return -1;
20213 : }
20214 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
20215 0 : return 0;
20216 : }
20217 :
20218 : static PyGetSetDef py_winreg_InitiateSystemShutdownEx_getsetters[] = {
20219 : {
20220 : .name = discard_const_p(char, "in_hostname"),
20221 : .get = py_winreg_InitiateSystemShutdownEx_in_get_hostname,
20222 : .set = py_winreg_InitiateSystemShutdownEx_in_set_hostname,
20223 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
20224 : },
20225 : {
20226 : .name = discard_const_p(char, "in_message"),
20227 : .get = py_winreg_InitiateSystemShutdownEx_in_get_message,
20228 : .set = py_winreg_InitiateSystemShutdownEx_in_set_message,
20229 : .doc = discard_const_p(char, "PIDL-generated element of base type lsa_StringLarge")
20230 : },
20231 : {
20232 : .name = discard_const_p(char, "in_timeout"),
20233 : .get = py_winreg_InitiateSystemShutdownEx_in_get_timeout,
20234 : .set = py_winreg_InitiateSystemShutdownEx_in_set_timeout,
20235 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
20236 : },
20237 : {
20238 : .name = discard_const_p(char, "in_force_apps"),
20239 : .get = py_winreg_InitiateSystemShutdownEx_in_get_force_apps,
20240 : .set = py_winreg_InitiateSystemShutdownEx_in_set_force_apps,
20241 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
20242 : },
20243 : {
20244 : .name = discard_const_p(char, "in_do_reboot"),
20245 : .get = py_winreg_InitiateSystemShutdownEx_in_get_do_reboot,
20246 : .set = py_winreg_InitiateSystemShutdownEx_in_set_do_reboot,
20247 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
20248 : },
20249 : {
20250 : .name = discard_const_p(char, "in_reason"),
20251 : .get = py_winreg_InitiateSystemShutdownEx_in_get_reason,
20252 : .set = py_winreg_InitiateSystemShutdownEx_in_set_reason,
20253 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
20254 : },
20255 : {
20256 : .name = discard_const_p(char, "result"),
20257 : .get = py_winreg_InitiateSystemShutdownEx_get_result,
20258 : .set = py_winreg_InitiateSystemShutdownEx_set_result,
20259 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
20260 : },
20261 : { .name = NULL }
20262 : };
20263 :
20264 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
20265 : {
20266 0 : PyObject *self = pytalloc_new(struct winreg_InitiateSystemShutdownEx, type);
20267 0 : return self;
20268 : }
20269 :
20270 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
20271 : {
20272 :
20273 :
20274 0 : return PyLong_FromLong(30);
20275 : }
20276 :
20277 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
20278 : {
20279 0 : const struct ndr_interface_call *call = NULL;
20280 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20281 0 : PyObject *ret = NULL;
20282 0 : struct ndr_push *push = NULL;
20283 : DATA_BLOB blob;
20284 : enum ndr_err_code err;
20285 :
20286 0 : if (ndr_table_winreg.num_calls < 31) {
20287 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdownEx_ndr_pack");
20288 0 : return NULL;
20289 : }
20290 0 : call = &ndr_table_winreg.calls[30];
20291 :
20292 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
20293 0 : if (push == NULL) {
20294 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
20295 0 : return NULL;
20296 : }
20297 :
20298 0 : push->flags |= ndr_push_flags;
20299 :
20300 0 : err = call->ndr_push(push, ndr_inout_flags, object);
20301 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
20302 0 : TALLOC_FREE(push);
20303 0 : PyErr_SetNdrError(err);
20304 0 : return NULL;
20305 : }
20306 0 : blob = ndr_push_blob(push);
20307 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
20308 0 : TALLOC_FREE(push);
20309 0 : return ret;
20310 : }
20311 :
20312 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20313 : {
20314 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20315 0 : PyObject *bigendian_obj = NULL;
20316 0 : PyObject *ndr64_obj = NULL;
20317 0 : libndr_flags ndr_push_flags = 0;
20318 :
20319 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
20320 : discard_const_p(char *, kwnames),
20321 : &bigendian_obj,
20322 : &ndr64_obj)) {
20323 0 : return NULL;
20324 : }
20325 :
20326 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20327 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
20328 : }
20329 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20330 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
20331 : }
20332 :
20333 0 : return py_winreg_InitiateSystemShutdownEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
20334 : }
20335 :
20336 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20337 : {
20338 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20339 0 : PyObject *bigendian_obj = NULL;
20340 0 : PyObject *ndr64_obj = NULL;
20341 0 : libndr_flags ndr_push_flags = 0;
20342 :
20343 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
20344 : discard_const_p(char *, kwnames),
20345 : &bigendian_obj,
20346 : &ndr64_obj)) {
20347 0 : return NULL;
20348 : }
20349 :
20350 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20351 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
20352 : }
20353 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20354 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
20355 : }
20356 :
20357 0 : return py_winreg_InitiateSystemShutdownEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
20358 : }
20359 :
20360 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
20361 : {
20362 0 : const struct ndr_interface_call *call = NULL;
20363 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20364 0 : struct ndr_pull *pull = NULL;
20365 : enum ndr_err_code err;
20366 :
20367 0 : if (ndr_table_winreg.num_calls < 31) {
20368 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdownEx_ndr_unpack");
20369 0 : return NULL;
20370 : }
20371 0 : call = &ndr_table_winreg.calls[30];
20372 :
20373 0 : pull = ndr_pull_init_blob(blob, object);
20374 0 : if (pull == NULL) {
20375 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
20376 0 : return NULL;
20377 : }
20378 :
20379 0 : pull->flags |= ndr_pull_flags;
20380 :
20381 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
20382 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
20383 0 : TALLOC_FREE(pull);
20384 0 : PyErr_SetNdrError(err);
20385 0 : return NULL;
20386 : }
20387 0 : if (!allow_remaining) {
20388 : uint32_t highest_ofs;
20389 :
20390 0 : if (pull->offset > pull->relative_highest_offset) {
20391 0 : highest_ofs = pull->offset;
20392 : } else {
20393 0 : highest_ofs = pull->relative_highest_offset;
20394 : }
20395 0 : if (highest_ofs < pull->data_size) {
20396 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
20397 : "not all bytes consumed ofs[%u] size[%u]",
20398 : highest_ofs, pull->data_size);
20399 0 : TALLOC_FREE(pull);
20400 0 : PyErr_SetNdrError(err);
20401 0 : return NULL;
20402 : }
20403 : }
20404 :
20405 0 : TALLOC_FREE(pull);
20406 0 : Py_RETURN_NONE;
20407 : }
20408 :
20409 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20410 : {
20411 : DATA_BLOB blob;
20412 0 : Py_ssize_t blob_length = 0;
20413 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
20414 0 : PyObject *bigendian_obj = NULL;
20415 0 : PyObject *ndr64_obj = NULL;
20416 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
20417 0 : PyObject *allow_remaining_obj = NULL;
20418 0 : bool allow_remaining = false;
20419 :
20420 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
20421 : discard_const_p(char *, kwnames),
20422 : &blob.data, &blob_length,
20423 : &bigendian_obj,
20424 : &ndr64_obj,
20425 : &allow_remaining_obj)) {
20426 0 : return NULL;
20427 : }
20428 0 : blob.length = blob_length;
20429 :
20430 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20431 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
20432 : }
20433 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20434 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
20435 : }
20436 :
20437 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
20438 0 : allow_remaining = true;
20439 : }
20440 :
20441 0 : return py_winreg_InitiateSystemShutdownEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
20442 : }
20443 :
20444 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20445 : {
20446 : DATA_BLOB blob;
20447 0 : Py_ssize_t blob_length = 0;
20448 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
20449 0 : PyObject *bigendian_obj = NULL;
20450 0 : PyObject *ndr64_obj = NULL;
20451 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
20452 0 : PyObject *allow_remaining_obj = NULL;
20453 0 : bool allow_remaining = false;
20454 :
20455 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
20456 : discard_const_p(char *, kwnames),
20457 : &blob.data, &blob_length,
20458 : &bigendian_obj,
20459 : &ndr64_obj,
20460 : &allow_remaining_obj)) {
20461 0 : return NULL;
20462 : }
20463 0 : blob.length = blob_length;
20464 :
20465 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20466 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
20467 : }
20468 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20469 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
20470 : }
20471 :
20472 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
20473 0 : allow_remaining = true;
20474 : }
20475 :
20476 0 : return py_winreg_InitiateSystemShutdownEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
20477 : }
20478 :
20479 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
20480 : {
20481 0 : const struct ndr_interface_call *call = NULL;
20482 0 : struct winreg_InitiateSystemShutdownEx *object = pytalloc_get_ptr(py_obj);
20483 : PyObject *ret;
20484 : char *retstr;
20485 :
20486 0 : if (ndr_table_winreg.num_calls < 31) {
20487 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdownEx_ndr_print");
20488 0 : return NULL;
20489 : }
20490 0 : call = &ndr_table_winreg.calls[30];
20491 :
20492 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
20493 0 : ret = PyUnicode_FromString(retstr);
20494 0 : TALLOC_FREE(retstr);
20495 :
20496 0 : return ret;
20497 : }
20498 :
20499 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
20500 : {
20501 0 : return py_winreg_InitiateSystemShutdownEx_ndr_print(py_obj, "winreg_InitiateSystemShutdownEx_in", NDR_IN);
20502 : }
20503 :
20504 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
20505 : {
20506 0 : return py_winreg_InitiateSystemShutdownEx_ndr_print(py_obj, "winreg_InitiateSystemShutdownEx_out", NDR_OUT);
20507 : }
20508 :
20509 : static PyMethodDef py_winreg_InitiateSystemShutdownEx_methods[] = {
20510 : { "opnum", (PyCFunction)py_winreg_InitiateSystemShutdownEx_ndr_opnum, METH_NOARGS|METH_CLASS,
20511 : "winreg.InitiateSystemShutdownEx.opnum() -> 30 (0x1e) " },
20512 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
20513 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
20514 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
20515 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
20516 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
20517 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
20518 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
20519 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
20520 : { "__ndr_print_in__", (PyCFunction)py_winreg_InitiateSystemShutdownEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
20521 : { "__ndr_print_out__", (PyCFunction)py_winreg_InitiateSystemShutdownEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
20522 : { NULL, NULL, 0, NULL }
20523 : };
20524 :
20525 :
20526 : static PyTypeObject winreg_InitiateSystemShutdownEx_Type = {
20527 : PyVarObject_HEAD_INIT(NULL, 0)
20528 : .tp_name = "winreg.InitiateSystemShutdownEx",
20529 : .tp_getset = py_winreg_InitiateSystemShutdownEx_getsetters,
20530 : .tp_methods = py_winreg_InitiateSystemShutdownEx_methods,
20531 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
20532 : .tp_new = py_winreg_InitiateSystemShutdownEx_new,
20533 : };
20534 :
20535 0 : static bool pack_py_winreg_InitiateSystemShutdownEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_InitiateSystemShutdownEx *r)
20536 : {
20537 : PyObject *py_hostname;
20538 : PyObject *py_message;
20539 : PyObject *py_timeout;
20540 : PyObject *py_force_apps;
20541 : PyObject *py_do_reboot;
20542 : PyObject *py_reason;
20543 0 : const char *kwnames[] = {
20544 : "hostname", "message", "timeout", "force_apps", "do_reboot", "reason", NULL
20545 : };
20546 :
20547 0 : 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)) {
20548 0 : return false;
20549 : }
20550 :
20551 0 : if (py_hostname == NULL) {
20552 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.hostname");
20553 0 : return false;
20554 : }
20555 0 : if (py_hostname == Py_None) {
20556 0 : r->in.hostname = NULL;
20557 : } else {
20558 0 : r->in.hostname = talloc_ptrtype(r, r->in.hostname);
20559 0 : if (r->in.hostname == NULL) {
20560 0 : PyErr_NoMemory();
20561 0 : return false;
20562 : }
20563 : {
20564 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.hostname));
20565 0 : if (PyLong_Check(py_hostname)) {
20566 : unsigned long long test_var;
20567 0 : test_var = PyLong_AsUnsignedLongLong(py_hostname);
20568 0 : if (PyErr_Occurred() != NULL) {
20569 0 : return false;
20570 : }
20571 0 : if (test_var > uint_max) {
20572 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20573 : PyLong_Type.tp_name, uint_max, test_var);
20574 0 : return false;
20575 : }
20576 0 : *r->in.hostname = test_var;
20577 : } else {
20578 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20579 : PyLong_Type.tp_name);
20580 0 : return false;
20581 : }
20582 : }
20583 : }
20584 0 : if (py_message == NULL) {
20585 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.message");
20586 0 : return false;
20587 : }
20588 0 : if (py_message == Py_None) {
20589 0 : r->in.message = NULL;
20590 : } else {
20591 0 : r->in.message = NULL;
20592 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
20593 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_message)) == NULL) {
20594 0 : PyErr_NoMemory();
20595 0 : return false;
20596 : }
20597 0 : r->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(py_message);
20598 : }
20599 0 : if (py_timeout == NULL) {
20600 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.timeout");
20601 0 : return false;
20602 : }
20603 : {
20604 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.timeout));
20605 0 : if (PyLong_Check(py_timeout)) {
20606 : unsigned long long test_var;
20607 0 : test_var = PyLong_AsUnsignedLongLong(py_timeout);
20608 0 : if (PyErr_Occurred() != NULL) {
20609 0 : return false;
20610 : }
20611 0 : if (test_var > uint_max) {
20612 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20613 : PyLong_Type.tp_name, uint_max, test_var);
20614 0 : return false;
20615 : }
20616 0 : r->in.timeout = test_var;
20617 : } else {
20618 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20619 : PyLong_Type.tp_name);
20620 0 : return false;
20621 : }
20622 : }
20623 0 : if (py_force_apps == NULL) {
20624 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.force_apps");
20625 0 : return false;
20626 : }
20627 : {
20628 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.force_apps));
20629 0 : if (PyLong_Check(py_force_apps)) {
20630 : unsigned long long test_var;
20631 0 : test_var = PyLong_AsUnsignedLongLong(py_force_apps);
20632 0 : if (PyErr_Occurred() != NULL) {
20633 0 : return false;
20634 : }
20635 0 : if (test_var > uint_max) {
20636 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20637 : PyLong_Type.tp_name, uint_max, test_var);
20638 0 : return false;
20639 : }
20640 0 : r->in.force_apps = test_var;
20641 : } else {
20642 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20643 : PyLong_Type.tp_name);
20644 0 : return false;
20645 : }
20646 : }
20647 0 : if (py_do_reboot == NULL) {
20648 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.do_reboot");
20649 0 : return false;
20650 : }
20651 : {
20652 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.do_reboot));
20653 0 : if (PyLong_Check(py_do_reboot)) {
20654 : unsigned long long test_var;
20655 0 : test_var = PyLong_AsUnsignedLongLong(py_do_reboot);
20656 0 : if (PyErr_Occurred() != NULL) {
20657 0 : return false;
20658 : }
20659 0 : if (test_var > uint_max) {
20660 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20661 : PyLong_Type.tp_name, uint_max, test_var);
20662 0 : return false;
20663 : }
20664 0 : r->in.do_reboot = test_var;
20665 : } else {
20666 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20667 : PyLong_Type.tp_name);
20668 0 : return false;
20669 : }
20670 : }
20671 0 : if (py_reason == NULL) {
20672 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.reason");
20673 0 : return false;
20674 : }
20675 : {
20676 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.reason));
20677 0 : if (PyLong_Check(py_reason)) {
20678 : unsigned long long test_var;
20679 0 : test_var = PyLong_AsUnsignedLongLong(py_reason);
20680 0 : if (PyErr_Occurred() != NULL) {
20681 0 : return false;
20682 : }
20683 0 : if (test_var > uint_max) {
20684 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20685 : PyLong_Type.tp_name, uint_max, test_var);
20686 0 : return false;
20687 : }
20688 0 : r->in.reason = test_var;
20689 : } else {
20690 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20691 : PyLong_Type.tp_name);
20692 0 : return false;
20693 : }
20694 : }
20695 0 : return true;
20696 : }
20697 :
20698 0 : static PyObject *unpack_py_winreg_InitiateSystemShutdownEx_args_out(struct winreg_InitiateSystemShutdownEx *r)
20699 : {
20700 : PyObject *result;
20701 0 : result = Py_None;
20702 0 : Py_INCREF(result);
20703 0 : if (!W_ERROR_IS_OK(r->out.result)) {
20704 0 : PyErr_SetWERROR(r->out.result);
20705 0 : return NULL;
20706 : }
20707 :
20708 0 : return result;
20709 : }
20710 :
20711 :
20712 0 : static PyObject *py_winreg_SaveKeyEx_in_get_handle(PyObject *obj, void *closure)
20713 : {
20714 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(obj);
20715 : PyObject *py_handle;
20716 0 : if (object->in.handle == NULL) {
20717 0 : Py_RETURN_NONE;
20718 : }
20719 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
20720 0 : return py_handle;
20721 : }
20722 :
20723 0 : static int py_winreg_SaveKeyEx_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
20724 : {
20725 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
20726 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
20727 0 : if (value == NULL) {
20728 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
20729 0 : return -1;
20730 : }
20731 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
20732 0 : if (object->in.handle == NULL) {
20733 0 : PyErr_NoMemory();
20734 0 : return -1;
20735 : }
20736 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
20737 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20738 0 : PyErr_NoMemory();
20739 0 : return -1;
20740 : }
20741 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
20742 0 : return 0;
20743 : }
20744 :
20745 0 : static PyObject *py_winreg_SaveKeyEx_in_get_filename(PyObject *obj, void *closure)
20746 : {
20747 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(obj);
20748 : PyObject *py_filename;
20749 0 : if (object->in.filename == NULL) {
20750 0 : Py_RETURN_NONE;
20751 : }
20752 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
20753 0 : return py_filename;
20754 : }
20755 :
20756 0 : static int py_winreg_SaveKeyEx_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
20757 : {
20758 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
20759 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
20760 0 : if (value == NULL) {
20761 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.filename");
20762 0 : return -1;
20763 : }
20764 0 : object->in.filename = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.filename);
20765 0 : if (object->in.filename == NULL) {
20766 0 : PyErr_NoMemory();
20767 0 : return -1;
20768 : }
20769 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
20770 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20771 0 : PyErr_NoMemory();
20772 0 : return -1;
20773 : }
20774 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
20775 0 : return 0;
20776 : }
20777 :
20778 0 : static PyObject *py_winreg_SaveKeyEx_in_get_sec_attrib(PyObject *obj, void *closure)
20779 : {
20780 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(obj);
20781 : PyObject *py_sec_attrib;
20782 0 : if (object->in.sec_attrib == NULL) {
20783 0 : Py_RETURN_NONE;
20784 : }
20785 0 : if (object->in.sec_attrib == NULL) {
20786 0 : py_sec_attrib = Py_None;
20787 0 : Py_INCREF(py_sec_attrib);
20788 : } else {
20789 0 : py_sec_attrib = pytalloc_reference_ex(&KeySecurityAttribute_Type, object->in.sec_attrib, object->in.sec_attrib);
20790 : }
20791 0 : return py_sec_attrib;
20792 : }
20793 :
20794 0 : static int py_winreg_SaveKeyEx_in_set_sec_attrib(PyObject *py_obj, PyObject *value, void *closure)
20795 : {
20796 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
20797 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sec_attrib));
20798 0 : if (value == NULL) {
20799 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.sec_attrib");
20800 0 : return -1;
20801 : }
20802 0 : if (value == Py_None) {
20803 0 : object->in.sec_attrib = NULL;
20804 : } else {
20805 0 : object->in.sec_attrib = NULL;
20806 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, value, return -1;);
20807 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20808 0 : PyErr_NoMemory();
20809 0 : return -1;
20810 : }
20811 0 : object->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(value);
20812 : }
20813 0 : return 0;
20814 : }
20815 :
20816 0 : static PyObject *py_winreg_SaveKeyEx_in_get_flags(PyObject *obj, void *closure)
20817 : {
20818 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(obj);
20819 : PyObject *py_flags;
20820 0 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->in.flags));
20821 0 : return py_flags;
20822 : }
20823 :
20824 0 : static int py_winreg_SaveKeyEx_in_set_flags(PyObject *py_obj, PyObject *value, void *closure)
20825 : {
20826 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
20827 0 : if (value == NULL) {
20828 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.flags");
20829 0 : return -1;
20830 : }
20831 : {
20832 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags));
20833 0 : if (PyLong_Check(value)) {
20834 : unsigned long long test_var;
20835 0 : test_var = PyLong_AsUnsignedLongLong(value);
20836 0 : if (PyErr_Occurred() != NULL) {
20837 0 : return -1;
20838 : }
20839 0 : if (test_var > uint_max) {
20840 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20841 : PyLong_Type.tp_name, uint_max, test_var);
20842 0 : return -1;
20843 : }
20844 0 : object->in.flags = test_var;
20845 : } else {
20846 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20847 : PyLong_Type.tp_name);
20848 0 : return -1;
20849 : }
20850 : }
20851 0 : return 0;
20852 : }
20853 :
20854 0 : static PyObject *py_winreg_SaveKeyEx_get_result(PyObject *obj, void *closure)
20855 : {
20856 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(obj);
20857 : PyObject *py_result;
20858 0 : py_result = PyErr_FromWERROR(object->out.result);
20859 0 : return py_result;
20860 : }
20861 :
20862 0 : static int py_winreg_SaveKeyEx_set_result(PyObject *py_obj, PyObject *value, void *closure)
20863 : {
20864 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
20865 0 : if (value == NULL) {
20866 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
20867 0 : return -1;
20868 : }
20869 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
20870 0 : return 0;
20871 : }
20872 :
20873 : static PyGetSetDef py_winreg_SaveKeyEx_getsetters[] = {
20874 : {
20875 : .name = discard_const_p(char, "in_handle"),
20876 : .get = py_winreg_SaveKeyEx_in_get_handle,
20877 : .set = py_winreg_SaveKeyEx_in_set_handle,
20878 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
20879 : },
20880 : {
20881 : .name = discard_const_p(char, "in_filename"),
20882 : .get = py_winreg_SaveKeyEx_in_get_filename,
20883 : .set = py_winreg_SaveKeyEx_in_set_filename,
20884 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
20885 : },
20886 : {
20887 : .name = discard_const_p(char, "in_sec_attrib"),
20888 : .get = py_winreg_SaveKeyEx_in_get_sec_attrib,
20889 : .set = py_winreg_SaveKeyEx_in_set_sec_attrib,
20890 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityAttribute")
20891 : },
20892 : {
20893 : .name = discard_const_p(char, "in_flags"),
20894 : .get = py_winreg_SaveKeyEx_in_get_flags,
20895 : .set = py_winreg_SaveKeyEx_in_set_flags,
20896 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
20897 : },
20898 : {
20899 : .name = discard_const_p(char, "result"),
20900 : .get = py_winreg_SaveKeyEx_get_result,
20901 : .set = py_winreg_SaveKeyEx_set_result,
20902 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
20903 : },
20904 : { .name = NULL }
20905 : };
20906 :
20907 0 : static PyObject *py_winreg_SaveKeyEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
20908 : {
20909 0 : PyObject *self = pytalloc_new(struct winreg_SaveKeyEx, type);
20910 0 : struct winreg_SaveKeyEx *_self = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(self);
20911 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
20912 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
20913 0 : _self->in.filename = talloc_zero(mem_ctx, struct winreg_String);
20914 0 : return self;
20915 : }
20916 :
20917 0 : static PyObject *py_winreg_SaveKeyEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
20918 : {
20919 :
20920 :
20921 0 : return PyLong_FromLong(31);
20922 : }
20923 :
20924 0 : static PyObject *py_winreg_SaveKeyEx_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
20925 : {
20926 0 : const struct ndr_interface_call *call = NULL;
20927 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
20928 0 : PyObject *ret = NULL;
20929 0 : struct ndr_push *push = NULL;
20930 : DATA_BLOB blob;
20931 : enum ndr_err_code err;
20932 :
20933 0 : if (ndr_table_winreg.num_calls < 32) {
20934 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKeyEx_ndr_pack");
20935 0 : return NULL;
20936 : }
20937 0 : call = &ndr_table_winreg.calls[31];
20938 :
20939 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
20940 0 : if (push == NULL) {
20941 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
20942 0 : return NULL;
20943 : }
20944 :
20945 0 : push->flags |= ndr_push_flags;
20946 :
20947 0 : err = call->ndr_push(push, ndr_inout_flags, object);
20948 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
20949 0 : TALLOC_FREE(push);
20950 0 : PyErr_SetNdrError(err);
20951 0 : return NULL;
20952 : }
20953 0 : blob = ndr_push_blob(push);
20954 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
20955 0 : TALLOC_FREE(push);
20956 0 : return ret;
20957 : }
20958 :
20959 0 : static PyObject *py_winreg_SaveKeyEx_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20960 : {
20961 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20962 0 : PyObject *bigendian_obj = NULL;
20963 0 : PyObject *ndr64_obj = NULL;
20964 0 : libndr_flags ndr_push_flags = 0;
20965 :
20966 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
20967 : discard_const_p(char *, kwnames),
20968 : &bigendian_obj,
20969 : &ndr64_obj)) {
20970 0 : return NULL;
20971 : }
20972 :
20973 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20974 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
20975 : }
20976 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20977 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
20978 : }
20979 :
20980 0 : return py_winreg_SaveKeyEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
20981 : }
20982 :
20983 0 : static PyObject *py_winreg_SaveKeyEx_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20984 : {
20985 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20986 0 : PyObject *bigendian_obj = NULL;
20987 0 : PyObject *ndr64_obj = NULL;
20988 0 : libndr_flags ndr_push_flags = 0;
20989 :
20990 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
20991 : discard_const_p(char *, kwnames),
20992 : &bigendian_obj,
20993 : &ndr64_obj)) {
20994 0 : return NULL;
20995 : }
20996 :
20997 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20998 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
20999 : }
21000 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21001 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
21002 : }
21003 :
21004 0 : return py_winreg_SaveKeyEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
21005 : }
21006 :
21007 0 : static PyObject *py_winreg_SaveKeyEx_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
21008 : {
21009 0 : const struct ndr_interface_call *call = NULL;
21010 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
21011 0 : struct ndr_pull *pull = NULL;
21012 : enum ndr_err_code err;
21013 :
21014 0 : if (ndr_table_winreg.num_calls < 32) {
21015 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKeyEx_ndr_unpack");
21016 0 : return NULL;
21017 : }
21018 0 : call = &ndr_table_winreg.calls[31];
21019 :
21020 0 : pull = ndr_pull_init_blob(blob, object);
21021 0 : if (pull == NULL) {
21022 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
21023 0 : return NULL;
21024 : }
21025 :
21026 0 : pull->flags |= ndr_pull_flags;
21027 :
21028 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
21029 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
21030 0 : TALLOC_FREE(pull);
21031 0 : PyErr_SetNdrError(err);
21032 0 : return NULL;
21033 : }
21034 0 : if (!allow_remaining) {
21035 : uint32_t highest_ofs;
21036 :
21037 0 : if (pull->offset > pull->relative_highest_offset) {
21038 0 : highest_ofs = pull->offset;
21039 : } else {
21040 0 : highest_ofs = pull->relative_highest_offset;
21041 : }
21042 0 : if (highest_ofs < pull->data_size) {
21043 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
21044 : "not all bytes consumed ofs[%u] size[%u]",
21045 : highest_ofs, pull->data_size);
21046 0 : TALLOC_FREE(pull);
21047 0 : PyErr_SetNdrError(err);
21048 0 : return NULL;
21049 : }
21050 : }
21051 :
21052 0 : TALLOC_FREE(pull);
21053 0 : Py_RETURN_NONE;
21054 : }
21055 :
21056 0 : static PyObject *py_winreg_SaveKeyEx_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21057 : {
21058 : DATA_BLOB blob;
21059 0 : Py_ssize_t blob_length = 0;
21060 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21061 0 : PyObject *bigendian_obj = NULL;
21062 0 : PyObject *ndr64_obj = NULL;
21063 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21064 0 : PyObject *allow_remaining_obj = NULL;
21065 0 : bool allow_remaining = false;
21066 :
21067 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
21068 : discard_const_p(char *, kwnames),
21069 : &blob.data, &blob_length,
21070 : &bigendian_obj,
21071 : &ndr64_obj,
21072 : &allow_remaining_obj)) {
21073 0 : return NULL;
21074 : }
21075 0 : blob.length = blob_length;
21076 :
21077 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21078 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21079 : }
21080 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21081 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21082 : }
21083 :
21084 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21085 0 : allow_remaining = true;
21086 : }
21087 :
21088 0 : return py_winreg_SaveKeyEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
21089 : }
21090 :
21091 0 : static PyObject *py_winreg_SaveKeyEx_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21092 : {
21093 : DATA_BLOB blob;
21094 0 : Py_ssize_t blob_length = 0;
21095 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21096 0 : PyObject *bigendian_obj = NULL;
21097 0 : PyObject *ndr64_obj = NULL;
21098 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21099 0 : PyObject *allow_remaining_obj = NULL;
21100 0 : bool allow_remaining = false;
21101 :
21102 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
21103 : discard_const_p(char *, kwnames),
21104 : &blob.data, &blob_length,
21105 : &bigendian_obj,
21106 : &ndr64_obj,
21107 : &allow_remaining_obj)) {
21108 0 : return NULL;
21109 : }
21110 0 : blob.length = blob_length;
21111 :
21112 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21113 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21114 : }
21115 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21116 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21117 : }
21118 :
21119 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21120 0 : allow_remaining = true;
21121 : }
21122 :
21123 0 : return py_winreg_SaveKeyEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
21124 : }
21125 :
21126 0 : static PyObject *py_winreg_SaveKeyEx_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
21127 : {
21128 0 : const struct ndr_interface_call *call = NULL;
21129 0 : struct winreg_SaveKeyEx *object = pytalloc_get_ptr(py_obj);
21130 : PyObject *ret;
21131 : char *retstr;
21132 :
21133 0 : if (ndr_table_winreg.num_calls < 32) {
21134 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKeyEx_ndr_print");
21135 0 : return NULL;
21136 : }
21137 0 : call = &ndr_table_winreg.calls[31];
21138 :
21139 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
21140 0 : ret = PyUnicode_FromString(retstr);
21141 0 : TALLOC_FREE(retstr);
21142 :
21143 0 : return ret;
21144 : }
21145 :
21146 0 : static PyObject *py_winreg_SaveKeyEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21147 : {
21148 0 : return py_winreg_SaveKeyEx_ndr_print(py_obj, "winreg_SaveKeyEx_in", NDR_IN);
21149 : }
21150 :
21151 0 : static PyObject *py_winreg_SaveKeyEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21152 : {
21153 0 : return py_winreg_SaveKeyEx_ndr_print(py_obj, "winreg_SaveKeyEx_out", NDR_OUT);
21154 : }
21155 :
21156 : static PyMethodDef py_winreg_SaveKeyEx_methods[] = {
21157 : { "opnum", (PyCFunction)py_winreg_SaveKeyEx_ndr_opnum, METH_NOARGS|METH_CLASS,
21158 : "winreg.SaveKeyEx.opnum() -> 31 (0x1f) " },
21159 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
21160 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
21161 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
21162 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
21163 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
21164 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
21165 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
21166 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
21167 : { "__ndr_print_in__", (PyCFunction)py_winreg_SaveKeyEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
21168 : { "__ndr_print_out__", (PyCFunction)py_winreg_SaveKeyEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
21169 : { NULL, NULL, 0, NULL }
21170 : };
21171 :
21172 :
21173 : static PyTypeObject winreg_SaveKeyEx_Type = {
21174 : PyVarObject_HEAD_INIT(NULL, 0)
21175 : .tp_name = "winreg.SaveKeyEx",
21176 : .tp_getset = py_winreg_SaveKeyEx_getsetters,
21177 : .tp_methods = py_winreg_SaveKeyEx_methods,
21178 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
21179 : .tp_new = py_winreg_SaveKeyEx_new,
21180 : };
21181 :
21182 0 : static bool pack_py_winreg_SaveKeyEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_SaveKeyEx *r)
21183 : {
21184 : PyObject *py_handle;
21185 : PyObject *py_filename;
21186 : PyObject *py_sec_attrib;
21187 : PyObject *py_flags;
21188 0 : const char *kwnames[] = {
21189 : "handle", "filename", "sec_attrib", "flags", NULL
21190 : };
21191 :
21192 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_SaveKeyEx", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_sec_attrib, &py_flags)) {
21193 0 : return false;
21194 : }
21195 :
21196 0 : if (py_handle == NULL) {
21197 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
21198 0 : return false;
21199 : }
21200 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
21201 0 : if (r->in.handle == NULL) {
21202 0 : PyErr_NoMemory();
21203 0 : return false;
21204 : }
21205 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
21206 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
21207 0 : PyErr_NoMemory();
21208 0 : return false;
21209 : }
21210 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
21211 0 : if (py_filename == NULL) {
21212 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.filename");
21213 0 : return false;
21214 : }
21215 0 : r->in.filename = talloc_ptrtype(r, r->in.filename);
21216 0 : if (r->in.filename == NULL) {
21217 0 : PyErr_NoMemory();
21218 0 : return false;
21219 : }
21220 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
21221 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
21222 0 : PyErr_NoMemory();
21223 0 : return false;
21224 : }
21225 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
21226 0 : if (py_sec_attrib == NULL) {
21227 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.sec_attrib");
21228 0 : return false;
21229 : }
21230 0 : if (py_sec_attrib == Py_None) {
21231 0 : r->in.sec_attrib = NULL;
21232 : } else {
21233 0 : r->in.sec_attrib = NULL;
21234 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, py_sec_attrib, return false;);
21235 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sec_attrib)) == NULL) {
21236 0 : PyErr_NoMemory();
21237 0 : return false;
21238 : }
21239 0 : r->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(py_sec_attrib);
21240 : }
21241 0 : if (py_flags == NULL) {
21242 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.flags");
21243 0 : return false;
21244 : }
21245 : {
21246 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags));
21247 0 : if (PyLong_Check(py_flags)) {
21248 : unsigned long long test_var;
21249 0 : test_var = PyLong_AsUnsignedLongLong(py_flags);
21250 0 : if (PyErr_Occurred() != NULL) {
21251 0 : return false;
21252 : }
21253 0 : if (test_var > uint_max) {
21254 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21255 : PyLong_Type.tp_name, uint_max, test_var);
21256 0 : return false;
21257 : }
21258 0 : r->in.flags = test_var;
21259 : } else {
21260 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21261 : PyLong_Type.tp_name);
21262 0 : return false;
21263 : }
21264 : }
21265 0 : return true;
21266 : }
21267 :
21268 0 : static PyObject *unpack_py_winreg_SaveKeyEx_args_out(struct winreg_SaveKeyEx *r)
21269 : {
21270 : PyObject *result;
21271 0 : result = Py_None;
21272 0 : Py_INCREF(result);
21273 0 : if (!W_ERROR_IS_OK(r->out.result)) {
21274 0 : PyErr_SetWERROR(r->out.result);
21275 0 : return NULL;
21276 : }
21277 :
21278 0 : return result;
21279 : }
21280 :
21281 :
21282 0 : static PyObject *py_winreg_OpenHKPT_in_get_system_name(PyObject *obj, void *closure)
21283 : {
21284 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(obj);
21285 : PyObject *py_system_name;
21286 0 : if (object->in.system_name == NULL) {
21287 0 : Py_RETURN_NONE;
21288 : }
21289 0 : if (object->in.system_name == NULL) {
21290 0 : py_system_name = Py_None;
21291 0 : Py_INCREF(py_system_name);
21292 : } else {
21293 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
21294 : }
21295 0 : return py_system_name;
21296 : }
21297 :
21298 0 : static int py_winreg_OpenHKPT_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
21299 : {
21300 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(py_obj);
21301 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
21302 0 : if (value == NULL) {
21303 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
21304 0 : return -1;
21305 : }
21306 0 : if (value == Py_None) {
21307 0 : object->in.system_name = NULL;
21308 : } else {
21309 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
21310 0 : if (object->in.system_name == NULL) {
21311 0 : PyErr_NoMemory();
21312 0 : return -1;
21313 : }
21314 : {
21315 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
21316 0 : if (PyLong_Check(value)) {
21317 : unsigned long long test_var;
21318 0 : test_var = PyLong_AsUnsignedLongLong(value);
21319 0 : if (PyErr_Occurred() != NULL) {
21320 0 : return -1;
21321 : }
21322 0 : if (test_var > uint_max) {
21323 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21324 : PyLong_Type.tp_name, uint_max, test_var);
21325 0 : return -1;
21326 : }
21327 0 : *object->in.system_name = test_var;
21328 : } else {
21329 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21330 : PyLong_Type.tp_name);
21331 0 : return -1;
21332 : }
21333 : }
21334 : }
21335 0 : return 0;
21336 : }
21337 :
21338 0 : static PyObject *py_winreg_OpenHKPT_in_get_access_mask(PyObject *obj, void *closure)
21339 : {
21340 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(obj);
21341 : PyObject *py_access_mask;
21342 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
21343 0 : return py_access_mask;
21344 : }
21345 :
21346 0 : static int py_winreg_OpenHKPT_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
21347 : {
21348 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(py_obj);
21349 0 : if (value == NULL) {
21350 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
21351 0 : return -1;
21352 : }
21353 : {
21354 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
21355 0 : if (PyLong_Check(value)) {
21356 : unsigned long long test_var;
21357 0 : test_var = PyLong_AsUnsignedLongLong(value);
21358 0 : if (PyErr_Occurred() != NULL) {
21359 0 : return -1;
21360 : }
21361 0 : if (test_var > uint_max) {
21362 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21363 : PyLong_Type.tp_name, uint_max, test_var);
21364 0 : return -1;
21365 : }
21366 0 : object->in.access_mask = test_var;
21367 : } else {
21368 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21369 : PyLong_Type.tp_name);
21370 0 : return -1;
21371 : }
21372 : }
21373 0 : return 0;
21374 : }
21375 :
21376 0 : static PyObject *py_winreg_OpenHKPT_out_get_handle(PyObject *obj, void *closure)
21377 : {
21378 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(obj);
21379 : PyObject *py_handle;
21380 0 : if (object->out.handle == NULL) {
21381 0 : Py_RETURN_NONE;
21382 : }
21383 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
21384 0 : return py_handle;
21385 : }
21386 :
21387 0 : static int py_winreg_OpenHKPT_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
21388 : {
21389 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(py_obj);
21390 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
21391 0 : if (value == NULL) {
21392 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
21393 0 : return -1;
21394 : }
21395 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
21396 0 : if (object->out.handle == NULL) {
21397 0 : PyErr_NoMemory();
21398 0 : return -1;
21399 : }
21400 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
21401 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
21402 0 : PyErr_NoMemory();
21403 0 : return -1;
21404 : }
21405 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
21406 0 : return 0;
21407 : }
21408 :
21409 0 : static PyObject *py_winreg_OpenHKPT_get_result(PyObject *obj, void *closure)
21410 : {
21411 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(obj);
21412 : PyObject *py_result;
21413 0 : py_result = PyErr_FromWERROR(object->out.result);
21414 0 : return py_result;
21415 : }
21416 :
21417 0 : static int py_winreg_OpenHKPT_set_result(PyObject *py_obj, PyObject *value, void *closure)
21418 : {
21419 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(py_obj);
21420 0 : if (value == NULL) {
21421 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
21422 0 : return -1;
21423 : }
21424 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
21425 0 : return 0;
21426 : }
21427 :
21428 : static PyGetSetDef py_winreg_OpenHKPT_getsetters[] = {
21429 : {
21430 : .name = discard_const_p(char, "in_system_name"),
21431 : .get = py_winreg_OpenHKPT_in_get_system_name,
21432 : .set = py_winreg_OpenHKPT_in_set_system_name,
21433 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
21434 : },
21435 : {
21436 : .name = discard_const_p(char, "in_access_mask"),
21437 : .get = py_winreg_OpenHKPT_in_get_access_mask,
21438 : .set = py_winreg_OpenHKPT_in_set_access_mask,
21439 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
21440 : },
21441 : {
21442 : .name = discard_const_p(char, "out_handle"),
21443 : .get = py_winreg_OpenHKPT_out_get_handle,
21444 : .set = py_winreg_OpenHKPT_out_set_handle,
21445 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
21446 : },
21447 : {
21448 : .name = discard_const_p(char, "result"),
21449 : .get = py_winreg_OpenHKPT_get_result,
21450 : .set = py_winreg_OpenHKPT_set_result,
21451 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
21452 : },
21453 : { .name = NULL }
21454 : };
21455 :
21456 0 : static PyObject *py_winreg_OpenHKPT_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
21457 : {
21458 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKPT, type);
21459 0 : struct winreg_OpenHKPT *_self = (struct winreg_OpenHKPT *)pytalloc_get_ptr(self);
21460 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
21461 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
21462 0 : return self;
21463 : }
21464 :
21465 0 : static PyObject *py_winreg_OpenHKPT_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
21466 : {
21467 :
21468 :
21469 0 : return PyLong_FromLong(32);
21470 : }
21471 :
21472 0 : static PyObject *py_winreg_OpenHKPT_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
21473 : {
21474 0 : const struct ndr_interface_call *call = NULL;
21475 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(py_obj);
21476 0 : PyObject *ret = NULL;
21477 0 : struct ndr_push *push = NULL;
21478 : DATA_BLOB blob;
21479 : enum ndr_err_code err;
21480 :
21481 0 : if (ndr_table_winreg.num_calls < 33) {
21482 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPT_ndr_pack");
21483 0 : return NULL;
21484 : }
21485 0 : call = &ndr_table_winreg.calls[32];
21486 :
21487 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
21488 0 : if (push == NULL) {
21489 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
21490 0 : return NULL;
21491 : }
21492 :
21493 0 : push->flags |= ndr_push_flags;
21494 :
21495 0 : err = call->ndr_push(push, ndr_inout_flags, object);
21496 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
21497 0 : TALLOC_FREE(push);
21498 0 : PyErr_SetNdrError(err);
21499 0 : return NULL;
21500 : }
21501 0 : blob = ndr_push_blob(push);
21502 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
21503 0 : TALLOC_FREE(push);
21504 0 : return ret;
21505 : }
21506 :
21507 0 : static PyObject *py_winreg_OpenHKPT_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21508 : {
21509 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
21510 0 : PyObject *bigendian_obj = NULL;
21511 0 : PyObject *ndr64_obj = NULL;
21512 0 : libndr_flags ndr_push_flags = 0;
21513 :
21514 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
21515 : discard_const_p(char *, kwnames),
21516 : &bigendian_obj,
21517 : &ndr64_obj)) {
21518 0 : return NULL;
21519 : }
21520 :
21521 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21522 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
21523 : }
21524 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21525 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
21526 : }
21527 :
21528 0 : return py_winreg_OpenHKPT_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
21529 : }
21530 :
21531 0 : static PyObject *py_winreg_OpenHKPT_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21532 : {
21533 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
21534 0 : PyObject *bigendian_obj = NULL;
21535 0 : PyObject *ndr64_obj = NULL;
21536 0 : libndr_flags ndr_push_flags = 0;
21537 :
21538 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
21539 : discard_const_p(char *, kwnames),
21540 : &bigendian_obj,
21541 : &ndr64_obj)) {
21542 0 : return NULL;
21543 : }
21544 :
21545 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21546 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
21547 : }
21548 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21549 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
21550 : }
21551 :
21552 0 : return py_winreg_OpenHKPT_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
21553 : }
21554 :
21555 0 : static PyObject *py_winreg_OpenHKPT_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
21556 : {
21557 0 : const struct ndr_interface_call *call = NULL;
21558 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(py_obj);
21559 0 : struct ndr_pull *pull = NULL;
21560 : enum ndr_err_code err;
21561 :
21562 0 : if (ndr_table_winreg.num_calls < 33) {
21563 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPT_ndr_unpack");
21564 0 : return NULL;
21565 : }
21566 0 : call = &ndr_table_winreg.calls[32];
21567 :
21568 0 : pull = ndr_pull_init_blob(blob, object);
21569 0 : if (pull == NULL) {
21570 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
21571 0 : return NULL;
21572 : }
21573 :
21574 0 : pull->flags |= ndr_pull_flags;
21575 :
21576 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
21577 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
21578 0 : TALLOC_FREE(pull);
21579 0 : PyErr_SetNdrError(err);
21580 0 : return NULL;
21581 : }
21582 0 : if (!allow_remaining) {
21583 : uint32_t highest_ofs;
21584 :
21585 0 : if (pull->offset > pull->relative_highest_offset) {
21586 0 : highest_ofs = pull->offset;
21587 : } else {
21588 0 : highest_ofs = pull->relative_highest_offset;
21589 : }
21590 0 : if (highest_ofs < pull->data_size) {
21591 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
21592 : "not all bytes consumed ofs[%u] size[%u]",
21593 : highest_ofs, pull->data_size);
21594 0 : TALLOC_FREE(pull);
21595 0 : PyErr_SetNdrError(err);
21596 0 : return NULL;
21597 : }
21598 : }
21599 :
21600 0 : TALLOC_FREE(pull);
21601 0 : Py_RETURN_NONE;
21602 : }
21603 :
21604 0 : static PyObject *py_winreg_OpenHKPT_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21605 : {
21606 : DATA_BLOB blob;
21607 0 : Py_ssize_t blob_length = 0;
21608 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21609 0 : PyObject *bigendian_obj = NULL;
21610 0 : PyObject *ndr64_obj = NULL;
21611 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21612 0 : PyObject *allow_remaining_obj = NULL;
21613 0 : bool allow_remaining = false;
21614 :
21615 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
21616 : discard_const_p(char *, kwnames),
21617 : &blob.data, &blob_length,
21618 : &bigendian_obj,
21619 : &ndr64_obj,
21620 : &allow_remaining_obj)) {
21621 0 : return NULL;
21622 : }
21623 0 : blob.length = blob_length;
21624 :
21625 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21626 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21627 : }
21628 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21629 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21630 : }
21631 :
21632 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21633 0 : allow_remaining = true;
21634 : }
21635 :
21636 0 : return py_winreg_OpenHKPT_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
21637 : }
21638 :
21639 0 : static PyObject *py_winreg_OpenHKPT_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21640 : {
21641 : DATA_BLOB blob;
21642 0 : Py_ssize_t blob_length = 0;
21643 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21644 0 : PyObject *bigendian_obj = NULL;
21645 0 : PyObject *ndr64_obj = NULL;
21646 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21647 0 : PyObject *allow_remaining_obj = NULL;
21648 0 : bool allow_remaining = false;
21649 :
21650 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
21651 : discard_const_p(char *, kwnames),
21652 : &blob.data, &blob_length,
21653 : &bigendian_obj,
21654 : &ndr64_obj,
21655 : &allow_remaining_obj)) {
21656 0 : return NULL;
21657 : }
21658 0 : blob.length = blob_length;
21659 :
21660 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21661 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21662 : }
21663 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21664 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21665 : }
21666 :
21667 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21668 0 : allow_remaining = true;
21669 : }
21670 :
21671 0 : return py_winreg_OpenHKPT_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
21672 : }
21673 :
21674 0 : static PyObject *py_winreg_OpenHKPT_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
21675 : {
21676 0 : const struct ndr_interface_call *call = NULL;
21677 0 : struct winreg_OpenHKPT *object = pytalloc_get_ptr(py_obj);
21678 : PyObject *ret;
21679 : char *retstr;
21680 :
21681 0 : if (ndr_table_winreg.num_calls < 33) {
21682 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPT_ndr_print");
21683 0 : return NULL;
21684 : }
21685 0 : call = &ndr_table_winreg.calls[32];
21686 :
21687 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
21688 0 : ret = PyUnicode_FromString(retstr);
21689 0 : TALLOC_FREE(retstr);
21690 :
21691 0 : return ret;
21692 : }
21693 :
21694 0 : static PyObject *py_winreg_OpenHKPT_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21695 : {
21696 0 : return py_winreg_OpenHKPT_ndr_print(py_obj, "winreg_OpenHKPT_in", NDR_IN);
21697 : }
21698 :
21699 0 : static PyObject *py_winreg_OpenHKPT_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21700 : {
21701 0 : return py_winreg_OpenHKPT_ndr_print(py_obj, "winreg_OpenHKPT_out", NDR_OUT);
21702 : }
21703 :
21704 : static PyMethodDef py_winreg_OpenHKPT_methods[] = {
21705 : { "opnum", (PyCFunction)py_winreg_OpenHKPT_ndr_opnum, METH_NOARGS|METH_CLASS,
21706 : "winreg.OpenHKPT.opnum() -> 32 (0x20) " },
21707 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
21708 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
21709 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
21710 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
21711 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
21712 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
21713 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
21714 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
21715 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKPT_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
21716 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKPT_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
21717 : { NULL, NULL, 0, NULL }
21718 : };
21719 :
21720 :
21721 : static PyTypeObject winreg_OpenHKPT_Type = {
21722 : PyVarObject_HEAD_INIT(NULL, 0)
21723 : .tp_name = "winreg.OpenHKPT",
21724 : .tp_getset = py_winreg_OpenHKPT_getsetters,
21725 : .tp_methods = py_winreg_OpenHKPT_methods,
21726 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
21727 : .tp_new = py_winreg_OpenHKPT_new,
21728 : };
21729 :
21730 0 : static bool pack_py_winreg_OpenHKPT_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPT *r)
21731 : {
21732 : PyObject *py_system_name;
21733 : PyObject *py_access_mask;
21734 0 : const char *kwnames[] = {
21735 : "system_name", "access_mask", NULL
21736 : };
21737 :
21738 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPT", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
21739 0 : return false;
21740 : }
21741 :
21742 0 : if (py_system_name == NULL) {
21743 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
21744 0 : return false;
21745 : }
21746 0 : if (py_system_name == Py_None) {
21747 0 : r->in.system_name = NULL;
21748 : } else {
21749 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
21750 0 : if (r->in.system_name == NULL) {
21751 0 : PyErr_NoMemory();
21752 0 : return false;
21753 : }
21754 : {
21755 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
21756 0 : if (PyLong_Check(py_system_name)) {
21757 : unsigned long long test_var;
21758 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
21759 0 : if (PyErr_Occurred() != NULL) {
21760 0 : return false;
21761 : }
21762 0 : if (test_var > uint_max) {
21763 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21764 : PyLong_Type.tp_name, uint_max, test_var);
21765 0 : return false;
21766 : }
21767 0 : *r->in.system_name = test_var;
21768 : } else {
21769 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21770 : PyLong_Type.tp_name);
21771 0 : return false;
21772 : }
21773 : }
21774 : }
21775 0 : if (py_access_mask == NULL) {
21776 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
21777 0 : return false;
21778 : }
21779 : {
21780 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
21781 0 : if (PyLong_Check(py_access_mask)) {
21782 : unsigned long long test_var;
21783 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
21784 0 : if (PyErr_Occurred() != NULL) {
21785 0 : return false;
21786 : }
21787 0 : if (test_var > uint_max) {
21788 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21789 : PyLong_Type.tp_name, uint_max, test_var);
21790 0 : return false;
21791 : }
21792 0 : r->in.access_mask = test_var;
21793 : } else {
21794 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21795 : PyLong_Type.tp_name);
21796 0 : return false;
21797 : }
21798 : }
21799 0 : return true;
21800 : }
21801 :
21802 0 : static PyObject *unpack_py_winreg_OpenHKPT_args_out(struct winreg_OpenHKPT *r)
21803 : {
21804 : PyObject *result;
21805 : PyObject *py_handle;
21806 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
21807 0 : result = py_handle;
21808 0 : if (!W_ERROR_IS_OK(r->out.result)) {
21809 0 : PyErr_SetWERROR(r->out.result);
21810 0 : return NULL;
21811 : }
21812 :
21813 0 : return result;
21814 : }
21815 :
21816 :
21817 0 : static PyObject *py_winreg_OpenHKPN_in_get_system_name(PyObject *obj, void *closure)
21818 : {
21819 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(obj);
21820 : PyObject *py_system_name;
21821 0 : if (object->in.system_name == NULL) {
21822 0 : Py_RETURN_NONE;
21823 : }
21824 0 : if (object->in.system_name == NULL) {
21825 0 : py_system_name = Py_None;
21826 0 : Py_INCREF(py_system_name);
21827 : } else {
21828 0 : py_system_name = PyLong_FromLong((uint16_t)(*object->in.system_name));
21829 : }
21830 0 : return py_system_name;
21831 : }
21832 :
21833 0 : static int py_winreg_OpenHKPN_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
21834 : {
21835 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(py_obj);
21836 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
21837 0 : if (value == NULL) {
21838 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.system_name");
21839 0 : return -1;
21840 : }
21841 0 : if (value == Py_None) {
21842 0 : object->in.system_name = NULL;
21843 : } else {
21844 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
21845 0 : if (object->in.system_name == NULL) {
21846 0 : PyErr_NoMemory();
21847 0 : return -1;
21848 : }
21849 : {
21850 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
21851 0 : if (PyLong_Check(value)) {
21852 : unsigned long long test_var;
21853 0 : test_var = PyLong_AsUnsignedLongLong(value);
21854 0 : if (PyErr_Occurred() != NULL) {
21855 0 : return -1;
21856 : }
21857 0 : if (test_var > uint_max) {
21858 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21859 : PyLong_Type.tp_name, uint_max, test_var);
21860 0 : return -1;
21861 : }
21862 0 : *object->in.system_name = test_var;
21863 : } else {
21864 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21865 : PyLong_Type.tp_name);
21866 0 : return -1;
21867 : }
21868 : }
21869 : }
21870 0 : return 0;
21871 : }
21872 :
21873 0 : static PyObject *py_winreg_OpenHKPN_in_get_access_mask(PyObject *obj, void *closure)
21874 : {
21875 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(obj);
21876 : PyObject *py_access_mask;
21877 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
21878 0 : return py_access_mask;
21879 : }
21880 :
21881 0 : static int py_winreg_OpenHKPN_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
21882 : {
21883 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(py_obj);
21884 0 : if (value == NULL) {
21885 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
21886 0 : return -1;
21887 : }
21888 : {
21889 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
21890 0 : if (PyLong_Check(value)) {
21891 : unsigned long long test_var;
21892 0 : test_var = PyLong_AsUnsignedLongLong(value);
21893 0 : if (PyErr_Occurred() != NULL) {
21894 0 : return -1;
21895 : }
21896 0 : if (test_var > uint_max) {
21897 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21898 : PyLong_Type.tp_name, uint_max, test_var);
21899 0 : return -1;
21900 : }
21901 0 : object->in.access_mask = test_var;
21902 : } else {
21903 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21904 : PyLong_Type.tp_name);
21905 0 : return -1;
21906 : }
21907 : }
21908 0 : return 0;
21909 : }
21910 :
21911 0 : static PyObject *py_winreg_OpenHKPN_out_get_handle(PyObject *obj, void *closure)
21912 : {
21913 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(obj);
21914 : PyObject *py_handle;
21915 0 : if (object->out.handle == NULL) {
21916 0 : Py_RETURN_NONE;
21917 : }
21918 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
21919 0 : return py_handle;
21920 : }
21921 :
21922 0 : static int py_winreg_OpenHKPN_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
21923 : {
21924 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(py_obj);
21925 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
21926 0 : if (value == NULL) {
21927 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.handle");
21928 0 : return -1;
21929 : }
21930 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
21931 0 : if (object->out.handle == NULL) {
21932 0 : PyErr_NoMemory();
21933 0 : return -1;
21934 : }
21935 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
21936 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
21937 0 : PyErr_NoMemory();
21938 0 : return -1;
21939 : }
21940 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
21941 0 : return 0;
21942 : }
21943 :
21944 0 : static PyObject *py_winreg_OpenHKPN_get_result(PyObject *obj, void *closure)
21945 : {
21946 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(obj);
21947 : PyObject *py_result;
21948 0 : py_result = PyErr_FromWERROR(object->out.result);
21949 0 : return py_result;
21950 : }
21951 :
21952 0 : static int py_winreg_OpenHKPN_set_result(PyObject *py_obj, PyObject *value, void *closure)
21953 : {
21954 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(py_obj);
21955 0 : if (value == NULL) {
21956 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
21957 0 : return -1;
21958 : }
21959 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
21960 0 : return 0;
21961 : }
21962 :
21963 : static PyGetSetDef py_winreg_OpenHKPN_getsetters[] = {
21964 : {
21965 : .name = discard_const_p(char, "in_system_name"),
21966 : .get = py_winreg_OpenHKPN_in_get_system_name,
21967 : .set = py_winreg_OpenHKPN_in_set_system_name,
21968 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
21969 : },
21970 : {
21971 : .name = discard_const_p(char, "in_access_mask"),
21972 : .get = py_winreg_OpenHKPN_in_get_access_mask,
21973 : .set = py_winreg_OpenHKPN_in_set_access_mask,
21974 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
21975 : },
21976 : {
21977 : .name = discard_const_p(char, "out_handle"),
21978 : .get = py_winreg_OpenHKPN_out_get_handle,
21979 : .set = py_winreg_OpenHKPN_out_set_handle,
21980 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
21981 : },
21982 : {
21983 : .name = discard_const_p(char, "result"),
21984 : .get = py_winreg_OpenHKPN_get_result,
21985 : .set = py_winreg_OpenHKPN_set_result,
21986 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
21987 : },
21988 : { .name = NULL }
21989 : };
21990 :
21991 0 : static PyObject *py_winreg_OpenHKPN_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
21992 : {
21993 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKPN, type);
21994 0 : struct winreg_OpenHKPN *_self = (struct winreg_OpenHKPN *)pytalloc_get_ptr(self);
21995 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
21996 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
21997 0 : return self;
21998 : }
21999 :
22000 0 : static PyObject *py_winreg_OpenHKPN_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
22001 : {
22002 :
22003 :
22004 0 : return PyLong_FromLong(33);
22005 : }
22006 :
22007 0 : static PyObject *py_winreg_OpenHKPN_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
22008 : {
22009 0 : const struct ndr_interface_call *call = NULL;
22010 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(py_obj);
22011 0 : PyObject *ret = NULL;
22012 0 : struct ndr_push *push = NULL;
22013 : DATA_BLOB blob;
22014 : enum ndr_err_code err;
22015 :
22016 0 : if (ndr_table_winreg.num_calls < 34) {
22017 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPN_ndr_pack");
22018 0 : return NULL;
22019 : }
22020 0 : call = &ndr_table_winreg.calls[33];
22021 :
22022 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
22023 0 : if (push == NULL) {
22024 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22025 0 : return NULL;
22026 : }
22027 :
22028 0 : push->flags |= ndr_push_flags;
22029 :
22030 0 : err = call->ndr_push(push, ndr_inout_flags, object);
22031 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22032 0 : TALLOC_FREE(push);
22033 0 : PyErr_SetNdrError(err);
22034 0 : return NULL;
22035 : }
22036 0 : blob = ndr_push_blob(push);
22037 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
22038 0 : TALLOC_FREE(push);
22039 0 : return ret;
22040 : }
22041 :
22042 0 : static PyObject *py_winreg_OpenHKPN_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22043 : {
22044 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22045 0 : PyObject *bigendian_obj = NULL;
22046 0 : PyObject *ndr64_obj = NULL;
22047 0 : libndr_flags ndr_push_flags = 0;
22048 :
22049 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
22050 : discard_const_p(char *, kwnames),
22051 : &bigendian_obj,
22052 : &ndr64_obj)) {
22053 0 : return NULL;
22054 : }
22055 :
22056 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22057 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22058 : }
22059 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22060 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22061 : }
22062 :
22063 0 : return py_winreg_OpenHKPN_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
22064 : }
22065 :
22066 0 : static PyObject *py_winreg_OpenHKPN_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22067 : {
22068 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22069 0 : PyObject *bigendian_obj = NULL;
22070 0 : PyObject *ndr64_obj = NULL;
22071 0 : libndr_flags ndr_push_flags = 0;
22072 :
22073 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
22074 : discard_const_p(char *, kwnames),
22075 : &bigendian_obj,
22076 : &ndr64_obj)) {
22077 0 : return NULL;
22078 : }
22079 :
22080 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22081 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22082 : }
22083 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22084 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22085 : }
22086 :
22087 0 : return py_winreg_OpenHKPN_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
22088 : }
22089 :
22090 0 : static PyObject *py_winreg_OpenHKPN_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
22091 : {
22092 0 : const struct ndr_interface_call *call = NULL;
22093 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(py_obj);
22094 0 : struct ndr_pull *pull = NULL;
22095 : enum ndr_err_code err;
22096 :
22097 0 : if (ndr_table_winreg.num_calls < 34) {
22098 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPN_ndr_unpack");
22099 0 : return NULL;
22100 : }
22101 0 : call = &ndr_table_winreg.calls[33];
22102 :
22103 0 : pull = ndr_pull_init_blob(blob, object);
22104 0 : if (pull == NULL) {
22105 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22106 0 : return NULL;
22107 : }
22108 :
22109 0 : pull->flags |= ndr_pull_flags;
22110 :
22111 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
22112 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22113 0 : TALLOC_FREE(pull);
22114 0 : PyErr_SetNdrError(err);
22115 0 : return NULL;
22116 : }
22117 0 : if (!allow_remaining) {
22118 : uint32_t highest_ofs;
22119 :
22120 0 : if (pull->offset > pull->relative_highest_offset) {
22121 0 : highest_ofs = pull->offset;
22122 : } else {
22123 0 : highest_ofs = pull->relative_highest_offset;
22124 : }
22125 0 : if (highest_ofs < pull->data_size) {
22126 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
22127 : "not all bytes consumed ofs[%u] size[%u]",
22128 : highest_ofs, pull->data_size);
22129 0 : TALLOC_FREE(pull);
22130 0 : PyErr_SetNdrError(err);
22131 0 : return NULL;
22132 : }
22133 : }
22134 :
22135 0 : TALLOC_FREE(pull);
22136 0 : Py_RETURN_NONE;
22137 : }
22138 :
22139 0 : static PyObject *py_winreg_OpenHKPN_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22140 : {
22141 : DATA_BLOB blob;
22142 0 : Py_ssize_t blob_length = 0;
22143 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
22144 0 : PyObject *bigendian_obj = NULL;
22145 0 : PyObject *ndr64_obj = NULL;
22146 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
22147 0 : PyObject *allow_remaining_obj = NULL;
22148 0 : bool allow_remaining = false;
22149 :
22150 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
22151 : discard_const_p(char *, kwnames),
22152 : &blob.data, &blob_length,
22153 : &bigendian_obj,
22154 : &ndr64_obj,
22155 : &allow_remaining_obj)) {
22156 0 : return NULL;
22157 : }
22158 0 : blob.length = blob_length;
22159 :
22160 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22161 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
22162 : }
22163 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22164 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
22165 : }
22166 :
22167 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
22168 0 : allow_remaining = true;
22169 : }
22170 :
22171 0 : return py_winreg_OpenHKPN_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
22172 : }
22173 :
22174 0 : static PyObject *py_winreg_OpenHKPN_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22175 : {
22176 : DATA_BLOB blob;
22177 0 : Py_ssize_t blob_length = 0;
22178 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
22179 0 : PyObject *bigendian_obj = NULL;
22180 0 : PyObject *ndr64_obj = NULL;
22181 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
22182 0 : PyObject *allow_remaining_obj = NULL;
22183 0 : bool allow_remaining = false;
22184 :
22185 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
22186 : discard_const_p(char *, kwnames),
22187 : &blob.data, &blob_length,
22188 : &bigendian_obj,
22189 : &ndr64_obj,
22190 : &allow_remaining_obj)) {
22191 0 : return NULL;
22192 : }
22193 0 : blob.length = blob_length;
22194 :
22195 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22196 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
22197 : }
22198 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22199 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
22200 : }
22201 :
22202 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
22203 0 : allow_remaining = true;
22204 : }
22205 :
22206 0 : return py_winreg_OpenHKPN_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
22207 : }
22208 :
22209 0 : static PyObject *py_winreg_OpenHKPN_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
22210 : {
22211 0 : const struct ndr_interface_call *call = NULL;
22212 0 : struct winreg_OpenHKPN *object = pytalloc_get_ptr(py_obj);
22213 : PyObject *ret;
22214 : char *retstr;
22215 :
22216 0 : if (ndr_table_winreg.num_calls < 34) {
22217 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPN_ndr_print");
22218 0 : return NULL;
22219 : }
22220 0 : call = &ndr_table_winreg.calls[33];
22221 :
22222 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
22223 0 : ret = PyUnicode_FromString(retstr);
22224 0 : TALLOC_FREE(retstr);
22225 :
22226 0 : return ret;
22227 : }
22228 :
22229 0 : static PyObject *py_winreg_OpenHKPN_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
22230 : {
22231 0 : return py_winreg_OpenHKPN_ndr_print(py_obj, "winreg_OpenHKPN_in", NDR_IN);
22232 : }
22233 :
22234 0 : static PyObject *py_winreg_OpenHKPN_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
22235 : {
22236 0 : return py_winreg_OpenHKPN_ndr_print(py_obj, "winreg_OpenHKPN_out", NDR_OUT);
22237 : }
22238 :
22239 : static PyMethodDef py_winreg_OpenHKPN_methods[] = {
22240 : { "opnum", (PyCFunction)py_winreg_OpenHKPN_ndr_opnum, METH_NOARGS|METH_CLASS,
22241 : "winreg.OpenHKPN.opnum() -> 33 (0x21) " },
22242 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
22243 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
22244 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
22245 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
22246 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
22247 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
22248 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
22249 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
22250 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKPN_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
22251 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKPN_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
22252 : { NULL, NULL, 0, NULL }
22253 : };
22254 :
22255 :
22256 : static PyTypeObject winreg_OpenHKPN_Type = {
22257 : PyVarObject_HEAD_INIT(NULL, 0)
22258 : .tp_name = "winreg.OpenHKPN",
22259 : .tp_getset = py_winreg_OpenHKPN_getsetters,
22260 : .tp_methods = py_winreg_OpenHKPN_methods,
22261 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
22262 : .tp_new = py_winreg_OpenHKPN_new,
22263 : };
22264 :
22265 0 : static bool pack_py_winreg_OpenHKPN_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPN *r)
22266 : {
22267 : PyObject *py_system_name;
22268 : PyObject *py_access_mask;
22269 0 : const char *kwnames[] = {
22270 : "system_name", "access_mask", NULL
22271 : };
22272 :
22273 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPN", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
22274 0 : return false;
22275 : }
22276 :
22277 0 : if (py_system_name == NULL) {
22278 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.system_name");
22279 0 : return false;
22280 : }
22281 0 : if (py_system_name == Py_None) {
22282 0 : r->in.system_name = NULL;
22283 : } else {
22284 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
22285 0 : if (r->in.system_name == NULL) {
22286 0 : PyErr_NoMemory();
22287 0 : return false;
22288 : }
22289 : {
22290 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
22291 0 : if (PyLong_Check(py_system_name)) {
22292 : unsigned long long test_var;
22293 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
22294 0 : if (PyErr_Occurred() != NULL) {
22295 0 : return false;
22296 : }
22297 0 : if (test_var > uint_max) {
22298 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22299 : PyLong_Type.tp_name, uint_max, test_var);
22300 0 : return false;
22301 : }
22302 0 : *r->in.system_name = test_var;
22303 : } else {
22304 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22305 : PyLong_Type.tp_name);
22306 0 : return false;
22307 : }
22308 : }
22309 : }
22310 0 : if (py_access_mask == NULL) {
22311 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
22312 0 : return false;
22313 : }
22314 : {
22315 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
22316 0 : if (PyLong_Check(py_access_mask)) {
22317 : unsigned long long test_var;
22318 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
22319 0 : if (PyErr_Occurred() != NULL) {
22320 0 : return false;
22321 : }
22322 0 : if (test_var > uint_max) {
22323 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22324 : PyLong_Type.tp_name, uint_max, test_var);
22325 0 : return false;
22326 : }
22327 0 : r->in.access_mask = test_var;
22328 : } else {
22329 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22330 : PyLong_Type.tp_name);
22331 0 : return false;
22332 : }
22333 : }
22334 0 : return true;
22335 : }
22336 :
22337 0 : static PyObject *unpack_py_winreg_OpenHKPN_args_out(struct winreg_OpenHKPN *r)
22338 : {
22339 : PyObject *result;
22340 : PyObject *py_handle;
22341 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
22342 0 : result = py_handle;
22343 0 : if (!W_ERROR_IS_OK(r->out.result)) {
22344 0 : PyErr_SetWERROR(r->out.result);
22345 0 : return NULL;
22346 : }
22347 :
22348 0 : return result;
22349 : }
22350 :
22351 :
22352 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_key_handle(PyObject *obj, void *closure)
22353 : {
22354 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22355 : PyObject *py_key_handle;
22356 0 : if (object->in.key_handle == NULL) {
22357 0 : Py_RETURN_NONE;
22358 : }
22359 0 : py_key_handle = pytalloc_reference_ex(policy_handle_Type, object->in.key_handle, object->in.key_handle);
22360 0 : return py_key_handle;
22361 : }
22362 :
22363 0 : static int py_winreg_QueryMultipleValues2_in_set_key_handle(PyObject *py_obj, PyObject *value, void *closure)
22364 : {
22365 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22366 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.key_handle));
22367 0 : if (value == NULL) {
22368 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.key_handle");
22369 0 : return -1;
22370 : }
22371 0 : object->in.key_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.key_handle);
22372 0 : if (object->in.key_handle == NULL) {
22373 0 : PyErr_NoMemory();
22374 0 : return -1;
22375 : }
22376 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
22377 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
22378 0 : PyErr_NoMemory();
22379 0 : return -1;
22380 : }
22381 0 : object->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(value);
22382 0 : return 0;
22383 : }
22384 :
22385 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_values_in(PyObject *obj, void *closure)
22386 : {
22387 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22388 : PyObject *py_values_in;
22389 0 : if (object->in.values_in == NULL) {
22390 0 : Py_RETURN_NONE;
22391 : }
22392 0 : py_values_in = PyList_New(object->in.num_values);
22393 0 : if (py_values_in == NULL) {
22394 0 : return NULL;
22395 : }
22396 : {
22397 : int values_in_cntr_1;
22398 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < (object->in.num_values); values_in_cntr_1++) {
22399 : PyObject *py_values_in_1;
22400 0 : py_values_in_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->in.values_in, &(object->in.values_in)[values_in_cntr_1]);
22401 0 : PyList_SetItem(py_values_in, values_in_cntr_1, py_values_in_1);
22402 : }
22403 : }
22404 0 : return py_values_in;
22405 : }
22406 :
22407 0 : static int py_winreg_QueryMultipleValues2_in_set_values_in(PyObject *py_obj, PyObject *value, void *closure)
22408 : {
22409 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22410 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.values_in));
22411 0 : if (value == NULL) {
22412 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.values_in");
22413 0 : return -1;
22414 : }
22415 0 : object->in.values_in = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in);
22416 0 : if (object->in.values_in == NULL) {
22417 0 : PyErr_NoMemory();
22418 0 : return -1;
22419 : }
22420 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22421 : {
22422 : int values_in_cntr_1;
22423 0 : object->in.values_in = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in, PyList_GET_SIZE(value));
22424 0 : if (!object->in.values_in) { return -1; }
22425 0 : talloc_set_name_const(object->in.values_in, "ARRAY: object->in.values_in");
22426 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(value); values_in_cntr_1++) {
22427 0 : if (PyList_GET_ITEM(value, values_in_cntr_1) == NULL) {
22428 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.values_in)[values_in_cntr_1]");
22429 0 : return -1;
22430 : }
22431 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_in_cntr_1), return -1;);
22432 0 : if (talloc_reference(object->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_in_cntr_1))) == NULL) {
22433 0 : PyErr_NoMemory();
22434 0 : return -1;
22435 : }
22436 0 : (object->in.values_in)[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_in_cntr_1));
22437 : }
22438 : }
22439 0 : return 0;
22440 : }
22441 :
22442 0 : static PyObject *py_winreg_QueryMultipleValues2_out_get_values_out(PyObject *obj, void *closure)
22443 : {
22444 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22445 : PyObject *py_values_out;
22446 0 : if (object->out.values_out == NULL) {
22447 0 : Py_RETURN_NONE;
22448 : }
22449 0 : py_values_out = PyList_New(object->in.num_values);
22450 0 : if (py_values_out == NULL) {
22451 0 : return NULL;
22452 : }
22453 : {
22454 : int values_out_cntr_1;
22455 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (object->in.num_values); values_out_cntr_1++) {
22456 : PyObject *py_values_out_1;
22457 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->out.values_out, &(object->out.values_out)[values_out_cntr_1]);
22458 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
22459 : }
22460 : }
22461 0 : return py_values_out;
22462 : }
22463 :
22464 0 : static int py_winreg_QueryMultipleValues2_out_set_values_out(PyObject *py_obj, PyObject *value, void *closure)
22465 : {
22466 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22467 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.values_out));
22468 0 : if (value == NULL) {
22469 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.values_out");
22470 0 : return -1;
22471 : }
22472 0 : object->out.values_out = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out);
22473 0 : if (object->out.values_out == NULL) {
22474 0 : PyErr_NoMemory();
22475 0 : return -1;
22476 : }
22477 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22478 : {
22479 : int values_out_cntr_1;
22480 0 : object->out.values_out = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out, PyList_GET_SIZE(value));
22481 0 : if (!object->out.values_out) { return -1; }
22482 0 : talloc_set_name_const(object->out.values_out, "ARRAY: object->out.values_out");
22483 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < PyList_GET_SIZE(value); values_out_cntr_1++) {
22484 0 : if (PyList_GET_ITEM(value, values_out_cntr_1) == NULL) {
22485 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->out.values_out)[values_out_cntr_1]");
22486 0 : return -1;
22487 : }
22488 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_out_cntr_1), return -1;);
22489 0 : if (talloc_reference(object->out.values_out, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_out_cntr_1))) == NULL) {
22490 0 : PyErr_NoMemory();
22491 0 : return -1;
22492 : }
22493 0 : (object->out.values_out)[values_out_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_out_cntr_1));
22494 : }
22495 : }
22496 0 : return 0;
22497 : }
22498 :
22499 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_num_values(PyObject *obj, void *closure)
22500 : {
22501 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22502 : PyObject *py_num_values;
22503 0 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)(object->in.num_values));
22504 0 : return py_num_values;
22505 : }
22506 :
22507 0 : static int py_winreg_QueryMultipleValues2_in_set_num_values(PyObject *py_obj, PyObject *value, void *closure)
22508 : {
22509 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22510 0 : if (value == NULL) {
22511 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.num_values");
22512 0 : return -1;
22513 : }
22514 : {
22515 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.num_values));
22516 0 : if (PyLong_Check(value)) {
22517 : unsigned long long test_var;
22518 0 : test_var = PyLong_AsUnsignedLongLong(value);
22519 0 : if (PyErr_Occurred() != NULL) {
22520 0 : return -1;
22521 : }
22522 0 : if (test_var > uint_max) {
22523 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22524 : PyLong_Type.tp_name, uint_max, test_var);
22525 0 : return -1;
22526 : }
22527 0 : object->in.num_values = test_var;
22528 : } else {
22529 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22530 : PyLong_Type.tp_name);
22531 0 : return -1;
22532 : }
22533 : }
22534 0 : return 0;
22535 : }
22536 :
22537 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_buffer(PyObject *obj, void *closure)
22538 : {
22539 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22540 : PyObject *py_buffer;
22541 0 : if (object->in.buffer == NULL) {
22542 0 : Py_RETURN_NONE;
22543 : }
22544 0 : if (object->in.buffer == NULL) {
22545 0 : py_buffer = Py_None;
22546 0 : Py_INCREF(py_buffer);
22547 : } else {
22548 0 : py_buffer = PyList_New(*object->in.offered);
22549 0 : if (py_buffer == NULL) {
22550 0 : return NULL;
22551 : }
22552 : {
22553 : int buffer_cntr_1;
22554 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->in.offered); buffer_cntr_1++) {
22555 : PyObject *py_buffer_1;
22556 0 : py_buffer_1 = PyLong_FromLong((uint16_t)((object->in.buffer)[buffer_cntr_1]));
22557 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
22558 : }
22559 : }
22560 : }
22561 0 : return py_buffer;
22562 : }
22563 :
22564 0 : static int py_winreg_QueryMultipleValues2_in_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
22565 : {
22566 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22567 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer));
22568 0 : if (value == NULL) {
22569 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.buffer");
22570 0 : return -1;
22571 : }
22572 0 : if (value == Py_None) {
22573 0 : object->in.buffer = NULL;
22574 : } else {
22575 0 : object->in.buffer = NULL;
22576 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22577 : {
22578 : int buffer_cntr_1;
22579 0 : object->in.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer, PyList_GET_SIZE(value));
22580 0 : if (!object->in.buffer) { return -1; }
22581 0 : talloc_set_name_const(object->in.buffer, "ARRAY: object->in.buffer");
22582 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
22583 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
22584 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.buffer)[buffer_cntr_1]");
22585 0 : return -1;
22586 : }
22587 : {
22588 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->in.buffer)[buffer_cntr_1]));
22589 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
22590 : unsigned long long test_var;
22591 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
22592 0 : if (PyErr_Occurred() != NULL) {
22593 0 : return -1;
22594 : }
22595 0 : if (test_var > uint_max) {
22596 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22597 : PyLong_Type.tp_name, uint_max, test_var);
22598 0 : return -1;
22599 : }
22600 0 : (object->in.buffer)[buffer_cntr_1] = test_var;
22601 : } else {
22602 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22603 : PyLong_Type.tp_name);
22604 0 : return -1;
22605 : }
22606 : }
22607 : }
22608 : }
22609 : }
22610 0 : return 0;
22611 : }
22612 :
22613 0 : static PyObject *py_winreg_QueryMultipleValues2_out_get_buffer(PyObject *obj, void *closure)
22614 : {
22615 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22616 : PyObject *py_buffer;
22617 0 : if (object->out.buffer == NULL) {
22618 0 : Py_RETURN_NONE;
22619 : }
22620 0 : if (object->out.buffer == NULL) {
22621 0 : py_buffer = Py_None;
22622 0 : Py_INCREF(py_buffer);
22623 : } else {
22624 0 : py_buffer = PyList_New(*object->in.offered);
22625 0 : if (py_buffer == NULL) {
22626 0 : return NULL;
22627 : }
22628 : {
22629 : int buffer_cntr_1;
22630 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->in.offered); buffer_cntr_1++) {
22631 : PyObject *py_buffer_1;
22632 0 : py_buffer_1 = PyLong_FromLong((uint16_t)((object->out.buffer)[buffer_cntr_1]));
22633 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
22634 : }
22635 : }
22636 : }
22637 0 : return py_buffer;
22638 : }
22639 :
22640 0 : static int py_winreg_QueryMultipleValues2_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
22641 : {
22642 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22643 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer));
22644 0 : if (value == NULL) {
22645 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.buffer");
22646 0 : return -1;
22647 : }
22648 0 : if (value == Py_None) {
22649 0 : object->out.buffer = NULL;
22650 : } else {
22651 0 : object->out.buffer = NULL;
22652 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22653 : {
22654 : int buffer_cntr_1;
22655 0 : object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value));
22656 0 : if (!object->out.buffer) { return -1; }
22657 0 : talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer");
22658 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
22659 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
22660 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->out.buffer)[buffer_cntr_1]");
22661 0 : return -1;
22662 : }
22663 : {
22664 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->out.buffer)[buffer_cntr_1]));
22665 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
22666 : unsigned long long test_var;
22667 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
22668 0 : if (PyErr_Occurred() != NULL) {
22669 0 : return -1;
22670 : }
22671 0 : if (test_var > uint_max) {
22672 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22673 : PyLong_Type.tp_name, uint_max, test_var);
22674 0 : return -1;
22675 : }
22676 0 : (object->out.buffer)[buffer_cntr_1] = test_var;
22677 : } else {
22678 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22679 : PyLong_Type.tp_name);
22680 0 : return -1;
22681 : }
22682 : }
22683 : }
22684 : }
22685 : }
22686 0 : return 0;
22687 : }
22688 :
22689 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_offered(PyObject *obj, void *closure)
22690 : {
22691 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22692 : PyObject *py_offered;
22693 0 : if (object->in.offered == NULL) {
22694 0 : Py_RETURN_NONE;
22695 : }
22696 0 : py_offered = PyLong_FromUnsignedLongLong((uint32_t)(*object->in.offered));
22697 0 : return py_offered;
22698 : }
22699 :
22700 0 : static int py_winreg_QueryMultipleValues2_in_set_offered(PyObject *py_obj, PyObject *value, void *closure)
22701 : {
22702 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22703 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.offered));
22704 0 : if (value == NULL) {
22705 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.offered");
22706 0 : return -1;
22707 : }
22708 0 : object->in.offered = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.offered);
22709 0 : if (object->in.offered == NULL) {
22710 0 : PyErr_NoMemory();
22711 0 : return -1;
22712 : }
22713 : {
22714 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.offered));
22715 0 : if (PyLong_Check(value)) {
22716 : unsigned long long test_var;
22717 0 : test_var = PyLong_AsUnsignedLongLong(value);
22718 0 : if (PyErr_Occurred() != NULL) {
22719 0 : return -1;
22720 : }
22721 0 : if (test_var > uint_max) {
22722 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22723 : PyLong_Type.tp_name, uint_max, test_var);
22724 0 : return -1;
22725 : }
22726 0 : *object->in.offered = test_var;
22727 : } else {
22728 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22729 : PyLong_Type.tp_name);
22730 0 : return -1;
22731 : }
22732 : }
22733 0 : return 0;
22734 : }
22735 :
22736 0 : static PyObject *py_winreg_QueryMultipleValues2_out_get_needed(PyObject *obj, void *closure)
22737 : {
22738 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22739 : PyObject *py_needed;
22740 0 : if (object->out.needed == NULL) {
22741 0 : Py_RETURN_NONE;
22742 : }
22743 0 : py_needed = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.needed));
22744 0 : return py_needed;
22745 : }
22746 :
22747 0 : static int py_winreg_QueryMultipleValues2_out_set_needed(PyObject *py_obj, PyObject *value, void *closure)
22748 : {
22749 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22750 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed));
22751 0 : if (value == NULL) {
22752 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.needed");
22753 0 : return -1;
22754 : }
22755 0 : object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed);
22756 0 : if (object->out.needed == NULL) {
22757 0 : PyErr_NoMemory();
22758 0 : return -1;
22759 : }
22760 : {
22761 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed));
22762 0 : if (PyLong_Check(value)) {
22763 : unsigned long long test_var;
22764 0 : test_var = PyLong_AsUnsignedLongLong(value);
22765 0 : if (PyErr_Occurred() != NULL) {
22766 0 : return -1;
22767 : }
22768 0 : if (test_var > uint_max) {
22769 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22770 : PyLong_Type.tp_name, uint_max, test_var);
22771 0 : return -1;
22772 : }
22773 0 : *object->out.needed = test_var;
22774 : } else {
22775 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22776 : PyLong_Type.tp_name);
22777 0 : return -1;
22778 : }
22779 : }
22780 0 : return 0;
22781 : }
22782 :
22783 0 : static PyObject *py_winreg_QueryMultipleValues2_get_result(PyObject *obj, void *closure)
22784 : {
22785 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(obj);
22786 : PyObject *py_result;
22787 0 : py_result = PyErr_FromWERROR(object->out.result);
22788 0 : return py_result;
22789 : }
22790 :
22791 0 : static int py_winreg_QueryMultipleValues2_set_result(PyObject *py_obj, PyObject *value, void *closure)
22792 : {
22793 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22794 0 : if (value == NULL) {
22795 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
22796 0 : return -1;
22797 : }
22798 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
22799 0 : return 0;
22800 : }
22801 :
22802 : static PyGetSetDef py_winreg_QueryMultipleValues2_getsetters[] = {
22803 : {
22804 : .name = discard_const_p(char, "in_key_handle"),
22805 : .get = py_winreg_QueryMultipleValues2_in_get_key_handle,
22806 : .set = py_winreg_QueryMultipleValues2_in_set_key_handle,
22807 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
22808 : },
22809 : {
22810 : .name = discard_const_p(char, "in_values_in"),
22811 : .get = py_winreg_QueryMultipleValues2_in_get_values_in,
22812 : .set = py_winreg_QueryMultipleValues2_in_set_values_in,
22813 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
22814 : },
22815 : {
22816 : .name = discard_const_p(char, "out_values_out"),
22817 : .get = py_winreg_QueryMultipleValues2_out_get_values_out,
22818 : .set = py_winreg_QueryMultipleValues2_out_set_values_out,
22819 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
22820 : },
22821 : {
22822 : .name = discard_const_p(char, "in_num_values"),
22823 : .get = py_winreg_QueryMultipleValues2_in_get_num_values,
22824 : .set = py_winreg_QueryMultipleValues2_in_set_num_values,
22825 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
22826 : },
22827 : {
22828 : .name = discard_const_p(char, "in_buffer"),
22829 : .get = py_winreg_QueryMultipleValues2_in_get_buffer,
22830 : .set = py_winreg_QueryMultipleValues2_in_set_buffer,
22831 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
22832 : },
22833 : {
22834 : .name = discard_const_p(char, "out_buffer"),
22835 : .get = py_winreg_QueryMultipleValues2_out_get_buffer,
22836 : .set = py_winreg_QueryMultipleValues2_out_set_buffer,
22837 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
22838 : },
22839 : {
22840 : .name = discard_const_p(char, "in_offered"),
22841 : .get = py_winreg_QueryMultipleValues2_in_get_offered,
22842 : .set = py_winreg_QueryMultipleValues2_in_set_offered,
22843 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
22844 : },
22845 : {
22846 : .name = discard_const_p(char, "out_needed"),
22847 : .get = py_winreg_QueryMultipleValues2_out_get_needed,
22848 : .set = py_winreg_QueryMultipleValues2_out_set_needed,
22849 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
22850 : },
22851 : {
22852 : .name = discard_const_p(char, "result"),
22853 : .get = py_winreg_QueryMultipleValues2_get_result,
22854 : .set = py_winreg_QueryMultipleValues2_set_result,
22855 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
22856 : },
22857 : { .name = NULL }
22858 : };
22859 :
22860 0 : static PyObject *py_winreg_QueryMultipleValues2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
22861 : {
22862 0 : PyObject *self = pytalloc_new(struct winreg_QueryMultipleValues2, type);
22863 0 : struct winreg_QueryMultipleValues2 *_self = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(self);
22864 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
22865 0 : _self->in.key_handle = talloc_zero(mem_ctx, struct policy_handle);
22866 0 : _self->in.values_in = talloc_zero(mem_ctx, struct QueryMultipleValue);
22867 0 : _self->out.values_out = talloc_zero(mem_ctx, struct QueryMultipleValue);
22868 0 : _self->in.offered = talloc_zero(mem_ctx, uint32_t);
22869 0 : _self->out.needed = talloc_zero(mem_ctx, uint32_t);
22870 0 : return self;
22871 : }
22872 :
22873 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
22874 : {
22875 :
22876 :
22877 0 : return PyLong_FromLong(34);
22878 : }
22879 :
22880 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
22881 : {
22882 0 : const struct ndr_interface_call *call = NULL;
22883 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22884 0 : PyObject *ret = NULL;
22885 0 : struct ndr_push *push = NULL;
22886 : DATA_BLOB blob;
22887 : enum ndr_err_code err;
22888 :
22889 0 : if (ndr_table_winreg.num_calls < 35) {
22890 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues2_ndr_pack");
22891 0 : return NULL;
22892 : }
22893 0 : call = &ndr_table_winreg.calls[34];
22894 :
22895 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
22896 0 : if (push == NULL) {
22897 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22898 0 : return NULL;
22899 : }
22900 :
22901 0 : push->flags |= ndr_push_flags;
22902 :
22903 0 : err = call->ndr_push(push, ndr_inout_flags, object);
22904 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22905 0 : TALLOC_FREE(push);
22906 0 : PyErr_SetNdrError(err);
22907 0 : return NULL;
22908 : }
22909 0 : blob = ndr_push_blob(push);
22910 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
22911 0 : TALLOC_FREE(push);
22912 0 : return ret;
22913 : }
22914 :
22915 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22916 : {
22917 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22918 0 : PyObject *bigendian_obj = NULL;
22919 0 : PyObject *ndr64_obj = NULL;
22920 0 : libndr_flags ndr_push_flags = 0;
22921 :
22922 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
22923 : discard_const_p(char *, kwnames),
22924 : &bigendian_obj,
22925 : &ndr64_obj)) {
22926 0 : return NULL;
22927 : }
22928 :
22929 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22930 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22931 : }
22932 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22933 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22934 : }
22935 :
22936 0 : return py_winreg_QueryMultipleValues2_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
22937 : }
22938 :
22939 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22940 : {
22941 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22942 0 : PyObject *bigendian_obj = NULL;
22943 0 : PyObject *ndr64_obj = NULL;
22944 0 : libndr_flags ndr_push_flags = 0;
22945 :
22946 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
22947 : discard_const_p(char *, kwnames),
22948 : &bigendian_obj,
22949 : &ndr64_obj)) {
22950 0 : return NULL;
22951 : }
22952 :
22953 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22954 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22955 : }
22956 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22957 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22958 : }
22959 :
22960 0 : return py_winreg_QueryMultipleValues2_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
22961 : }
22962 :
22963 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
22964 : {
22965 0 : const struct ndr_interface_call *call = NULL;
22966 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
22967 0 : struct ndr_pull *pull = NULL;
22968 : enum ndr_err_code err;
22969 :
22970 0 : if (ndr_table_winreg.num_calls < 35) {
22971 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues2_ndr_unpack");
22972 0 : return NULL;
22973 : }
22974 0 : call = &ndr_table_winreg.calls[34];
22975 :
22976 0 : pull = ndr_pull_init_blob(blob, object);
22977 0 : if (pull == NULL) {
22978 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22979 0 : return NULL;
22980 : }
22981 :
22982 0 : pull->flags |= ndr_pull_flags;
22983 :
22984 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
22985 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22986 0 : TALLOC_FREE(pull);
22987 0 : PyErr_SetNdrError(err);
22988 0 : return NULL;
22989 : }
22990 0 : if (!allow_remaining) {
22991 : uint32_t highest_ofs;
22992 :
22993 0 : if (pull->offset > pull->relative_highest_offset) {
22994 0 : highest_ofs = pull->offset;
22995 : } else {
22996 0 : highest_ofs = pull->relative_highest_offset;
22997 : }
22998 0 : if (highest_ofs < pull->data_size) {
22999 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
23000 : "not all bytes consumed ofs[%u] size[%u]",
23001 : highest_ofs, pull->data_size);
23002 0 : TALLOC_FREE(pull);
23003 0 : PyErr_SetNdrError(err);
23004 0 : return NULL;
23005 : }
23006 : }
23007 :
23008 0 : TALLOC_FREE(pull);
23009 0 : Py_RETURN_NONE;
23010 : }
23011 :
23012 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23013 : {
23014 : DATA_BLOB blob;
23015 0 : Py_ssize_t blob_length = 0;
23016 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23017 0 : PyObject *bigendian_obj = NULL;
23018 0 : PyObject *ndr64_obj = NULL;
23019 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23020 0 : PyObject *allow_remaining_obj = NULL;
23021 0 : bool allow_remaining = false;
23022 :
23023 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
23024 : discard_const_p(char *, kwnames),
23025 : &blob.data, &blob_length,
23026 : &bigendian_obj,
23027 : &ndr64_obj,
23028 : &allow_remaining_obj)) {
23029 0 : return NULL;
23030 : }
23031 0 : blob.length = blob_length;
23032 :
23033 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23034 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23035 : }
23036 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23037 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23038 : }
23039 :
23040 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23041 0 : allow_remaining = true;
23042 : }
23043 :
23044 0 : return py_winreg_QueryMultipleValues2_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
23045 : }
23046 :
23047 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23048 : {
23049 : DATA_BLOB blob;
23050 0 : Py_ssize_t blob_length = 0;
23051 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23052 0 : PyObject *bigendian_obj = NULL;
23053 0 : PyObject *ndr64_obj = NULL;
23054 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23055 0 : PyObject *allow_remaining_obj = NULL;
23056 0 : bool allow_remaining = false;
23057 :
23058 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
23059 : discard_const_p(char *, kwnames),
23060 : &blob.data, &blob_length,
23061 : &bigendian_obj,
23062 : &ndr64_obj,
23063 : &allow_remaining_obj)) {
23064 0 : return NULL;
23065 : }
23066 0 : blob.length = blob_length;
23067 :
23068 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23069 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23070 : }
23071 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23072 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23073 : }
23074 :
23075 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23076 0 : allow_remaining = true;
23077 : }
23078 :
23079 0 : return py_winreg_QueryMultipleValues2_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
23080 : }
23081 :
23082 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
23083 : {
23084 0 : const struct ndr_interface_call *call = NULL;
23085 0 : struct winreg_QueryMultipleValues2 *object = pytalloc_get_ptr(py_obj);
23086 : PyObject *ret;
23087 : char *retstr;
23088 :
23089 0 : if (ndr_table_winreg.num_calls < 35) {
23090 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues2_ndr_print");
23091 0 : return NULL;
23092 : }
23093 0 : call = &ndr_table_winreg.calls[34];
23094 :
23095 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
23096 0 : ret = PyUnicode_FromString(retstr);
23097 0 : TALLOC_FREE(retstr);
23098 :
23099 0 : return ret;
23100 : }
23101 :
23102 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23103 : {
23104 0 : return py_winreg_QueryMultipleValues2_ndr_print(py_obj, "winreg_QueryMultipleValues2_in", NDR_IN);
23105 : }
23106 :
23107 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23108 : {
23109 0 : return py_winreg_QueryMultipleValues2_ndr_print(py_obj, "winreg_QueryMultipleValues2_out", NDR_OUT);
23110 : }
23111 :
23112 : static PyMethodDef py_winreg_QueryMultipleValues2_methods[] = {
23113 : { "opnum", (PyCFunction)py_winreg_QueryMultipleValues2_ndr_opnum, METH_NOARGS|METH_CLASS,
23114 : "winreg.QueryMultipleValues2.opnum() -> 34 (0x22) " },
23115 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
23116 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
23117 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
23118 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
23119 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
23120 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
23121 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
23122 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
23123 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryMultipleValues2_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
23124 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryMultipleValues2_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
23125 : { NULL, NULL, 0, NULL }
23126 : };
23127 :
23128 :
23129 : static PyTypeObject winreg_QueryMultipleValues2_Type = {
23130 : PyVarObject_HEAD_INIT(NULL, 0)
23131 : .tp_name = "winreg.QueryMultipleValues2",
23132 : .tp_getset = py_winreg_QueryMultipleValues2_getsetters,
23133 : .tp_methods = py_winreg_QueryMultipleValues2_methods,
23134 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23135 : .tp_new = py_winreg_QueryMultipleValues2_new,
23136 : };
23137 :
23138 0 : static bool pack_py_winreg_QueryMultipleValues2_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryMultipleValues2 *r)
23139 : {
23140 : PyObject *py_key_handle;
23141 : PyObject *py_values_in;
23142 : PyObject *py_buffer;
23143 0 : const char *kwnames[] = {
23144 : "key_handle", "values_in", "buffer", NULL
23145 : };
23146 :
23147 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_QueryMultipleValues2", discard_const_p(char *, kwnames), &py_key_handle, &py_values_in, &py_buffer)) {
23148 0 : return false;
23149 : }
23150 :
23151 0 : if (py_key_handle == NULL) {
23152 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.key_handle");
23153 0 : return false;
23154 : }
23155 0 : r->in.key_handle = talloc_ptrtype(r, r->in.key_handle);
23156 0 : if (r->in.key_handle == NULL) {
23157 0 : PyErr_NoMemory();
23158 0 : return false;
23159 : }
23160 0 : PY_CHECK_TYPE(policy_handle_Type, py_key_handle, return false;);
23161 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key_handle)) == NULL) {
23162 0 : PyErr_NoMemory();
23163 0 : return false;
23164 : }
23165 0 : r->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(py_key_handle);
23166 0 : if (py_values_in == NULL) {
23167 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.values_in");
23168 0 : return false;
23169 : }
23170 0 : r->in.values_in = talloc_ptrtype(r, r->in.values_in);
23171 0 : if (r->in.values_in == NULL) {
23172 0 : PyErr_NoMemory();
23173 0 : return false;
23174 : }
23175 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
23176 : {
23177 : int values_in_cntr_1;
23178 0 : r->in.values_in = talloc_array_ptrtype(r, r->in.values_in, PyList_GET_SIZE(py_values_in));
23179 0 : if (!r->in.values_in) { return false; }
23180 0 : talloc_set_name_const(r->in.values_in, "ARRAY: r->in.values_in");
23181 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(py_values_in); values_in_cntr_1++) {
23182 0 : if (PyList_GET_ITEM(py_values_in, values_in_cntr_1) == NULL) {
23183 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.values_in)[values_in_cntr_1]");
23184 0 : return false;
23185 : }
23186 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(py_values_in, values_in_cntr_1), return false;);
23187 0 : if (talloc_reference(r->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(py_values_in, values_in_cntr_1))) == NULL) {
23188 0 : PyErr_NoMemory();
23189 0 : return false;
23190 : }
23191 0 : (r->in.values_in)[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(py_values_in, values_in_cntr_1));
23192 : }
23193 : }
23194 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
23195 0 : r->in.num_values = PyList_GET_SIZE(py_values_in);
23196 0 : if (py_buffer == NULL) {
23197 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.buffer");
23198 0 : return false;
23199 : }
23200 0 : if (py_buffer == Py_None) {
23201 0 : r->in.buffer = NULL;
23202 : } else {
23203 0 : r->in.buffer = NULL;
23204 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
23205 : {
23206 : int buffer_cntr_1;
23207 0 : r->in.buffer = talloc_array_ptrtype(r, r->in.buffer, PyList_GET_SIZE(py_buffer));
23208 0 : if (!r->in.buffer) { return false; }
23209 0 : talloc_set_name_const(r->in.buffer, "ARRAY: r->in.buffer");
23210 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(py_buffer); buffer_cntr_1++) {
23211 0 : if (PyList_GET_ITEM(py_buffer, buffer_cntr_1) == NULL) {
23212 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.buffer)[buffer_cntr_1]");
23213 0 : return false;
23214 : }
23215 : {
23216 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((r->in.buffer)[buffer_cntr_1]));
23217 0 : if (PyLong_Check(PyList_GET_ITEM(py_buffer, buffer_cntr_1))) {
23218 : unsigned long long test_var;
23219 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_buffer, buffer_cntr_1));
23220 0 : if (PyErr_Occurred() != NULL) {
23221 0 : return false;
23222 : }
23223 0 : if (test_var > uint_max) {
23224 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23225 : PyLong_Type.tp_name, uint_max, test_var);
23226 0 : return false;
23227 : }
23228 0 : (r->in.buffer)[buffer_cntr_1] = test_var;
23229 : } else {
23230 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23231 : PyLong_Type.tp_name);
23232 0 : return false;
23233 : }
23234 : }
23235 : }
23236 : }
23237 : }
23238 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
23239 0 : r->in.offered = talloc_ptrtype(r, r->in.offered);
23240 0 : if (r->in.offered == NULL) {
23241 0 : PyErr_NoMemory();
23242 0 : return false;
23243 : }
23244 0 : *r->in.offered = PyList_GET_SIZE(py_buffer);
23245 0 : return true;
23246 : }
23247 :
23248 0 : static PyObject *unpack_py_winreg_QueryMultipleValues2_args_out(struct winreg_QueryMultipleValues2 *r)
23249 : {
23250 : PyObject *result;
23251 : PyObject *py_values_out;
23252 : PyObject *py_buffer;
23253 : PyObject *py_needed;
23254 0 : result = PyTuple_New(3);
23255 0 : py_values_out = PyList_New(r->in.num_values);
23256 0 : if (py_values_out == NULL) {
23257 0 : return NULL;
23258 : }
23259 : {
23260 : int values_out_cntr_1;
23261 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (r->in.num_values); values_out_cntr_1++) {
23262 : PyObject *py_values_out_1;
23263 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, r->out.values_out, &(r->out.values_out)[values_out_cntr_1]);
23264 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
23265 : }
23266 : }
23267 0 : PyTuple_SetItem(result, 0, py_values_out);
23268 0 : if (r->out.buffer == NULL) {
23269 0 : py_buffer = Py_None;
23270 0 : Py_INCREF(py_buffer);
23271 : } else {
23272 0 : py_buffer = PyList_New(*r->in.offered);
23273 0 : if (py_buffer == NULL) {
23274 0 : return NULL;
23275 : }
23276 : {
23277 : int buffer_cntr_1;
23278 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*r->in.offered); buffer_cntr_1++) {
23279 : PyObject *py_buffer_1;
23280 0 : py_buffer_1 = PyLong_FromLong((uint16_t)((r->out.buffer)[buffer_cntr_1]));
23281 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
23282 : }
23283 : }
23284 : }
23285 0 : PyTuple_SetItem(result, 1, py_buffer);
23286 0 : py_needed = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.needed));
23287 0 : PyTuple_SetItem(result, 2, py_needed);
23288 0 : if (!W_ERROR_IS_OK(r->out.result)) {
23289 0 : PyErr_SetWERROR(r->out.result);
23290 0 : return NULL;
23291 : }
23292 :
23293 0 : return result;
23294 : }
23295 :
23296 :
23297 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_handle(PyObject *obj, void *closure)
23298 : {
23299 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(obj);
23300 : PyObject *py_handle;
23301 0 : if (object->in.handle == NULL) {
23302 0 : Py_RETURN_NONE;
23303 : }
23304 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
23305 0 : return py_handle;
23306 : }
23307 :
23308 0 : static int py_winreg_DeleteKeyEx_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
23309 : {
23310 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23311 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
23312 0 : if (value == NULL) {
23313 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.handle");
23314 0 : return -1;
23315 : }
23316 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
23317 0 : if (object->in.handle == NULL) {
23318 0 : PyErr_NoMemory();
23319 0 : return -1;
23320 : }
23321 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
23322 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
23323 0 : PyErr_NoMemory();
23324 0 : return -1;
23325 : }
23326 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
23327 0 : return 0;
23328 : }
23329 :
23330 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_key(PyObject *obj, void *closure)
23331 : {
23332 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(obj);
23333 : PyObject *py_key;
23334 0 : if (object->in.key == NULL) {
23335 0 : Py_RETURN_NONE;
23336 : }
23337 0 : py_key = pytalloc_reference_ex(&winreg_String_Type, object->in.key, object->in.key);
23338 0 : return py_key;
23339 : }
23340 :
23341 0 : static int py_winreg_DeleteKeyEx_in_set_key(PyObject *py_obj, PyObject *value, void *closure)
23342 : {
23343 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23344 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.key));
23345 0 : if (value == NULL) {
23346 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.key");
23347 0 : return -1;
23348 : }
23349 0 : object->in.key = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.key);
23350 0 : if (object->in.key == NULL) {
23351 0 : PyErr_NoMemory();
23352 0 : return -1;
23353 : }
23354 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
23355 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
23356 0 : PyErr_NoMemory();
23357 0 : return -1;
23358 : }
23359 0 : object->in.key = (struct winreg_String *)pytalloc_get_ptr(value);
23360 0 : return 0;
23361 : }
23362 :
23363 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_access_mask(PyObject *obj, void *closure)
23364 : {
23365 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(obj);
23366 : PyObject *py_access_mask;
23367 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)(object->in.access_mask));
23368 0 : return py_access_mask;
23369 : }
23370 :
23371 0 : static int py_winreg_DeleteKeyEx_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
23372 : {
23373 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23374 0 : if (value == NULL) {
23375 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.access_mask");
23376 0 : return -1;
23377 : }
23378 : {
23379 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
23380 0 : if (PyLong_Check(value)) {
23381 : unsigned long long test_var;
23382 0 : test_var = PyLong_AsUnsignedLongLong(value);
23383 0 : if (PyErr_Occurred() != NULL) {
23384 0 : return -1;
23385 : }
23386 0 : if (test_var > uint_max) {
23387 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23388 : PyLong_Type.tp_name, uint_max, test_var);
23389 0 : return -1;
23390 : }
23391 0 : object->in.access_mask = test_var;
23392 : } else {
23393 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23394 : PyLong_Type.tp_name);
23395 0 : return -1;
23396 : }
23397 : }
23398 0 : return 0;
23399 : }
23400 :
23401 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_reserved(PyObject *obj, void *closure)
23402 : {
23403 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(obj);
23404 : PyObject *py_reserved;
23405 0 : py_reserved = PyLong_FromUnsignedLongLong((uint32_t)(object->in.reserved));
23406 0 : return py_reserved;
23407 : }
23408 :
23409 0 : static int py_winreg_DeleteKeyEx_in_set_reserved(PyObject *py_obj, PyObject *value, void *closure)
23410 : {
23411 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23412 0 : if (value == NULL) {
23413 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.reserved");
23414 0 : return -1;
23415 : }
23416 : {
23417 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.reserved));
23418 0 : if (PyLong_Check(value)) {
23419 : unsigned long long test_var;
23420 0 : test_var = PyLong_AsUnsignedLongLong(value);
23421 0 : if (PyErr_Occurred() != NULL) {
23422 0 : return -1;
23423 : }
23424 0 : if (test_var > uint_max) {
23425 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23426 : PyLong_Type.tp_name, uint_max, test_var);
23427 0 : return -1;
23428 : }
23429 0 : object->in.reserved = test_var;
23430 : } else {
23431 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23432 : PyLong_Type.tp_name);
23433 0 : return -1;
23434 : }
23435 : }
23436 0 : return 0;
23437 : }
23438 :
23439 0 : static PyObject *py_winreg_DeleteKeyEx_get_result(PyObject *obj, void *closure)
23440 : {
23441 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(obj);
23442 : PyObject *py_result;
23443 0 : py_result = PyErr_FromWERROR(object->out.result);
23444 0 : return py_result;
23445 : }
23446 :
23447 0 : static int py_winreg_DeleteKeyEx_set_result(PyObject *py_obj, PyObject *value, void *closure)
23448 : {
23449 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23450 0 : if (value == NULL) {
23451 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
23452 0 : return -1;
23453 : }
23454 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
23455 0 : return 0;
23456 : }
23457 :
23458 : static PyGetSetDef py_winreg_DeleteKeyEx_getsetters[] = {
23459 : {
23460 : .name = discard_const_p(char, "in_handle"),
23461 : .get = py_winreg_DeleteKeyEx_in_get_handle,
23462 : .set = py_winreg_DeleteKeyEx_in_set_handle,
23463 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
23464 : },
23465 : {
23466 : .name = discard_const_p(char, "in_key"),
23467 : .get = py_winreg_DeleteKeyEx_in_get_key,
23468 : .set = py_winreg_DeleteKeyEx_in_set_key,
23469 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
23470 : },
23471 : {
23472 : .name = discard_const_p(char, "in_access_mask"),
23473 : .get = py_winreg_DeleteKeyEx_in_get_access_mask,
23474 : .set = py_winreg_DeleteKeyEx_in_set_access_mask,
23475 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
23476 : },
23477 : {
23478 : .name = discard_const_p(char, "in_reserved"),
23479 : .get = py_winreg_DeleteKeyEx_in_get_reserved,
23480 : .set = py_winreg_DeleteKeyEx_in_set_reserved,
23481 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
23482 : },
23483 : {
23484 : .name = discard_const_p(char, "result"),
23485 : .get = py_winreg_DeleteKeyEx_get_result,
23486 : .set = py_winreg_DeleteKeyEx_set_result,
23487 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
23488 : },
23489 : { .name = NULL }
23490 : };
23491 :
23492 0 : static PyObject *py_winreg_DeleteKeyEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23493 : {
23494 0 : PyObject *self = pytalloc_new(struct winreg_DeleteKeyEx, type);
23495 0 : struct winreg_DeleteKeyEx *_self = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(self);
23496 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
23497 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
23498 0 : _self->in.key = talloc_zero(mem_ctx, struct winreg_String);
23499 0 : return self;
23500 : }
23501 :
23502 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
23503 : {
23504 :
23505 :
23506 0 : return PyLong_FromLong(35);
23507 : }
23508 :
23509 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
23510 : {
23511 0 : const struct ndr_interface_call *call = NULL;
23512 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23513 0 : PyObject *ret = NULL;
23514 0 : struct ndr_push *push = NULL;
23515 : DATA_BLOB blob;
23516 : enum ndr_err_code err;
23517 :
23518 0 : if (ndr_table_winreg.num_calls < 36) {
23519 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKeyEx_ndr_pack");
23520 0 : return NULL;
23521 : }
23522 0 : call = &ndr_table_winreg.calls[35];
23523 :
23524 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
23525 0 : if (push == NULL) {
23526 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
23527 0 : return NULL;
23528 : }
23529 :
23530 0 : push->flags |= ndr_push_flags;
23531 :
23532 0 : err = call->ndr_push(push, ndr_inout_flags, object);
23533 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
23534 0 : TALLOC_FREE(push);
23535 0 : PyErr_SetNdrError(err);
23536 0 : return NULL;
23537 : }
23538 0 : blob = ndr_push_blob(push);
23539 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
23540 0 : TALLOC_FREE(push);
23541 0 : return ret;
23542 : }
23543 :
23544 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23545 : {
23546 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
23547 0 : PyObject *bigendian_obj = NULL;
23548 0 : PyObject *ndr64_obj = NULL;
23549 0 : libndr_flags ndr_push_flags = 0;
23550 :
23551 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
23552 : discard_const_p(char *, kwnames),
23553 : &bigendian_obj,
23554 : &ndr64_obj)) {
23555 0 : return NULL;
23556 : }
23557 :
23558 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23559 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
23560 : }
23561 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23562 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
23563 : }
23564 :
23565 0 : return py_winreg_DeleteKeyEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
23566 : }
23567 :
23568 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23569 : {
23570 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
23571 0 : PyObject *bigendian_obj = NULL;
23572 0 : PyObject *ndr64_obj = NULL;
23573 0 : libndr_flags ndr_push_flags = 0;
23574 :
23575 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
23576 : discard_const_p(char *, kwnames),
23577 : &bigendian_obj,
23578 : &ndr64_obj)) {
23579 0 : return NULL;
23580 : }
23581 :
23582 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23583 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
23584 : }
23585 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23586 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
23587 : }
23588 :
23589 0 : return py_winreg_DeleteKeyEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
23590 : }
23591 :
23592 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
23593 : {
23594 0 : const struct ndr_interface_call *call = NULL;
23595 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23596 0 : struct ndr_pull *pull = NULL;
23597 : enum ndr_err_code err;
23598 :
23599 0 : if (ndr_table_winreg.num_calls < 36) {
23600 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKeyEx_ndr_unpack");
23601 0 : return NULL;
23602 : }
23603 0 : call = &ndr_table_winreg.calls[35];
23604 :
23605 0 : pull = ndr_pull_init_blob(blob, object);
23606 0 : if (pull == NULL) {
23607 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
23608 0 : return NULL;
23609 : }
23610 :
23611 0 : pull->flags |= ndr_pull_flags;
23612 :
23613 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
23614 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
23615 0 : TALLOC_FREE(pull);
23616 0 : PyErr_SetNdrError(err);
23617 0 : return NULL;
23618 : }
23619 0 : if (!allow_remaining) {
23620 : uint32_t highest_ofs;
23621 :
23622 0 : if (pull->offset > pull->relative_highest_offset) {
23623 0 : highest_ofs = pull->offset;
23624 : } else {
23625 0 : highest_ofs = pull->relative_highest_offset;
23626 : }
23627 0 : if (highest_ofs < pull->data_size) {
23628 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
23629 : "not all bytes consumed ofs[%u] size[%u]",
23630 : highest_ofs, pull->data_size);
23631 0 : TALLOC_FREE(pull);
23632 0 : PyErr_SetNdrError(err);
23633 0 : return NULL;
23634 : }
23635 : }
23636 :
23637 0 : TALLOC_FREE(pull);
23638 0 : Py_RETURN_NONE;
23639 : }
23640 :
23641 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23642 : {
23643 : DATA_BLOB blob;
23644 0 : Py_ssize_t blob_length = 0;
23645 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23646 0 : PyObject *bigendian_obj = NULL;
23647 0 : PyObject *ndr64_obj = NULL;
23648 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23649 0 : PyObject *allow_remaining_obj = NULL;
23650 0 : bool allow_remaining = false;
23651 :
23652 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
23653 : discard_const_p(char *, kwnames),
23654 : &blob.data, &blob_length,
23655 : &bigendian_obj,
23656 : &ndr64_obj,
23657 : &allow_remaining_obj)) {
23658 0 : return NULL;
23659 : }
23660 0 : blob.length = blob_length;
23661 :
23662 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23663 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23664 : }
23665 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23666 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23667 : }
23668 :
23669 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23670 0 : allow_remaining = true;
23671 : }
23672 :
23673 0 : return py_winreg_DeleteKeyEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
23674 : }
23675 :
23676 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23677 : {
23678 : DATA_BLOB blob;
23679 0 : Py_ssize_t blob_length = 0;
23680 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23681 0 : PyObject *bigendian_obj = NULL;
23682 0 : PyObject *ndr64_obj = NULL;
23683 0 : libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23684 0 : PyObject *allow_remaining_obj = NULL;
23685 0 : bool allow_remaining = false;
23686 :
23687 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
23688 : discard_const_p(char *, kwnames),
23689 : &blob.data, &blob_length,
23690 : &bigendian_obj,
23691 : &ndr64_obj,
23692 : &allow_remaining_obj)) {
23693 0 : return NULL;
23694 : }
23695 0 : blob.length = blob_length;
23696 :
23697 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23698 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23699 : }
23700 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23701 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23702 : }
23703 :
23704 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23705 0 : allow_remaining = true;
23706 : }
23707 :
23708 0 : return py_winreg_DeleteKeyEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
23709 : }
23710 :
23711 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
23712 : {
23713 0 : const struct ndr_interface_call *call = NULL;
23714 0 : struct winreg_DeleteKeyEx *object = pytalloc_get_ptr(py_obj);
23715 : PyObject *ret;
23716 : char *retstr;
23717 :
23718 0 : if (ndr_table_winreg.num_calls < 36) {
23719 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKeyEx_ndr_print");
23720 0 : return NULL;
23721 : }
23722 0 : call = &ndr_table_winreg.calls[35];
23723 :
23724 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
23725 0 : ret = PyUnicode_FromString(retstr);
23726 0 : TALLOC_FREE(retstr);
23727 :
23728 0 : return ret;
23729 : }
23730 :
23731 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23732 : {
23733 0 : return py_winreg_DeleteKeyEx_ndr_print(py_obj, "winreg_DeleteKeyEx_in", NDR_IN);
23734 : }
23735 :
23736 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23737 : {
23738 0 : return py_winreg_DeleteKeyEx_ndr_print(py_obj, "winreg_DeleteKeyEx_out", NDR_OUT);
23739 : }
23740 :
23741 : static PyMethodDef py_winreg_DeleteKeyEx_methods[] = {
23742 : { "opnum", (PyCFunction)py_winreg_DeleteKeyEx_ndr_opnum, METH_NOARGS|METH_CLASS,
23743 : "winreg.DeleteKeyEx.opnum() -> 35 (0x23) " },
23744 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
23745 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
23746 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
23747 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
23748 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
23749 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
23750 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
23751 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
23752 : { "__ndr_print_in__", (PyCFunction)py_winreg_DeleteKeyEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
23753 : { "__ndr_print_out__", (PyCFunction)py_winreg_DeleteKeyEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
23754 : { NULL, NULL, 0, NULL }
23755 : };
23756 :
23757 :
23758 : static PyTypeObject winreg_DeleteKeyEx_Type = {
23759 : PyVarObject_HEAD_INIT(NULL, 0)
23760 : .tp_name = "winreg.DeleteKeyEx",
23761 : .tp_getset = py_winreg_DeleteKeyEx_getsetters,
23762 : .tp_methods = py_winreg_DeleteKeyEx_methods,
23763 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23764 : .tp_new = py_winreg_DeleteKeyEx_new,
23765 : };
23766 :
23767 0 : static bool pack_py_winreg_DeleteKeyEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteKeyEx *r)
23768 : {
23769 : PyObject *py_handle;
23770 : PyObject *py_key;
23771 : PyObject *py_access_mask;
23772 : PyObject *py_reserved;
23773 0 : const char *kwnames[] = {
23774 : "handle", "key", "access_mask", "reserved", NULL
23775 : };
23776 :
23777 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_DeleteKeyEx", discard_const_p(char *, kwnames), &py_handle, &py_key, &py_access_mask, &py_reserved)) {
23778 0 : return false;
23779 : }
23780 :
23781 0 : if (py_handle == NULL) {
23782 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.handle");
23783 0 : return false;
23784 : }
23785 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
23786 0 : if (r->in.handle == NULL) {
23787 0 : PyErr_NoMemory();
23788 0 : return false;
23789 : }
23790 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
23791 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
23792 0 : PyErr_NoMemory();
23793 0 : return false;
23794 : }
23795 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
23796 0 : if (py_key == NULL) {
23797 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.key");
23798 0 : return false;
23799 : }
23800 0 : r->in.key = talloc_ptrtype(r, r->in.key);
23801 0 : if (r->in.key == NULL) {
23802 0 : PyErr_NoMemory();
23803 0 : return false;
23804 : }
23805 0 : PY_CHECK_TYPE(&winreg_String_Type, py_key, return false;);
23806 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key)) == NULL) {
23807 0 : PyErr_NoMemory();
23808 0 : return false;
23809 : }
23810 0 : r->in.key = (struct winreg_String *)pytalloc_get_ptr(py_key);
23811 0 : if (py_access_mask == NULL) {
23812 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.access_mask");
23813 0 : return false;
23814 : }
23815 : {
23816 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
23817 0 : if (PyLong_Check(py_access_mask)) {
23818 : unsigned long long test_var;
23819 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
23820 0 : if (PyErr_Occurred() != NULL) {
23821 0 : return false;
23822 : }
23823 0 : if (test_var > uint_max) {
23824 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23825 : PyLong_Type.tp_name, uint_max, test_var);
23826 0 : return false;
23827 : }
23828 0 : r->in.access_mask = test_var;
23829 : } else {
23830 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23831 : PyLong_Type.tp_name);
23832 0 : return false;
23833 : }
23834 : }
23835 0 : if (py_reserved == NULL) {
23836 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.reserved");
23837 0 : return false;
23838 : }
23839 : {
23840 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.reserved));
23841 0 : if (PyLong_Check(py_reserved)) {
23842 : unsigned long long test_var;
23843 0 : test_var = PyLong_AsUnsignedLongLong(py_reserved);
23844 0 : if (PyErr_Occurred() != NULL) {
23845 0 : return false;
23846 : }
23847 0 : if (test_var > uint_max) {
23848 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23849 : PyLong_Type.tp_name, uint_max, test_var);
23850 0 : return false;
23851 : }
23852 0 : r->in.reserved = test_var;
23853 : } else {
23854 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23855 : PyLong_Type.tp_name);
23856 0 : return false;
23857 : }
23858 : }
23859 0 : return true;
23860 : }
23861 :
23862 0 : static PyObject *unpack_py_winreg_DeleteKeyEx_args_out(struct winreg_DeleteKeyEx *r)
23863 : {
23864 : PyObject *result;
23865 0 : result = Py_None;
23866 0 : Py_INCREF(result);
23867 0 : if (!W_ERROR_IS_OK(r->out.result)) {
23868 0 : PyErr_SetWERROR(r->out.result);
23869 0 : return NULL;
23870 : }
23871 :
23872 0 : return result;
23873 : }
23874 :
23875 : const struct PyNdrRpcMethodDef py_ndr_winreg_methods[] = {
23876 : { "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 },
23877 : { "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 },
23878 : { "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 },
23879 : { "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 },
23880 : { "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 },
23881 : { "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 },
23882 : { "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 },
23883 : { "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 },
23884 : { "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 },
23885 : { "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 },
23886 : { "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 },
23887 : { "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 },
23888 : { "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 },
23889 : { "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 },
23890 : { "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 },
23891 : { "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 },
23892 : { "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 },
23893 : { "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 },
23894 : { "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 },
23895 : { "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 },
23896 : { "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 },
23897 : { "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 },
23898 : { "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 },
23899 : { "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 },
23900 : { "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 },
23901 : { "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 },
23902 : { "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 },
23903 : { "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 },
23904 : { "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 },
23905 : { "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 },
23906 : { "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 },
23907 : { "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 },
23908 : { "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 },
23909 : { "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 },
23910 : { "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 },
23911 : { "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 },
23912 : {0}
23913 : };
23914 :
23915 3 : static PyObject *interface_winreg_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23916 : {
23917 3 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_winreg);
23918 : }
23919 :
23920 : #define PY_DOC_WINREG "Remote Registry Service"
23921 : static PyTypeObject winreg_InterfaceType = {
23922 : PyVarObject_HEAD_INIT(NULL, 0)
23923 : .tp_name = "winreg.winreg",
23924 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
23925 : .tp_doc = "winreg(binding, lp_ctx=None, credentials=None) -> connection\n"
23926 : "\n"
23927 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
23928 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
23929 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_WINREG,
23930 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23931 : .tp_new = interface_winreg_new,
23932 : };
23933 :
23934 0 : static PyObject *syntax_winreg_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23935 : {
23936 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_winreg.syntax_id);
23937 : }
23938 :
23939 : #define PY_DOC_WINREG_SYNTAX "Remote Registry Service"
23940 : static PyTypeObject winreg_SyntaxType = {
23941 : PyVarObject_HEAD_INIT(NULL, 0)
23942 : .tp_name = "winreg.winreg_abstract_syntax",
23943 : .tp_doc = "winreg_abstract_syntax()\n"PY_DOC_WINREG_SYNTAX,
23944 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23945 : .tp_new = syntax_winreg_new,
23946 : };
23947 :
23948 : static PyMethodDef winreg_methods[] = {
23949 : { NULL, NULL, 0, NULL }
23950 : };
23951 :
23952 : static struct PyModuleDef moduledef = {
23953 : PyModuleDef_HEAD_INIT,
23954 : .m_name = "winreg",
23955 : .m_doc = "winreg DCE/RPC",
23956 : .m_size = -1,
23957 : .m_methods = winreg_methods,
23958 : };
23959 1 : MODULE_INIT_FUNC(winreg)
23960 : {
23961 1 : PyObject *m = NULL;
23962 1 : PyObject *dep_samba_dcerpc_lsa = NULL;
23963 1 : PyObject *dep_samba_dcerpc_security = NULL;
23964 1 : PyObject *dep_samba_dcerpc_misc = NULL;
23965 1 : PyObject *dep_talloc = NULL;
23966 1 : PyObject *dep_samba_dcerpc_base = NULL;
23967 :
23968 1 : dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
23969 1 : if (dep_samba_dcerpc_lsa == NULL)
23970 0 : goto out;
23971 :
23972 1 : dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
23973 1 : if (dep_samba_dcerpc_security == NULL)
23974 0 : goto out;
23975 :
23976 1 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
23977 1 : if (dep_samba_dcerpc_misc == NULL)
23978 0 : goto out;
23979 :
23980 1 : dep_talloc = PyImport_ImportModule("talloc");
23981 1 : if (dep_talloc == NULL)
23982 0 : goto out;
23983 :
23984 1 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
23985 1 : if (dep_samba_dcerpc_base == NULL)
23986 0 : goto out;
23987 :
23988 1 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
23989 1 : if (BaseObject_Type == NULL)
23990 0 : goto out;
23991 :
23992 1 : policy_handle_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "policy_handle");
23993 1 : if (policy_handle_Type == NULL)
23994 0 : goto out;
23995 :
23996 1 : lsa_StringLarge_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "StringLarge");
23997 1 : if (lsa_StringLarge_Type == NULL)
23998 0 : goto out;
23999 :
24000 1 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
24001 1 : if (ClientConnection_Type == NULL)
24002 0 : goto out;
24003 :
24004 1 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
24005 1 : if (ndr_syntax_id_Type == NULL)
24006 0 : goto out;
24007 :
24008 1 : winreg_String_Type.tp_base = BaseObject_Type;
24009 1 : winreg_String_Type.tp_basicsize = pytalloc_BaseObject_size();
24010 :
24011 1 : KeySecurityData_Type.tp_base = BaseObject_Type;
24012 1 : KeySecurityData_Type.tp_basicsize = pytalloc_BaseObject_size();
24013 :
24014 1 : winreg_SecBuf_Type.tp_base = BaseObject_Type;
24015 1 : winreg_SecBuf_Type.tp_basicsize = pytalloc_BaseObject_size();
24016 :
24017 1 : winreg_StringBuf_Type.tp_base = BaseObject_Type;
24018 1 : winreg_StringBuf_Type.tp_basicsize = pytalloc_BaseObject_size();
24019 :
24020 1 : winreg_ValNameBuf_Type.tp_base = BaseObject_Type;
24021 1 : winreg_ValNameBuf_Type.tp_basicsize = pytalloc_BaseObject_size();
24022 :
24023 1 : KeySecurityAttribute_Type.tp_base = BaseObject_Type;
24024 1 : KeySecurityAttribute_Type.tp_basicsize = pytalloc_BaseObject_size();
24025 :
24026 1 : QueryMultipleValue_Type.tp_base = BaseObject_Type;
24027 1 : QueryMultipleValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24028 :
24029 1 : winreg_OpenHKCR_Type.tp_base = BaseObject_Type;
24030 1 : winreg_OpenHKCR_Type.tp_basicsize = pytalloc_BaseObject_size();
24031 :
24032 1 : winreg_OpenHKCU_Type.tp_base = BaseObject_Type;
24033 1 : winreg_OpenHKCU_Type.tp_basicsize = pytalloc_BaseObject_size();
24034 :
24035 1 : winreg_OpenHKLM_Type.tp_base = BaseObject_Type;
24036 1 : winreg_OpenHKLM_Type.tp_basicsize = pytalloc_BaseObject_size();
24037 :
24038 1 : winreg_OpenHKPD_Type.tp_base = BaseObject_Type;
24039 1 : winreg_OpenHKPD_Type.tp_basicsize = pytalloc_BaseObject_size();
24040 :
24041 1 : winreg_OpenHKU_Type.tp_base = BaseObject_Type;
24042 1 : winreg_OpenHKU_Type.tp_basicsize = pytalloc_BaseObject_size();
24043 :
24044 1 : winreg_CloseKey_Type.tp_base = BaseObject_Type;
24045 1 : winreg_CloseKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24046 :
24047 1 : winreg_CreateKey_Type.tp_base = BaseObject_Type;
24048 1 : winreg_CreateKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24049 :
24050 1 : winreg_DeleteKey_Type.tp_base = BaseObject_Type;
24051 1 : winreg_DeleteKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24052 :
24053 1 : winreg_DeleteValue_Type.tp_base = BaseObject_Type;
24054 1 : winreg_DeleteValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24055 :
24056 1 : winreg_EnumKey_Type.tp_base = BaseObject_Type;
24057 1 : winreg_EnumKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24058 :
24059 1 : winreg_EnumValue_Type.tp_base = BaseObject_Type;
24060 1 : winreg_EnumValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24061 :
24062 1 : winreg_FlushKey_Type.tp_base = BaseObject_Type;
24063 1 : winreg_FlushKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24064 :
24065 1 : winreg_GetKeySecurity_Type.tp_base = BaseObject_Type;
24066 1 : winreg_GetKeySecurity_Type.tp_basicsize = pytalloc_BaseObject_size();
24067 :
24068 1 : winreg_LoadKey_Type.tp_base = BaseObject_Type;
24069 1 : winreg_LoadKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24070 :
24071 1 : winreg_NotifyChangeKeyValue_Type.tp_base = BaseObject_Type;
24072 1 : winreg_NotifyChangeKeyValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24073 :
24074 1 : winreg_OpenKey_Type.tp_base = BaseObject_Type;
24075 1 : winreg_OpenKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24076 :
24077 1 : winreg_QueryInfoKey_Type.tp_base = BaseObject_Type;
24078 1 : winreg_QueryInfoKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24079 :
24080 1 : winreg_QueryValue_Type.tp_base = BaseObject_Type;
24081 1 : winreg_QueryValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24082 :
24083 1 : winreg_ReplaceKey_Type.tp_base = BaseObject_Type;
24084 1 : winreg_ReplaceKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24085 :
24086 1 : winreg_RestoreKey_Type.tp_base = BaseObject_Type;
24087 1 : winreg_RestoreKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24088 :
24089 1 : winreg_SaveKey_Type.tp_base = BaseObject_Type;
24090 1 : winreg_SaveKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24091 :
24092 1 : winreg_SetKeySecurity_Type.tp_base = BaseObject_Type;
24093 1 : winreg_SetKeySecurity_Type.tp_basicsize = pytalloc_BaseObject_size();
24094 :
24095 1 : winreg_SetValue_Type.tp_base = BaseObject_Type;
24096 1 : winreg_SetValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24097 :
24098 1 : winreg_UnLoadKey_Type.tp_base = BaseObject_Type;
24099 1 : winreg_UnLoadKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24100 :
24101 1 : winreg_InitiateSystemShutdown_Type.tp_base = BaseObject_Type;
24102 1 : winreg_InitiateSystemShutdown_Type.tp_basicsize = pytalloc_BaseObject_size();
24103 :
24104 1 : winreg_AbortSystemShutdown_Type.tp_base = BaseObject_Type;
24105 1 : winreg_AbortSystemShutdown_Type.tp_basicsize = pytalloc_BaseObject_size();
24106 :
24107 1 : winreg_GetVersion_Type.tp_base = BaseObject_Type;
24108 1 : winreg_GetVersion_Type.tp_basicsize = pytalloc_BaseObject_size();
24109 :
24110 1 : winreg_OpenHKCC_Type.tp_base = BaseObject_Type;
24111 1 : winreg_OpenHKCC_Type.tp_basicsize = pytalloc_BaseObject_size();
24112 :
24113 1 : winreg_OpenHKDD_Type.tp_base = BaseObject_Type;
24114 1 : winreg_OpenHKDD_Type.tp_basicsize = pytalloc_BaseObject_size();
24115 :
24116 1 : winreg_QueryMultipleValues_Type.tp_base = BaseObject_Type;
24117 1 : winreg_QueryMultipleValues_Type.tp_basicsize = pytalloc_BaseObject_size();
24118 :
24119 1 : winreg_InitiateSystemShutdownEx_Type.tp_base = BaseObject_Type;
24120 1 : winreg_InitiateSystemShutdownEx_Type.tp_basicsize = pytalloc_BaseObject_size();
24121 :
24122 1 : winreg_SaveKeyEx_Type.tp_base = BaseObject_Type;
24123 1 : winreg_SaveKeyEx_Type.tp_basicsize = pytalloc_BaseObject_size();
24124 :
24125 1 : winreg_OpenHKPT_Type.tp_base = BaseObject_Type;
24126 1 : winreg_OpenHKPT_Type.tp_basicsize = pytalloc_BaseObject_size();
24127 :
24128 1 : winreg_OpenHKPN_Type.tp_base = BaseObject_Type;
24129 1 : winreg_OpenHKPN_Type.tp_basicsize = pytalloc_BaseObject_size();
24130 :
24131 1 : winreg_QueryMultipleValues2_Type.tp_base = BaseObject_Type;
24132 1 : winreg_QueryMultipleValues2_Type.tp_basicsize = pytalloc_BaseObject_size();
24133 :
24134 1 : winreg_DeleteKeyEx_Type.tp_base = BaseObject_Type;
24135 1 : winreg_DeleteKeyEx_Type.tp_basicsize = pytalloc_BaseObject_size();
24136 :
24137 1 : winreg_InterfaceType.tp_base = ClientConnection_Type;
24138 :
24139 1 : winreg_SyntaxType.tp_base = ndr_syntax_id_Type;
24140 1 : winreg_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
24141 :
24142 1 : if (PyType_Ready(&winreg_String_Type) < 0)
24143 0 : goto out;
24144 1 : if (PyType_Ready(&KeySecurityData_Type) < 0)
24145 0 : goto out;
24146 1 : if (PyType_Ready(&winreg_SecBuf_Type) < 0)
24147 0 : goto out;
24148 1 : if (PyType_Ready(&winreg_StringBuf_Type) < 0)
24149 0 : goto out;
24150 1 : if (PyType_Ready(&winreg_ValNameBuf_Type) < 0)
24151 0 : goto out;
24152 1 : if (PyType_Ready(&KeySecurityAttribute_Type) < 0)
24153 0 : goto out;
24154 1 : if (PyType_Ready(&QueryMultipleValue_Type) < 0)
24155 0 : goto out;
24156 1 : if (PyType_Ready(&winreg_OpenHKCR_Type) < 0)
24157 0 : goto out;
24158 1 : if (PyType_Ready(&winreg_OpenHKCU_Type) < 0)
24159 0 : goto out;
24160 1 : if (PyType_Ready(&winreg_OpenHKLM_Type) < 0)
24161 0 : goto out;
24162 1 : if (PyType_Ready(&winreg_OpenHKPD_Type) < 0)
24163 0 : goto out;
24164 1 : if (PyType_Ready(&winreg_OpenHKU_Type) < 0)
24165 0 : goto out;
24166 1 : if (PyType_Ready(&winreg_CloseKey_Type) < 0)
24167 0 : goto out;
24168 1 : if (PyType_Ready(&winreg_CreateKey_Type) < 0)
24169 0 : goto out;
24170 1 : if (PyType_Ready(&winreg_DeleteKey_Type) < 0)
24171 0 : goto out;
24172 1 : if (PyType_Ready(&winreg_DeleteValue_Type) < 0)
24173 0 : goto out;
24174 1 : if (PyType_Ready(&winreg_EnumKey_Type) < 0)
24175 0 : goto out;
24176 1 : if (PyType_Ready(&winreg_EnumValue_Type) < 0)
24177 0 : goto out;
24178 1 : if (PyType_Ready(&winreg_FlushKey_Type) < 0)
24179 0 : goto out;
24180 1 : if (PyType_Ready(&winreg_GetKeySecurity_Type) < 0)
24181 0 : goto out;
24182 1 : if (PyType_Ready(&winreg_LoadKey_Type) < 0)
24183 0 : goto out;
24184 1 : if (PyType_Ready(&winreg_NotifyChangeKeyValue_Type) < 0)
24185 0 : goto out;
24186 1 : if (PyType_Ready(&winreg_OpenKey_Type) < 0)
24187 0 : goto out;
24188 1 : if (PyType_Ready(&winreg_QueryInfoKey_Type) < 0)
24189 0 : goto out;
24190 1 : if (PyType_Ready(&winreg_QueryValue_Type) < 0)
24191 0 : goto out;
24192 1 : if (PyType_Ready(&winreg_ReplaceKey_Type) < 0)
24193 0 : goto out;
24194 1 : if (PyType_Ready(&winreg_RestoreKey_Type) < 0)
24195 0 : goto out;
24196 1 : if (PyType_Ready(&winreg_SaveKey_Type) < 0)
24197 0 : goto out;
24198 1 : if (PyType_Ready(&winreg_SetKeySecurity_Type) < 0)
24199 0 : goto out;
24200 1 : if (PyType_Ready(&winreg_SetValue_Type) < 0)
24201 0 : goto out;
24202 1 : if (PyType_Ready(&winreg_UnLoadKey_Type) < 0)
24203 0 : goto out;
24204 1 : if (PyType_Ready(&winreg_InitiateSystemShutdown_Type) < 0)
24205 0 : goto out;
24206 1 : if (PyType_Ready(&winreg_AbortSystemShutdown_Type) < 0)
24207 0 : goto out;
24208 1 : if (PyType_Ready(&winreg_GetVersion_Type) < 0)
24209 0 : goto out;
24210 1 : if (PyType_Ready(&winreg_OpenHKCC_Type) < 0)
24211 0 : goto out;
24212 1 : if (PyType_Ready(&winreg_OpenHKDD_Type) < 0)
24213 0 : goto out;
24214 1 : if (PyType_Ready(&winreg_QueryMultipleValues_Type) < 0)
24215 0 : goto out;
24216 1 : if (PyType_Ready(&winreg_InitiateSystemShutdownEx_Type) < 0)
24217 0 : goto out;
24218 1 : if (PyType_Ready(&winreg_SaveKeyEx_Type) < 0)
24219 0 : goto out;
24220 1 : if (PyType_Ready(&winreg_OpenHKPT_Type) < 0)
24221 0 : goto out;
24222 1 : if (PyType_Ready(&winreg_OpenHKPN_Type) < 0)
24223 0 : goto out;
24224 1 : if (PyType_Ready(&winreg_QueryMultipleValues2_Type) < 0)
24225 0 : goto out;
24226 1 : if (PyType_Ready(&winreg_DeleteKeyEx_Type) < 0)
24227 0 : goto out;
24228 1 : if (PyType_Ready(&winreg_InterfaceType) < 0)
24229 0 : goto out;
24230 1 : if (PyType_Ready(&winreg_SyntaxType) < 0)
24231 0 : goto out;
24232 1 : if (!PyInterface_AddNdrRpcMethods(&winreg_InterfaceType, py_ndr_winreg_methods))
24233 0 : return NULL;
24234 :
24235 : #ifdef PY_STRING_PATCH
24236 : PY_STRING_PATCH(&winreg_String_Type);
24237 : #endif
24238 : #ifdef PY_KEYSECURITYDATA_PATCH
24239 : PY_KEYSECURITYDATA_PATCH(&KeySecurityData_Type);
24240 : #endif
24241 : #ifdef PY_SECBUF_PATCH
24242 : PY_SECBUF_PATCH(&winreg_SecBuf_Type);
24243 : #endif
24244 : #ifdef PY_STRINGBUF_PATCH
24245 : PY_STRINGBUF_PATCH(&winreg_StringBuf_Type);
24246 : #endif
24247 : #ifdef PY_VALNAMEBUF_PATCH
24248 : PY_VALNAMEBUF_PATCH(&winreg_ValNameBuf_Type);
24249 : #endif
24250 : #ifdef PY_KEYSECURITYATTRIBUTE_PATCH
24251 : PY_KEYSECURITYATTRIBUTE_PATCH(&KeySecurityAttribute_Type);
24252 : #endif
24253 : #ifdef PY_QUERYMULTIPLEVALUE_PATCH
24254 : PY_QUERYMULTIPLEVALUE_PATCH(&QueryMultipleValue_Type);
24255 : #endif
24256 : #ifdef PY_OPENHKCR_PATCH
24257 : PY_OPENHKCR_PATCH(&winreg_OpenHKCR_Type);
24258 : #endif
24259 : #ifdef PY_OPENHKCU_PATCH
24260 : PY_OPENHKCU_PATCH(&winreg_OpenHKCU_Type);
24261 : #endif
24262 : #ifdef PY_OPENHKLM_PATCH
24263 : PY_OPENHKLM_PATCH(&winreg_OpenHKLM_Type);
24264 : #endif
24265 : #ifdef PY_OPENHKPD_PATCH
24266 : PY_OPENHKPD_PATCH(&winreg_OpenHKPD_Type);
24267 : #endif
24268 : #ifdef PY_OPENHKU_PATCH
24269 : PY_OPENHKU_PATCH(&winreg_OpenHKU_Type);
24270 : #endif
24271 : #ifdef PY_CLOSEKEY_PATCH
24272 : PY_CLOSEKEY_PATCH(&winreg_CloseKey_Type);
24273 : #endif
24274 : #ifdef PY_CREATEKEY_PATCH
24275 : PY_CREATEKEY_PATCH(&winreg_CreateKey_Type);
24276 : #endif
24277 : #ifdef PY_DELETEKEY_PATCH
24278 : PY_DELETEKEY_PATCH(&winreg_DeleteKey_Type);
24279 : #endif
24280 : #ifdef PY_DELETEVALUE_PATCH
24281 : PY_DELETEVALUE_PATCH(&winreg_DeleteValue_Type);
24282 : #endif
24283 : #ifdef PY_ENUMKEY_PATCH
24284 : PY_ENUMKEY_PATCH(&winreg_EnumKey_Type);
24285 : #endif
24286 : #ifdef PY_ENUMVALUE_PATCH
24287 : PY_ENUMVALUE_PATCH(&winreg_EnumValue_Type);
24288 : #endif
24289 : #ifdef PY_FLUSHKEY_PATCH
24290 : PY_FLUSHKEY_PATCH(&winreg_FlushKey_Type);
24291 : #endif
24292 : #ifdef PY_GETKEYSECURITY_PATCH
24293 : PY_GETKEYSECURITY_PATCH(&winreg_GetKeySecurity_Type);
24294 : #endif
24295 : #ifdef PY_LOADKEY_PATCH
24296 : PY_LOADKEY_PATCH(&winreg_LoadKey_Type);
24297 : #endif
24298 : #ifdef PY_NOTIFYCHANGEKEYVALUE_PATCH
24299 : PY_NOTIFYCHANGEKEYVALUE_PATCH(&winreg_NotifyChangeKeyValue_Type);
24300 : #endif
24301 : #ifdef PY_OPENKEY_PATCH
24302 : PY_OPENKEY_PATCH(&winreg_OpenKey_Type);
24303 : #endif
24304 : #ifdef PY_QUERYINFOKEY_PATCH
24305 : PY_QUERYINFOKEY_PATCH(&winreg_QueryInfoKey_Type);
24306 : #endif
24307 : #ifdef PY_QUERYVALUE_PATCH
24308 : PY_QUERYVALUE_PATCH(&winreg_QueryValue_Type);
24309 : #endif
24310 : #ifdef PY_REPLACEKEY_PATCH
24311 : PY_REPLACEKEY_PATCH(&winreg_ReplaceKey_Type);
24312 : #endif
24313 : #ifdef PY_RESTOREKEY_PATCH
24314 : PY_RESTOREKEY_PATCH(&winreg_RestoreKey_Type);
24315 : #endif
24316 : #ifdef PY_SAVEKEY_PATCH
24317 : PY_SAVEKEY_PATCH(&winreg_SaveKey_Type);
24318 : #endif
24319 : #ifdef PY_SETKEYSECURITY_PATCH
24320 : PY_SETKEYSECURITY_PATCH(&winreg_SetKeySecurity_Type);
24321 : #endif
24322 : #ifdef PY_SETVALUE_PATCH
24323 : PY_SETVALUE_PATCH(&winreg_SetValue_Type);
24324 : #endif
24325 : #ifdef PY_UNLOADKEY_PATCH
24326 : PY_UNLOADKEY_PATCH(&winreg_UnLoadKey_Type);
24327 : #endif
24328 : #ifdef PY_INITIATESYSTEMSHUTDOWN_PATCH
24329 : PY_INITIATESYSTEMSHUTDOWN_PATCH(&winreg_InitiateSystemShutdown_Type);
24330 : #endif
24331 : #ifdef PY_ABORTSYSTEMSHUTDOWN_PATCH
24332 : PY_ABORTSYSTEMSHUTDOWN_PATCH(&winreg_AbortSystemShutdown_Type);
24333 : #endif
24334 : #ifdef PY_GETVERSION_PATCH
24335 : PY_GETVERSION_PATCH(&winreg_GetVersion_Type);
24336 : #endif
24337 : #ifdef PY_OPENHKCC_PATCH
24338 : PY_OPENHKCC_PATCH(&winreg_OpenHKCC_Type);
24339 : #endif
24340 : #ifdef PY_OPENHKDD_PATCH
24341 : PY_OPENHKDD_PATCH(&winreg_OpenHKDD_Type);
24342 : #endif
24343 : #ifdef PY_QUERYMULTIPLEVALUES_PATCH
24344 : PY_QUERYMULTIPLEVALUES_PATCH(&winreg_QueryMultipleValues_Type);
24345 : #endif
24346 : #ifdef PY_INITIATESYSTEMSHUTDOWNEX_PATCH
24347 : PY_INITIATESYSTEMSHUTDOWNEX_PATCH(&winreg_InitiateSystemShutdownEx_Type);
24348 : #endif
24349 : #ifdef PY_SAVEKEYEX_PATCH
24350 : PY_SAVEKEYEX_PATCH(&winreg_SaveKeyEx_Type);
24351 : #endif
24352 : #ifdef PY_OPENHKPT_PATCH
24353 : PY_OPENHKPT_PATCH(&winreg_OpenHKPT_Type);
24354 : #endif
24355 : #ifdef PY_OPENHKPN_PATCH
24356 : PY_OPENHKPN_PATCH(&winreg_OpenHKPN_Type);
24357 : #endif
24358 : #ifdef PY_QUERYMULTIPLEVALUES2_PATCH
24359 : PY_QUERYMULTIPLEVALUES2_PATCH(&winreg_QueryMultipleValues2_Type);
24360 : #endif
24361 : #ifdef PY_DELETEKEYEX_PATCH
24362 : PY_DELETEKEYEX_PATCH(&winreg_DeleteKeyEx_Type);
24363 : #endif
24364 : #ifdef PY_WINREG_PATCH
24365 : PY_WINREG_PATCH(&winreg_InterfaceType);
24366 : #endif
24367 : #ifdef PY_WINREG_ABSTRACT_SYNTAX_PATCH
24368 : PY_WINREG_ABSTRACT_SYNTAX_PATCH(&winreg_SyntaxType);
24369 : #endif
24370 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
24371 : PY_ABSTRACT_SYNTAX_PATCH(&winreg_SyntaxType);
24372 : #endif
24373 :
24374 1 : m = PyModule_Create(&moduledef);
24375 1 : if (m == NULL)
24376 0 : goto out;
24377 :
24378 1 : PyModule_AddObject(m, "REG_KEY_READ", PyLong_FromLong((STANDARD_RIGHTS_READ_ACCESS|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|KEY_NOTIFY)));
24379 1 : PyModule_AddObject(m, "REG_KEY_EXECUTE", PyLong_FromLong(REG_KEY_READ));
24380 1 : PyModule_AddObject(m, "REG_KEY_WRITE", PyLong_FromLong((STANDARD_RIGHTS_WRITE_ACCESS|KEY_SET_VALUE|KEY_CREATE_SUB_KEY)));
24381 1 : PyModule_AddObject(m, "REG_KEY_ALL", PyLong_FromLong((STANDARD_RIGHTS_REQUIRED_ACCESS|REG_KEY_READ|REG_KEY_WRITE|KEY_CREATE_LINK)));
24382 1 : PyModule_AddObject(m, "REG_OPTION_NON_VOLATILE", PyLong_FromUnsignedLongLong(0x00000000));
24383 1 : PyModule_AddObject(m, "KEY_QUERY_VALUE", PyLong_FromUnsignedLongLong((uint32_t)(KEY_QUERY_VALUE)));
24384 1 : PyModule_AddObject(m, "KEY_SET_VALUE", PyLong_FromUnsignedLongLong((uint32_t)(KEY_SET_VALUE)));
24385 1 : PyModule_AddObject(m, "KEY_CREATE_SUB_KEY", PyLong_FromUnsignedLongLong((uint32_t)(KEY_CREATE_SUB_KEY)));
24386 1 : PyModule_AddObject(m, "KEY_ENUMERATE_SUB_KEYS", PyLong_FromUnsignedLongLong((uint32_t)(KEY_ENUMERATE_SUB_KEYS)));
24387 1 : PyModule_AddObject(m, "KEY_NOTIFY", PyLong_FromUnsignedLongLong((uint32_t)(KEY_NOTIFY)));
24388 1 : PyModule_AddObject(m, "KEY_CREATE_LINK", PyLong_FromUnsignedLongLong((uint32_t)(KEY_CREATE_LINK)));
24389 1 : PyModule_AddObject(m, "KEY_WOW64_64KEY", PyLong_FromUnsignedLongLong((uint32_t)(KEY_WOW64_64KEY)));
24390 1 : PyModule_AddObject(m, "KEY_WOW64_32KEY", PyLong_FromUnsignedLongLong((uint32_t)(KEY_WOW64_32KEY)));
24391 1 : PyModule_AddObject(m, "REG_OPTION_VOLATILE", PyLong_FromUnsignedLongLong((uint32_t)(REG_OPTION_VOLATILE)));
24392 1 : PyModule_AddObject(m, "REG_OPTION_CREATE_LINK", PyLong_FromUnsignedLongLong((uint32_t)(REG_OPTION_CREATE_LINK)));
24393 1 : PyModule_AddObject(m, "REG_OPTION_BACKUP_RESTORE", PyLong_FromUnsignedLongLong((uint32_t)(REG_OPTION_BACKUP_RESTORE)));
24394 1 : PyModule_AddObject(m, "REG_OPTION_OPEN_LINK", PyLong_FromUnsignedLongLong((uint32_t)(REG_OPTION_OPEN_LINK)));
24395 1 : PyModule_AddObject(m, "REG_ACTION_NONE", PyLong_FromUnsignedLongLong((uint32_t)(REG_ACTION_NONE)));
24396 1 : PyModule_AddObject(m, "REG_CREATED_NEW_KEY", PyLong_FromUnsignedLongLong((uint32_t)(REG_CREATED_NEW_KEY)));
24397 1 : PyModule_AddObject(m, "REG_OPENED_EXISTING_KEY", PyLong_FromUnsignedLongLong((uint32_t)(REG_OPENED_EXISTING_KEY)));
24398 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_NAME", PyLong_FromUnsignedLongLong((uint32_t)(REG_NOTIFY_CHANGE_NAME)));
24399 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_ATTRIBUTES", PyLong_FromUnsignedLongLong((uint32_t)(REG_NOTIFY_CHANGE_ATTRIBUTES)));
24400 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_LAST_SET", PyLong_FromUnsignedLongLong((uint32_t)(REG_NOTIFY_CHANGE_LAST_SET)));
24401 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_SECURITY", PyLong_FromUnsignedLongLong((uint32_t)(REG_NOTIFY_CHANGE_SECURITY)));
24402 1 : PyModule_AddObject(m, "REG_WHOLE_HIVE_VOLATILE", PyLong_FromUnsignedLongLong((uint32_t)(REG_WHOLE_HIVE_VOLATILE)));
24403 1 : PyModule_AddObject(m, "REG_REFRESH_HIVE", PyLong_FromUnsignedLongLong((uint32_t)(REG_REFRESH_HIVE)));
24404 1 : PyModule_AddObject(m, "REG_NO_LAZY_FLUSH", PyLong_FromUnsignedLongLong((uint32_t)(REG_NO_LAZY_FLUSH)));
24405 1 : PyModule_AddObject(m, "REG_FORCE_RESTORE", PyLong_FromUnsignedLongLong((uint32_t)(REG_FORCE_RESTORE)));
24406 1 : Py_INCREF((PyObject *)(void *)&winreg_String_Type);
24407 1 : PyModule_AddObject(m, "String", (PyObject *)(void *)&winreg_String_Type);
24408 1 : Py_INCREF((PyObject *)(void *)&KeySecurityData_Type);
24409 1 : PyModule_AddObject(m, "KeySecurityData", (PyObject *)(void *)&KeySecurityData_Type);
24410 1 : Py_INCREF((PyObject *)(void *)&winreg_SecBuf_Type);
24411 1 : PyModule_AddObject(m, "SecBuf", (PyObject *)(void *)&winreg_SecBuf_Type);
24412 1 : Py_INCREF((PyObject *)(void *)&winreg_StringBuf_Type);
24413 1 : PyModule_AddObject(m, "StringBuf", (PyObject *)(void *)&winreg_StringBuf_Type);
24414 1 : Py_INCREF((PyObject *)(void *)&winreg_ValNameBuf_Type);
24415 1 : PyModule_AddObject(m, "ValNameBuf", (PyObject *)(void *)&winreg_ValNameBuf_Type);
24416 1 : Py_INCREF((PyObject *)(void *)&KeySecurityAttribute_Type);
24417 1 : PyModule_AddObject(m, "KeySecurityAttribute", (PyObject *)(void *)&KeySecurityAttribute_Type);
24418 1 : Py_INCREF((PyObject *)(void *)&QueryMultipleValue_Type);
24419 1 : PyModule_AddObject(m, "QueryMultipleValue", (PyObject *)(void *)&QueryMultipleValue_Type);
24420 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKCR_Type);
24421 1 : PyModule_AddObject(m, "OpenHKCR", (PyObject *)(void *)&winreg_OpenHKCR_Type);
24422 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKCU_Type);
24423 1 : PyModule_AddObject(m, "OpenHKCU", (PyObject *)(void *)&winreg_OpenHKCU_Type);
24424 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKLM_Type);
24425 1 : PyModule_AddObject(m, "OpenHKLM", (PyObject *)(void *)&winreg_OpenHKLM_Type);
24426 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKPD_Type);
24427 1 : PyModule_AddObject(m, "OpenHKPD", (PyObject *)(void *)&winreg_OpenHKPD_Type);
24428 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKU_Type);
24429 1 : PyModule_AddObject(m, "OpenHKU", (PyObject *)(void *)&winreg_OpenHKU_Type);
24430 1 : Py_INCREF((PyObject *)(void *)&winreg_CloseKey_Type);
24431 1 : PyModule_AddObject(m, "CloseKey", (PyObject *)(void *)&winreg_CloseKey_Type);
24432 1 : Py_INCREF((PyObject *)(void *)&winreg_CreateKey_Type);
24433 1 : PyModule_AddObject(m, "CreateKey", (PyObject *)(void *)&winreg_CreateKey_Type);
24434 1 : Py_INCREF((PyObject *)(void *)&winreg_DeleteKey_Type);
24435 1 : PyModule_AddObject(m, "DeleteKey", (PyObject *)(void *)&winreg_DeleteKey_Type);
24436 1 : Py_INCREF((PyObject *)(void *)&winreg_DeleteValue_Type);
24437 1 : PyModule_AddObject(m, "DeleteValue", (PyObject *)(void *)&winreg_DeleteValue_Type);
24438 1 : Py_INCREF((PyObject *)(void *)&winreg_EnumKey_Type);
24439 1 : PyModule_AddObject(m, "EnumKey", (PyObject *)(void *)&winreg_EnumKey_Type);
24440 1 : Py_INCREF((PyObject *)(void *)&winreg_EnumValue_Type);
24441 1 : PyModule_AddObject(m, "EnumValue", (PyObject *)(void *)&winreg_EnumValue_Type);
24442 1 : Py_INCREF((PyObject *)(void *)&winreg_FlushKey_Type);
24443 1 : PyModule_AddObject(m, "FlushKey", (PyObject *)(void *)&winreg_FlushKey_Type);
24444 1 : Py_INCREF((PyObject *)(void *)&winreg_GetKeySecurity_Type);
24445 1 : PyModule_AddObject(m, "GetKeySecurity", (PyObject *)(void *)&winreg_GetKeySecurity_Type);
24446 1 : Py_INCREF((PyObject *)(void *)&winreg_LoadKey_Type);
24447 1 : PyModule_AddObject(m, "LoadKey", (PyObject *)(void *)&winreg_LoadKey_Type);
24448 1 : Py_INCREF((PyObject *)(void *)&winreg_NotifyChangeKeyValue_Type);
24449 1 : PyModule_AddObject(m, "NotifyChangeKeyValue", (PyObject *)(void *)&winreg_NotifyChangeKeyValue_Type);
24450 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenKey_Type);
24451 1 : PyModule_AddObject(m, "OpenKey", (PyObject *)(void *)&winreg_OpenKey_Type);
24452 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryInfoKey_Type);
24453 1 : PyModule_AddObject(m, "QueryInfoKey", (PyObject *)(void *)&winreg_QueryInfoKey_Type);
24454 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryValue_Type);
24455 1 : PyModule_AddObject(m, "QueryValue", (PyObject *)(void *)&winreg_QueryValue_Type);
24456 1 : Py_INCREF((PyObject *)(void *)&winreg_ReplaceKey_Type);
24457 1 : PyModule_AddObject(m, "ReplaceKey", (PyObject *)(void *)&winreg_ReplaceKey_Type);
24458 1 : Py_INCREF((PyObject *)(void *)&winreg_RestoreKey_Type);
24459 1 : PyModule_AddObject(m, "RestoreKey", (PyObject *)(void *)&winreg_RestoreKey_Type);
24460 1 : Py_INCREF((PyObject *)(void *)&winreg_SaveKey_Type);
24461 1 : PyModule_AddObject(m, "SaveKey", (PyObject *)(void *)&winreg_SaveKey_Type);
24462 1 : Py_INCREF((PyObject *)(void *)&winreg_SetKeySecurity_Type);
24463 1 : PyModule_AddObject(m, "SetKeySecurity", (PyObject *)(void *)&winreg_SetKeySecurity_Type);
24464 1 : Py_INCREF((PyObject *)(void *)&winreg_SetValue_Type);
24465 1 : PyModule_AddObject(m, "SetValue", (PyObject *)(void *)&winreg_SetValue_Type);
24466 1 : Py_INCREF((PyObject *)(void *)&winreg_UnLoadKey_Type);
24467 1 : PyModule_AddObject(m, "UnLoadKey", (PyObject *)(void *)&winreg_UnLoadKey_Type);
24468 1 : Py_INCREF((PyObject *)(void *)&winreg_InitiateSystemShutdown_Type);
24469 1 : PyModule_AddObject(m, "InitiateSystemShutdown", (PyObject *)(void *)&winreg_InitiateSystemShutdown_Type);
24470 1 : Py_INCREF((PyObject *)(void *)&winreg_AbortSystemShutdown_Type);
24471 1 : PyModule_AddObject(m, "AbortSystemShutdown", (PyObject *)(void *)&winreg_AbortSystemShutdown_Type);
24472 1 : Py_INCREF((PyObject *)(void *)&winreg_GetVersion_Type);
24473 1 : PyModule_AddObject(m, "GetVersion", (PyObject *)(void *)&winreg_GetVersion_Type);
24474 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKCC_Type);
24475 1 : PyModule_AddObject(m, "OpenHKCC", (PyObject *)(void *)&winreg_OpenHKCC_Type);
24476 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKDD_Type);
24477 1 : PyModule_AddObject(m, "OpenHKDD", (PyObject *)(void *)&winreg_OpenHKDD_Type);
24478 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryMultipleValues_Type);
24479 1 : PyModule_AddObject(m, "QueryMultipleValues", (PyObject *)(void *)&winreg_QueryMultipleValues_Type);
24480 1 : Py_INCREF((PyObject *)(void *)&winreg_InitiateSystemShutdownEx_Type);
24481 1 : PyModule_AddObject(m, "InitiateSystemShutdownEx", (PyObject *)(void *)&winreg_InitiateSystemShutdownEx_Type);
24482 1 : Py_INCREF((PyObject *)(void *)&winreg_SaveKeyEx_Type);
24483 1 : PyModule_AddObject(m, "SaveKeyEx", (PyObject *)(void *)&winreg_SaveKeyEx_Type);
24484 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKPT_Type);
24485 1 : PyModule_AddObject(m, "OpenHKPT", (PyObject *)(void *)&winreg_OpenHKPT_Type);
24486 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKPN_Type);
24487 1 : PyModule_AddObject(m, "OpenHKPN", (PyObject *)(void *)&winreg_OpenHKPN_Type);
24488 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryMultipleValues2_Type);
24489 1 : PyModule_AddObject(m, "QueryMultipleValues2", (PyObject *)(void *)&winreg_QueryMultipleValues2_Type);
24490 1 : Py_INCREF((PyObject *)(void *)&winreg_DeleteKeyEx_Type);
24491 1 : PyModule_AddObject(m, "DeleteKeyEx", (PyObject *)(void *)&winreg_DeleteKeyEx_Type);
24492 1 : Py_INCREF((PyObject *)(void *)&winreg_InterfaceType);
24493 1 : PyModule_AddObject(m, "winreg", (PyObject *)(void *)&winreg_InterfaceType);
24494 1 : Py_INCREF((PyObject *)(void *)&winreg_SyntaxType);
24495 1 : PyModule_AddObject(m, "winreg_abstract_syntax", (PyObject *)(void *)&winreg_SyntaxType);
24496 1 : Py_INCREF((PyObject *)(void *)&winreg_SyntaxType);
24497 1 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&winreg_SyntaxType);
24498 : #ifdef PY_MOD_WINREG_PATCH
24499 : PY_MOD_WINREG_PATCH(m);
24500 : #endif
24501 1 : out:
24502 1 : Py_XDECREF(dep_samba_dcerpc_lsa);
24503 1 : Py_XDECREF(dep_samba_dcerpc_security);
24504 1 : Py_XDECREF(dep_samba_dcerpc_misc);
24505 1 : Py_XDECREF(dep_talloc);
24506 1 : Py_XDECREF(dep_samba_dcerpc_base);
24507 1 : return m;
24508 :
24509 : }
|