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 <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 = (struct winreg_String *)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 = (struct winreg_String *)pytalloc_get_ptr(py_obj);
129 0 : if (value == NULL) {
130 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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 = (struct winreg_String *)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 = (struct winreg_String *)pytalloc_get_ptr(py_obj);
167 0 : if (value == NULL) {
168 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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 = (struct winreg_String *)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 = (struct winreg_String *)pytalloc_get_ptr(py_obj);
218 0 : if (value == NULL) {
219 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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 : PyErr_NoMemory();
234 0 : return -1;
235 : }
236 0 : test_str = PyBytes_AS_STRING(unicode);
237 0 : } else if (PyBytes_Check(value)) {
238 0 : test_str = PyBytes_AS_STRING(value);
239 : } else {
240 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
241 0 : return -1;
242 : }
243 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
244 0 : if (unicode != NULL) {
245 0 : Py_DECREF(unicode);
246 : }
247 0 : if (talloc_str == NULL) {
248 0 : PyErr_NoMemory();
249 0 : return -1;
250 : }
251 0 : object->name = talloc_str;
252 : }
253 : }
254 0 : return 0;
255 : }
256 :
257 : static PyGetSetDef py_winreg_String_getsetters[] = {
258 : {
259 : .name = discard_const_p(char, "name_len"),
260 : .get = py_winreg_String_get_name_len,
261 : .set = py_winreg_String_set_name_len,
262 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
263 : },
264 : {
265 : .name = discard_const_p(char, "name_size"),
266 : .get = py_winreg_String_get_name_size,
267 : .set = py_winreg_String_set_name_size,
268 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
269 : },
270 : {
271 : .name = discard_const_p(char, "name"),
272 : .get = py_winreg_String_get_name,
273 : .set = py_winreg_String_set_name,
274 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
275 : },
276 : { .name = NULL }
277 : };
278 :
279 1 : static PyObject *py_winreg_String_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
280 : {
281 1 : return pytalloc_new(struct winreg_String, type);
282 : }
283 :
284 0 : static PyObject *py_winreg_String_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
285 : {
286 0 : struct winreg_String *object = (struct winreg_String *)pytalloc_get_ptr(py_obj);
287 0 : PyObject *ret = NULL;
288 : DATA_BLOB blob;
289 : enum ndr_err_code err;
290 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
291 0 : if (tmp_ctx == NULL) {
292 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
293 0 : return NULL;
294 : }
295 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_winreg_String);
296 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
297 0 : TALLOC_FREE(tmp_ctx);
298 0 : PyErr_SetNdrError(err);
299 0 : return NULL;
300 : }
301 :
302 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
303 0 : TALLOC_FREE(tmp_ctx);
304 0 : return ret;
305 : }
306 :
307 0 : static PyObject *py_winreg_String_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
308 : {
309 0 : struct winreg_String *object = (struct winreg_String *)pytalloc_get_ptr(py_obj);
310 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
311 0 : Py_ssize_t blob_length = 0;
312 : enum ndr_err_code err;
313 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
314 0 : PyObject *allow_remaining_obj = NULL;
315 0 : bool allow_remaining = false;
316 :
317 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
318 : discard_const_p(char *, kwnames),
319 : &blob.data, &blob_length,
320 : &allow_remaining_obj)) {
321 0 : return NULL;
322 : }
323 0 : blob.length = blob_length;
324 :
325 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
326 0 : allow_remaining = true;
327 : }
328 :
329 0 : if (allow_remaining) {
330 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_winreg_String);
331 : } else {
332 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_winreg_String);
333 : }
334 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
335 0 : PyErr_SetNdrError(err);
336 0 : return NULL;
337 : }
338 :
339 0 : Py_RETURN_NONE;
340 : }
341 :
342 0 : static PyObject *py_winreg_String_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
343 : {
344 0 : struct winreg_String *object = (struct winreg_String *)pytalloc_get_ptr(py_obj);
345 : PyObject *ret;
346 : char *retstr;
347 :
348 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_winreg_String, "winreg_String", object);
349 0 : ret = PyUnicode_FromString(retstr);
350 0 : talloc_free(retstr);
351 :
352 0 : return ret;
353 : }
354 :
355 : static PyMethodDef py_winreg_String_methods[] = {
356 : { "__ndr_pack__", (PyCFunction)py_winreg_String_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
357 : { "__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" },
358 : { "__ndr_print__", (PyCFunction)py_winreg_String_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
359 : { NULL, NULL, 0, NULL }
360 : };
361 :
362 :
363 : static PyTypeObject winreg_String_Type = {
364 : PyVarObject_HEAD_INIT(NULL, 0)
365 : .tp_name = "winreg.String",
366 : .tp_getset = py_winreg_String_getsetters,
367 : .tp_methods = py_winreg_String_methods,
368 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
369 : .tp_new = py_winreg_String_new,
370 : };
371 :
372 :
373 0 : static PyObject *py_KeySecurityData_get_data(PyObject *obj, void *closure)
374 : {
375 0 : struct KeySecurityData *object = (struct KeySecurityData *)pytalloc_get_ptr(obj);
376 : PyObject *py_data;
377 0 : if (object->data == NULL) {
378 0 : Py_RETURN_NONE;
379 : }
380 0 : if (object->data == NULL) {
381 0 : py_data = Py_None;
382 0 : Py_INCREF(py_data);
383 : } else {
384 0 : py_data = PyList_New(object->len);
385 0 : if (py_data == NULL) {
386 0 : return NULL;
387 : }
388 : {
389 : int data_cntr_1;
390 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->len); data_cntr_1++) {
391 : PyObject *py_data_1;
392 0 : py_data_1 = PyLong_FromLong((uint16_t)object->data[data_cntr_1]);
393 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
394 : }
395 : }
396 : }
397 0 : return py_data;
398 : }
399 :
400 0 : static int py_KeySecurityData_set_data(PyObject *py_obj, PyObject *value, void *closure)
401 : {
402 0 : struct KeySecurityData *object = (struct KeySecurityData *)pytalloc_get_ptr(py_obj);
403 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->data));
404 0 : if (value == NULL) {
405 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
406 0 : return -1;
407 : }
408 0 : if (value == Py_None) {
409 0 : object->data = NULL;
410 : } else {
411 0 : object->data = NULL;
412 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
413 : {
414 : int data_cntr_1;
415 0 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
416 0 : if (!object->data) { return -1;; }
417 0 : talloc_set_name_const(object->data, "ARRAY: object->data");
418 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
419 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
420 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data[data_cntr_1]");
421 0 : return -1;
422 : }
423 : {
424 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->data[data_cntr_1]));
425 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
426 : unsigned long long test_var;
427 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
428 0 : if (PyErr_Occurred() != NULL) {
429 0 : return -1;
430 : }
431 0 : if (test_var > uint_max) {
432 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
433 : PyLong_Type.tp_name, uint_max, test_var);
434 0 : return -1;
435 : }
436 0 : object->data[data_cntr_1] = test_var;
437 : } else {
438 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
439 : PyLong_Type.tp_name);
440 0 : return -1;
441 : }
442 : }
443 : }
444 : }
445 : }
446 0 : return 0;
447 : }
448 :
449 0 : static PyObject *py_KeySecurityData_get_size(PyObject *obj, void *closure)
450 : {
451 0 : struct KeySecurityData *object = (struct KeySecurityData *)pytalloc_get_ptr(obj);
452 : PyObject *py_size;
453 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)object->size);
454 0 : return py_size;
455 : }
456 :
457 0 : static int py_KeySecurityData_set_size(PyObject *py_obj, PyObject *value, void *closure)
458 : {
459 0 : struct KeySecurityData *object = (struct KeySecurityData *)pytalloc_get_ptr(py_obj);
460 0 : if (value == NULL) {
461 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
462 0 : return -1;
463 : }
464 : {
465 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
466 0 : if (PyLong_Check(value)) {
467 : unsigned long long test_var;
468 0 : test_var = PyLong_AsUnsignedLongLong(value);
469 0 : if (PyErr_Occurred() != NULL) {
470 0 : return -1;
471 : }
472 0 : if (test_var > uint_max) {
473 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
474 : PyLong_Type.tp_name, uint_max, test_var);
475 0 : return -1;
476 : }
477 0 : object->size = test_var;
478 : } else {
479 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
480 : PyLong_Type.tp_name);
481 0 : return -1;
482 : }
483 : }
484 0 : return 0;
485 : }
486 :
487 0 : static PyObject *py_KeySecurityData_get_len(PyObject *obj, void *closure)
488 : {
489 0 : struct KeySecurityData *object = (struct KeySecurityData *)pytalloc_get_ptr(obj);
490 : PyObject *py_len;
491 0 : py_len = PyLong_FromUnsignedLongLong((uint32_t)object->len);
492 0 : return py_len;
493 : }
494 :
495 0 : static int py_KeySecurityData_set_len(PyObject *py_obj, PyObject *value, void *closure)
496 : {
497 0 : struct KeySecurityData *object = (struct KeySecurityData *)pytalloc_get_ptr(py_obj);
498 0 : if (value == NULL) {
499 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->len");
500 0 : return -1;
501 : }
502 : {
503 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->len));
504 0 : if (PyLong_Check(value)) {
505 : unsigned long long test_var;
506 0 : test_var = PyLong_AsUnsignedLongLong(value);
507 0 : if (PyErr_Occurred() != NULL) {
508 0 : return -1;
509 : }
510 0 : if (test_var > uint_max) {
511 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
512 : PyLong_Type.tp_name, uint_max, test_var);
513 0 : return -1;
514 : }
515 0 : object->len = test_var;
516 : } else {
517 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
518 : PyLong_Type.tp_name);
519 0 : return -1;
520 : }
521 : }
522 0 : return 0;
523 : }
524 :
525 : static PyGetSetDef py_KeySecurityData_getsetters[] = {
526 : {
527 : .name = discard_const_p(char, "data"),
528 : .get = py_KeySecurityData_get_data,
529 : .set = py_KeySecurityData_set_data,
530 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
531 : },
532 : {
533 : .name = discard_const_p(char, "size"),
534 : .get = py_KeySecurityData_get_size,
535 : .set = py_KeySecurityData_set_size,
536 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
537 : },
538 : {
539 : .name = discard_const_p(char, "len"),
540 : .get = py_KeySecurityData_get_len,
541 : .set = py_KeySecurityData_set_len,
542 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
543 : },
544 : { .name = NULL }
545 : };
546 :
547 0 : static PyObject *py_KeySecurityData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
548 : {
549 0 : return pytalloc_new(struct KeySecurityData, type);
550 : }
551 :
552 :
553 : static PyTypeObject KeySecurityData_Type = {
554 : PyVarObject_HEAD_INIT(NULL, 0)
555 : .tp_name = "winreg.KeySecurityData",
556 : .tp_getset = py_KeySecurityData_getsetters,
557 : .tp_methods = NULL,
558 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
559 : .tp_new = py_KeySecurityData_new,
560 : };
561 :
562 :
563 0 : static PyObject *py_winreg_SecBuf_get_length(PyObject *obj, void *closure)
564 : {
565 0 : struct winreg_SecBuf *object = (struct winreg_SecBuf *)pytalloc_get_ptr(obj);
566 : PyObject *py_length;
567 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)object->length);
568 0 : return py_length;
569 : }
570 :
571 0 : static int py_winreg_SecBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
572 : {
573 0 : struct winreg_SecBuf *object = (struct winreg_SecBuf *)pytalloc_get_ptr(py_obj);
574 0 : if (value == NULL) {
575 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->length");
576 0 : return -1;
577 : }
578 : {
579 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
580 0 : if (PyLong_Check(value)) {
581 : unsigned long long test_var;
582 0 : test_var = PyLong_AsUnsignedLongLong(value);
583 0 : if (PyErr_Occurred() != NULL) {
584 0 : return -1;
585 : }
586 0 : if (test_var > uint_max) {
587 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
588 : PyLong_Type.tp_name, uint_max, test_var);
589 0 : return -1;
590 : }
591 0 : object->length = test_var;
592 : } else {
593 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
594 : PyLong_Type.tp_name);
595 0 : return -1;
596 : }
597 : }
598 0 : return 0;
599 : }
600 :
601 0 : static PyObject *py_winreg_SecBuf_get_sd(PyObject *obj, void *closure)
602 : {
603 0 : struct winreg_SecBuf *object = (struct winreg_SecBuf *)pytalloc_get_ptr(obj);
604 : PyObject *py_sd;
605 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, pytalloc_get_mem_ctx(obj), &object->sd);
606 0 : return py_sd;
607 : }
608 :
609 0 : static int py_winreg_SecBuf_set_sd(PyObject *py_obj, PyObject *value, void *closure)
610 : {
611 0 : struct winreg_SecBuf *object = (struct winreg_SecBuf *)pytalloc_get_ptr(py_obj);
612 0 : if (value == NULL) {
613 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd");
614 0 : return -1;
615 : }
616 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
617 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
618 0 : PyErr_NoMemory();
619 0 : return -1;
620 : }
621 0 : object->sd = *(struct KeySecurityData *)pytalloc_get_ptr(value);
622 0 : return 0;
623 : }
624 :
625 0 : static PyObject *py_winreg_SecBuf_get_inherit(PyObject *obj, void *closure)
626 : {
627 0 : struct winreg_SecBuf *object = (struct winreg_SecBuf *)pytalloc_get_ptr(obj);
628 : PyObject *py_inherit;
629 0 : py_inherit = PyLong_FromLong((uint16_t)object->inherit);
630 0 : return py_inherit;
631 : }
632 :
633 0 : static int py_winreg_SecBuf_set_inherit(PyObject *py_obj, PyObject *value, void *closure)
634 : {
635 0 : struct winreg_SecBuf *object = (struct winreg_SecBuf *)pytalloc_get_ptr(py_obj);
636 0 : if (value == NULL) {
637 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->inherit");
638 0 : return -1;
639 : }
640 : {
641 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->inherit));
642 0 : if (PyLong_Check(value)) {
643 : unsigned long long test_var;
644 0 : test_var = PyLong_AsUnsignedLongLong(value);
645 0 : if (PyErr_Occurred() != NULL) {
646 0 : return -1;
647 : }
648 0 : if (test_var > uint_max) {
649 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
650 : PyLong_Type.tp_name, uint_max, test_var);
651 0 : return -1;
652 : }
653 0 : object->inherit = test_var;
654 : } else {
655 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
656 : PyLong_Type.tp_name);
657 0 : return -1;
658 : }
659 : }
660 0 : return 0;
661 : }
662 :
663 : static PyGetSetDef py_winreg_SecBuf_getsetters[] = {
664 : {
665 : .name = discard_const_p(char, "length"),
666 : .get = py_winreg_SecBuf_get_length,
667 : .set = py_winreg_SecBuf_set_length,
668 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
669 : },
670 : {
671 : .name = discard_const_p(char, "sd"),
672 : .get = py_winreg_SecBuf_get_sd,
673 : .set = py_winreg_SecBuf_set_sd,
674 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
675 : },
676 : {
677 : .name = discard_const_p(char, "inherit"),
678 : .get = py_winreg_SecBuf_get_inherit,
679 : .set = py_winreg_SecBuf_set_inherit,
680 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
681 : },
682 : { .name = NULL }
683 : };
684 :
685 0 : static PyObject *py_winreg_SecBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
686 : {
687 0 : return pytalloc_new(struct winreg_SecBuf, type);
688 : }
689 :
690 :
691 : static PyTypeObject winreg_SecBuf_Type = {
692 : PyVarObject_HEAD_INIT(NULL, 0)
693 : .tp_name = "winreg.SecBuf",
694 : .tp_getset = py_winreg_SecBuf_getsetters,
695 : .tp_methods = NULL,
696 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
697 : .tp_new = py_winreg_SecBuf_new,
698 : };
699 :
700 :
701 0 : static PyObject *py_winreg_StringBuf_get_length(PyObject *obj, void *closure)
702 : {
703 0 : struct winreg_StringBuf *object = (struct winreg_StringBuf *)pytalloc_get_ptr(obj);
704 : PyObject *py_length;
705 0 : py_length = PyLong_FromLong((uint16_t)object->length);
706 0 : return py_length;
707 : }
708 :
709 0 : static int py_winreg_StringBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
710 : {
711 0 : struct winreg_StringBuf *object = (struct winreg_StringBuf *)pytalloc_get_ptr(py_obj);
712 0 : if (value == NULL) {
713 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->length");
714 0 : return -1;
715 : }
716 : {
717 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
718 0 : if (PyLong_Check(value)) {
719 : unsigned long long test_var;
720 0 : test_var = PyLong_AsUnsignedLongLong(value);
721 0 : if (PyErr_Occurred() != NULL) {
722 0 : return -1;
723 : }
724 0 : if (test_var > uint_max) {
725 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
726 : PyLong_Type.tp_name, uint_max, test_var);
727 0 : return -1;
728 : }
729 0 : object->length = test_var;
730 : } else {
731 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
732 : PyLong_Type.tp_name);
733 0 : return -1;
734 : }
735 : }
736 0 : return 0;
737 : }
738 :
739 0 : static PyObject *py_winreg_StringBuf_get_size(PyObject *obj, void *closure)
740 : {
741 0 : struct winreg_StringBuf *object = (struct winreg_StringBuf *)pytalloc_get_ptr(obj);
742 : PyObject *py_size;
743 0 : py_size = PyLong_FromLong((uint16_t)object->size);
744 0 : return py_size;
745 : }
746 :
747 0 : static int py_winreg_StringBuf_set_size(PyObject *py_obj, PyObject *value, void *closure)
748 : {
749 0 : struct winreg_StringBuf *object = (struct winreg_StringBuf *)pytalloc_get_ptr(py_obj);
750 0 : if (value == NULL) {
751 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
752 0 : return -1;
753 : }
754 : {
755 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
756 0 : if (PyLong_Check(value)) {
757 : unsigned long long test_var;
758 0 : test_var = PyLong_AsUnsignedLongLong(value);
759 0 : if (PyErr_Occurred() != NULL) {
760 0 : return -1;
761 : }
762 0 : if (test_var > uint_max) {
763 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
764 : PyLong_Type.tp_name, uint_max, test_var);
765 0 : return -1;
766 : }
767 0 : object->size = test_var;
768 : } else {
769 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
770 : PyLong_Type.tp_name);
771 0 : return -1;
772 : }
773 : }
774 0 : return 0;
775 : }
776 :
777 0 : static PyObject *py_winreg_StringBuf_get_name(PyObject *obj, void *closure)
778 : {
779 0 : struct winreg_StringBuf *object = (struct winreg_StringBuf *)pytalloc_get_ptr(obj);
780 : PyObject *py_name;
781 0 : if (object->name == NULL) {
782 0 : Py_RETURN_NONE;
783 : }
784 0 : if (object->name == NULL) {
785 0 : py_name = Py_None;
786 0 : Py_INCREF(py_name);
787 : } else {
788 0 : if (object->name == NULL) {
789 0 : py_name = Py_None;
790 0 : Py_INCREF(py_name);
791 : } else {
792 0 : py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
793 : }
794 : }
795 0 : return py_name;
796 : }
797 :
798 0 : static int py_winreg_StringBuf_set_name(PyObject *py_obj, PyObject *value, void *closure)
799 : {
800 0 : struct winreg_StringBuf *object = (struct winreg_StringBuf *)pytalloc_get_ptr(py_obj);
801 0 : if (value == NULL) {
802 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
803 0 : return -1;
804 : }
805 0 : if (value == Py_None) {
806 0 : object->name = NULL;
807 : } else {
808 0 : object->name = NULL;
809 : {
810 : const char *test_str;
811 : const char *talloc_str;
812 0 : PyObject *unicode = NULL;
813 0 : if (PyUnicode_Check(value)) {
814 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
815 0 : if (unicode == NULL) {
816 0 : PyErr_NoMemory();
817 0 : return -1;
818 : }
819 0 : test_str = PyBytes_AS_STRING(unicode);
820 0 : } else if (PyBytes_Check(value)) {
821 0 : test_str = PyBytes_AS_STRING(value);
822 : } else {
823 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
824 0 : return -1;
825 : }
826 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
827 0 : if (unicode != NULL) {
828 0 : Py_DECREF(unicode);
829 : }
830 0 : if (talloc_str == NULL) {
831 0 : PyErr_NoMemory();
832 0 : return -1;
833 : }
834 0 : object->name = talloc_str;
835 : }
836 : }
837 0 : return 0;
838 : }
839 :
840 : static PyGetSetDef py_winreg_StringBuf_getsetters[] = {
841 : {
842 : .name = discard_const_p(char, "length"),
843 : .get = py_winreg_StringBuf_get_length,
844 : .set = py_winreg_StringBuf_set_length,
845 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
846 : },
847 : {
848 : .name = discard_const_p(char, "size"),
849 : .get = py_winreg_StringBuf_get_size,
850 : .set = py_winreg_StringBuf_set_size,
851 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
852 : },
853 : {
854 : .name = discard_const_p(char, "name"),
855 : .get = py_winreg_StringBuf_get_name,
856 : .set = py_winreg_StringBuf_set_name,
857 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
858 : },
859 : { .name = NULL }
860 : };
861 :
862 0 : static PyObject *py_winreg_StringBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
863 : {
864 0 : return pytalloc_new(struct winreg_StringBuf, type);
865 : }
866 :
867 :
868 : static PyTypeObject winreg_StringBuf_Type = {
869 : PyVarObject_HEAD_INIT(NULL, 0)
870 : .tp_name = "winreg.StringBuf",
871 : .tp_getset = py_winreg_StringBuf_getsetters,
872 : .tp_methods = NULL,
873 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
874 : .tp_new = py_winreg_StringBuf_new,
875 : };
876 :
877 :
878 0 : static PyObject *py_winreg_ValNameBuf_get_length(PyObject *obj, void *closure)
879 : {
880 0 : struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)pytalloc_get_ptr(obj);
881 : PyObject *py_length;
882 0 : py_length = PyLong_FromLong((uint16_t)object->length);
883 0 : return py_length;
884 : }
885 :
886 0 : static int py_winreg_ValNameBuf_set_length(PyObject *py_obj, PyObject *value, void *closure)
887 : {
888 0 : struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)pytalloc_get_ptr(py_obj);
889 0 : if (value == NULL) {
890 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->length");
891 0 : return -1;
892 : }
893 : {
894 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
895 0 : if (PyLong_Check(value)) {
896 : unsigned long long test_var;
897 0 : test_var = PyLong_AsUnsignedLongLong(value);
898 0 : if (PyErr_Occurred() != NULL) {
899 0 : return -1;
900 : }
901 0 : if (test_var > uint_max) {
902 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
903 : PyLong_Type.tp_name, uint_max, test_var);
904 0 : return -1;
905 : }
906 0 : object->length = test_var;
907 : } else {
908 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
909 : PyLong_Type.tp_name);
910 0 : return -1;
911 : }
912 : }
913 0 : return 0;
914 : }
915 :
916 0 : static PyObject *py_winreg_ValNameBuf_get_size(PyObject *obj, void *closure)
917 : {
918 0 : struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)pytalloc_get_ptr(obj);
919 : PyObject *py_size;
920 0 : py_size = PyLong_FromLong((uint16_t)object->size);
921 0 : return py_size;
922 : }
923 :
924 0 : static int py_winreg_ValNameBuf_set_size(PyObject *py_obj, PyObject *value, void *closure)
925 : {
926 0 : struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)pytalloc_get_ptr(py_obj);
927 0 : if (value == NULL) {
928 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
929 0 : return -1;
930 : }
931 : {
932 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
933 0 : if (PyLong_Check(value)) {
934 : unsigned long long test_var;
935 0 : test_var = PyLong_AsUnsignedLongLong(value);
936 0 : if (PyErr_Occurred() != NULL) {
937 0 : return -1;
938 : }
939 0 : if (test_var > uint_max) {
940 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
941 : PyLong_Type.tp_name, uint_max, test_var);
942 0 : return -1;
943 : }
944 0 : object->size = test_var;
945 : } else {
946 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
947 : PyLong_Type.tp_name);
948 0 : return -1;
949 : }
950 : }
951 0 : return 0;
952 : }
953 :
954 0 : static PyObject *py_winreg_ValNameBuf_get_name(PyObject *obj, void *closure)
955 : {
956 0 : struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)pytalloc_get_ptr(obj);
957 : PyObject *py_name;
958 0 : if (object->name == NULL) {
959 0 : Py_RETURN_NONE;
960 : }
961 0 : if (object->name == NULL) {
962 0 : py_name = Py_None;
963 0 : Py_INCREF(py_name);
964 : } else {
965 0 : if (object->name == NULL) {
966 0 : py_name = Py_None;
967 0 : Py_INCREF(py_name);
968 : } else {
969 0 : py_name = PyUnicode_Decode(object->name, strlen(object->name), "utf-8", "ignore");
970 : }
971 : }
972 0 : return py_name;
973 : }
974 :
975 0 : static int py_winreg_ValNameBuf_set_name(PyObject *py_obj, PyObject *value, void *closure)
976 : {
977 0 : struct winreg_ValNameBuf *object = (struct winreg_ValNameBuf *)pytalloc_get_ptr(py_obj);
978 0 : if (value == NULL) {
979 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
980 0 : return -1;
981 : }
982 0 : if (value == Py_None) {
983 0 : object->name = NULL;
984 : } else {
985 0 : object->name = NULL;
986 : {
987 : const char *test_str;
988 : const char *talloc_str;
989 0 : PyObject *unicode = NULL;
990 0 : if (PyUnicode_Check(value)) {
991 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
992 0 : if (unicode == NULL) {
993 0 : PyErr_NoMemory();
994 0 : return -1;
995 : }
996 0 : test_str = PyBytes_AS_STRING(unicode);
997 0 : } else if (PyBytes_Check(value)) {
998 0 : test_str = PyBytes_AS_STRING(value);
999 : } else {
1000 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1001 0 : return -1;
1002 : }
1003 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1004 0 : if (unicode != NULL) {
1005 0 : Py_DECREF(unicode);
1006 : }
1007 0 : if (talloc_str == NULL) {
1008 0 : PyErr_NoMemory();
1009 0 : return -1;
1010 : }
1011 0 : object->name = talloc_str;
1012 : }
1013 : }
1014 0 : return 0;
1015 : }
1016 :
1017 : static PyGetSetDef py_winreg_ValNameBuf_getsetters[] = {
1018 : {
1019 : .name = discard_const_p(char, "length"),
1020 : .get = py_winreg_ValNameBuf_get_length,
1021 : .set = py_winreg_ValNameBuf_set_length,
1022 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1023 : },
1024 : {
1025 : .name = discard_const_p(char, "size"),
1026 : .get = py_winreg_ValNameBuf_get_size,
1027 : .set = py_winreg_ValNameBuf_set_size,
1028 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1029 : },
1030 : {
1031 : .name = discard_const_p(char, "name"),
1032 : .get = py_winreg_ValNameBuf_get_name,
1033 : .set = py_winreg_ValNameBuf_set_name,
1034 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1035 : },
1036 : { .name = NULL }
1037 : };
1038 :
1039 0 : static PyObject *py_winreg_ValNameBuf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1040 : {
1041 0 : return pytalloc_new(struct winreg_ValNameBuf, type);
1042 : }
1043 :
1044 :
1045 : static PyTypeObject winreg_ValNameBuf_Type = {
1046 : PyVarObject_HEAD_INIT(NULL, 0)
1047 : .tp_name = "winreg.ValNameBuf",
1048 : .tp_getset = py_winreg_ValNameBuf_getsetters,
1049 : .tp_methods = NULL,
1050 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1051 : .tp_new = py_winreg_ValNameBuf_new,
1052 : };
1053 :
1054 :
1055 0 : static PyObject *py_KeySecurityAttribute_get_data_size(PyObject *obj, void *closure)
1056 : {
1057 0 : struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)pytalloc_get_ptr(obj);
1058 : PyObject *py_data_size;
1059 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)object->data_size);
1060 0 : return py_data_size;
1061 : }
1062 :
1063 0 : static int py_KeySecurityAttribute_set_data_size(PyObject *py_obj, PyObject *value, void *closure)
1064 : {
1065 0 : struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)pytalloc_get_ptr(py_obj);
1066 0 : if (value == NULL) {
1067 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data_size");
1068 0 : return -1;
1069 : }
1070 : {
1071 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->data_size));
1072 0 : if (PyLong_Check(value)) {
1073 : unsigned long long test_var;
1074 0 : test_var = PyLong_AsUnsignedLongLong(value);
1075 0 : if (PyErr_Occurred() != NULL) {
1076 0 : return -1;
1077 : }
1078 0 : if (test_var > uint_max) {
1079 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1080 : PyLong_Type.tp_name, uint_max, test_var);
1081 0 : return -1;
1082 : }
1083 0 : object->data_size = test_var;
1084 : } else {
1085 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1086 : PyLong_Type.tp_name);
1087 0 : return -1;
1088 : }
1089 : }
1090 0 : return 0;
1091 : }
1092 :
1093 0 : static PyObject *py_KeySecurityAttribute_get_sec_data(PyObject *obj, void *closure)
1094 : {
1095 0 : struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)pytalloc_get_ptr(obj);
1096 : PyObject *py_sec_data;
1097 0 : py_sec_data = pytalloc_reference_ex(&KeySecurityData_Type, pytalloc_get_mem_ctx(obj), &object->sec_data);
1098 0 : return py_sec_data;
1099 : }
1100 :
1101 0 : static int py_KeySecurityAttribute_set_sec_data(PyObject *py_obj, PyObject *value, void *closure)
1102 : {
1103 0 : struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)pytalloc_get_ptr(py_obj);
1104 0 : if (value == NULL) {
1105 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sec_data");
1106 0 : return -1;
1107 : }
1108 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
1109 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1110 0 : PyErr_NoMemory();
1111 0 : return -1;
1112 : }
1113 0 : object->sec_data = *(struct KeySecurityData *)pytalloc_get_ptr(value);
1114 0 : return 0;
1115 : }
1116 :
1117 0 : static PyObject *py_KeySecurityAttribute_get_inherit(PyObject *obj, void *closure)
1118 : {
1119 0 : struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)pytalloc_get_ptr(obj);
1120 : PyObject *py_inherit;
1121 0 : py_inherit = PyLong_FromLong((uint16_t)object->inherit);
1122 0 : return py_inherit;
1123 : }
1124 :
1125 0 : static int py_KeySecurityAttribute_set_inherit(PyObject *py_obj, PyObject *value, void *closure)
1126 : {
1127 0 : struct KeySecurityAttribute *object = (struct KeySecurityAttribute *)pytalloc_get_ptr(py_obj);
1128 0 : if (value == NULL) {
1129 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->inherit");
1130 0 : return -1;
1131 : }
1132 : {
1133 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->inherit));
1134 0 : if (PyLong_Check(value)) {
1135 : unsigned long long test_var;
1136 0 : test_var = PyLong_AsUnsignedLongLong(value);
1137 0 : if (PyErr_Occurred() != NULL) {
1138 0 : return -1;
1139 : }
1140 0 : if (test_var > uint_max) {
1141 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1142 : PyLong_Type.tp_name, uint_max, test_var);
1143 0 : return -1;
1144 : }
1145 0 : object->inherit = test_var;
1146 : } else {
1147 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1148 : PyLong_Type.tp_name);
1149 0 : return -1;
1150 : }
1151 : }
1152 0 : return 0;
1153 : }
1154 :
1155 : static PyGetSetDef py_KeySecurityAttribute_getsetters[] = {
1156 : {
1157 : .name = discard_const_p(char, "data_size"),
1158 : .get = py_KeySecurityAttribute_get_data_size,
1159 : .set = py_KeySecurityAttribute_set_data_size,
1160 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1161 : },
1162 : {
1163 : .name = discard_const_p(char, "sec_data"),
1164 : .get = py_KeySecurityAttribute_get_sec_data,
1165 : .set = py_KeySecurityAttribute_set_sec_data,
1166 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
1167 : },
1168 : {
1169 : .name = discard_const_p(char, "inherit"),
1170 : .get = py_KeySecurityAttribute_get_inherit,
1171 : .set = py_KeySecurityAttribute_set_inherit,
1172 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1173 : },
1174 : { .name = NULL }
1175 : };
1176 :
1177 0 : static PyObject *py_KeySecurityAttribute_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1178 : {
1179 0 : return pytalloc_new(struct KeySecurityAttribute, type);
1180 : }
1181 :
1182 :
1183 : static PyTypeObject KeySecurityAttribute_Type = {
1184 : PyVarObject_HEAD_INIT(NULL, 0)
1185 : .tp_name = "winreg.KeySecurityAttribute",
1186 : .tp_getset = py_KeySecurityAttribute_getsetters,
1187 : .tp_methods = NULL,
1188 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1189 : .tp_new = py_KeySecurityAttribute_new,
1190 : };
1191 :
1192 :
1193 0 : static PyObject *py_QueryMultipleValue_get_ve_valuename(PyObject *obj, void *closure)
1194 : {
1195 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(obj);
1196 : PyObject *py_ve_valuename;
1197 0 : if (object->ve_valuename == NULL) {
1198 0 : Py_RETURN_NONE;
1199 : }
1200 0 : if (object->ve_valuename == NULL) {
1201 0 : py_ve_valuename = Py_None;
1202 0 : Py_INCREF(py_ve_valuename);
1203 : } else {
1204 0 : py_ve_valuename = pytalloc_reference_ex(&winreg_ValNameBuf_Type, object->ve_valuename, object->ve_valuename);
1205 : }
1206 0 : return py_ve_valuename;
1207 : }
1208 :
1209 0 : static int py_QueryMultipleValue_set_ve_valuename(PyObject *py_obj, PyObject *value, void *closure)
1210 : {
1211 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(py_obj);
1212 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->ve_valuename));
1213 0 : if (value == NULL) {
1214 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ve_valuename");
1215 0 : return -1;
1216 : }
1217 0 : if (value == Py_None) {
1218 0 : object->ve_valuename = NULL;
1219 : } else {
1220 0 : object->ve_valuename = NULL;
1221 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, value, return -1;);
1222 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1223 0 : PyErr_NoMemory();
1224 0 : return -1;
1225 : }
1226 0 : object->ve_valuename = (struct winreg_ValNameBuf *)pytalloc_get_ptr(value);
1227 : }
1228 0 : return 0;
1229 : }
1230 :
1231 0 : static PyObject *py_QueryMultipleValue_get_ve_valuelen(PyObject *obj, void *closure)
1232 : {
1233 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(obj);
1234 : PyObject *py_ve_valuelen;
1235 0 : py_ve_valuelen = PyLong_FromUnsignedLongLong((uint32_t)object->ve_valuelen);
1236 0 : return py_ve_valuelen;
1237 : }
1238 :
1239 0 : static int py_QueryMultipleValue_set_ve_valuelen(PyObject *py_obj, PyObject *value, void *closure)
1240 : {
1241 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(py_obj);
1242 0 : if (value == NULL) {
1243 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ve_valuelen");
1244 0 : return -1;
1245 : }
1246 : {
1247 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ve_valuelen));
1248 0 : if (PyLong_Check(value)) {
1249 : unsigned long long test_var;
1250 0 : test_var = PyLong_AsUnsignedLongLong(value);
1251 0 : if (PyErr_Occurred() != NULL) {
1252 0 : return -1;
1253 : }
1254 0 : if (test_var > uint_max) {
1255 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1256 : PyLong_Type.tp_name, uint_max, test_var);
1257 0 : return -1;
1258 : }
1259 0 : object->ve_valuelen = test_var;
1260 : } else {
1261 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1262 : PyLong_Type.tp_name);
1263 0 : return -1;
1264 : }
1265 : }
1266 0 : return 0;
1267 : }
1268 :
1269 0 : static PyObject *py_QueryMultipleValue_get_ve_valueptr(PyObject *obj, void *closure)
1270 : {
1271 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(obj);
1272 : PyObject *py_ve_valueptr;
1273 0 : py_ve_valueptr = PyLong_FromUnsignedLongLong((uint32_t)object->ve_valueptr);
1274 0 : return py_ve_valueptr;
1275 : }
1276 :
1277 0 : static int py_QueryMultipleValue_set_ve_valueptr(PyObject *py_obj, PyObject *value, void *closure)
1278 : {
1279 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(py_obj);
1280 0 : if (value == NULL) {
1281 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ve_valueptr");
1282 0 : return -1;
1283 : }
1284 : {
1285 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ve_valueptr));
1286 0 : if (PyLong_Check(value)) {
1287 : unsigned long long test_var;
1288 0 : test_var = PyLong_AsUnsignedLongLong(value);
1289 0 : if (PyErr_Occurred() != NULL) {
1290 0 : return -1;
1291 : }
1292 0 : if (test_var > uint_max) {
1293 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1294 : PyLong_Type.tp_name, uint_max, test_var);
1295 0 : return -1;
1296 : }
1297 0 : object->ve_valueptr = test_var;
1298 : } else {
1299 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1300 : PyLong_Type.tp_name);
1301 0 : return -1;
1302 : }
1303 : }
1304 0 : return 0;
1305 : }
1306 :
1307 0 : static PyObject *py_QueryMultipleValue_get_ve_type(PyObject *obj, void *closure)
1308 : {
1309 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(obj);
1310 : PyObject *py_ve_type;
1311 0 : py_ve_type = PyLong_FromUnsignedLongLong((uint32_t)object->ve_type);
1312 0 : return py_ve_type;
1313 : }
1314 :
1315 0 : static int py_QueryMultipleValue_set_ve_type(PyObject *py_obj, PyObject *value, void *closure)
1316 : {
1317 0 : struct QueryMultipleValue *object = (struct QueryMultipleValue *)pytalloc_get_ptr(py_obj);
1318 0 : if (value == NULL) {
1319 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ve_type");
1320 0 : return -1;
1321 : }
1322 : {
1323 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ve_type));
1324 0 : if (PyLong_Check(value)) {
1325 : unsigned long long test_var;
1326 0 : test_var = PyLong_AsUnsignedLongLong(value);
1327 0 : if (PyErr_Occurred() != NULL) {
1328 0 : return -1;
1329 : }
1330 0 : if (test_var > uint_max) {
1331 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1332 : PyLong_Type.tp_name, uint_max, test_var);
1333 0 : return -1;
1334 : }
1335 0 : object->ve_type = test_var;
1336 : } else {
1337 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1338 : PyLong_Type.tp_name);
1339 0 : return -1;
1340 : }
1341 : }
1342 0 : return 0;
1343 : }
1344 :
1345 : static PyGetSetDef py_QueryMultipleValue_getsetters[] = {
1346 : {
1347 : .name = discard_const_p(char, "ve_valuename"),
1348 : .get = py_QueryMultipleValue_get_ve_valuename,
1349 : .set = py_QueryMultipleValue_set_ve_valuename,
1350 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_ValNameBuf")
1351 : },
1352 : {
1353 : .name = discard_const_p(char, "ve_valuelen"),
1354 : .get = py_QueryMultipleValue_get_ve_valuelen,
1355 : .set = py_QueryMultipleValue_set_ve_valuelen,
1356 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1357 : },
1358 : {
1359 : .name = discard_const_p(char, "ve_valueptr"),
1360 : .get = py_QueryMultipleValue_get_ve_valueptr,
1361 : .set = py_QueryMultipleValue_set_ve_valueptr,
1362 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1363 : },
1364 : {
1365 : .name = discard_const_p(char, "ve_type"),
1366 : .get = py_QueryMultipleValue_get_ve_type,
1367 : .set = py_QueryMultipleValue_set_ve_type,
1368 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
1369 : },
1370 : { .name = NULL }
1371 : };
1372 :
1373 0 : static PyObject *py_QueryMultipleValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1374 : {
1375 0 : return pytalloc_new(struct QueryMultipleValue, type);
1376 : }
1377 :
1378 :
1379 : static PyTypeObject QueryMultipleValue_Type = {
1380 : PyVarObject_HEAD_INIT(NULL, 0)
1381 : .tp_name = "winreg.QueryMultipleValue",
1382 : .tp_getset = py_QueryMultipleValue_getsetters,
1383 : .tp_methods = NULL,
1384 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1385 : .tp_new = py_QueryMultipleValue_new,
1386 : };
1387 :
1388 :
1389 :
1390 0 : static PyObject *py_winreg_OpenHKCR_in_get_system_name(PyObject *obj, void *closure)
1391 : {
1392 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(obj);
1393 : PyObject *py_system_name;
1394 0 : if (object->in.system_name == NULL) {
1395 0 : Py_RETURN_NONE;
1396 : }
1397 0 : if (object->in.system_name == NULL) {
1398 0 : py_system_name = Py_None;
1399 0 : Py_INCREF(py_system_name);
1400 : } else {
1401 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
1402 : }
1403 0 : return py_system_name;
1404 : }
1405 :
1406 0 : static int py_winreg_OpenHKCR_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
1407 : {
1408 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(py_obj);
1409 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
1410 0 : if (value == NULL) {
1411 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
1412 0 : return -1;
1413 : }
1414 0 : if (value == Py_None) {
1415 0 : object->in.system_name = NULL;
1416 : } else {
1417 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
1418 0 : if (object->in.system_name == NULL) {
1419 0 : PyErr_NoMemory();
1420 0 : return -1;
1421 : }
1422 : {
1423 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
1424 0 : if (PyLong_Check(value)) {
1425 : unsigned long long test_var;
1426 0 : test_var = PyLong_AsUnsignedLongLong(value);
1427 0 : if (PyErr_Occurred() != NULL) {
1428 0 : return -1;
1429 : }
1430 0 : if (test_var > uint_max) {
1431 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1432 : PyLong_Type.tp_name, uint_max, test_var);
1433 0 : return -1;
1434 : }
1435 0 : *object->in.system_name = test_var;
1436 : } else {
1437 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1438 : PyLong_Type.tp_name);
1439 0 : return -1;
1440 : }
1441 : }
1442 : }
1443 0 : return 0;
1444 : }
1445 :
1446 0 : static PyObject *py_winreg_OpenHKCR_in_get_access_mask(PyObject *obj, void *closure)
1447 : {
1448 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(obj);
1449 : PyObject *py_access_mask;
1450 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
1451 0 : return py_access_mask;
1452 : }
1453 :
1454 0 : static int py_winreg_OpenHKCR_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
1455 : {
1456 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(py_obj);
1457 0 : if (value == NULL) {
1458 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
1459 0 : return -1;
1460 : }
1461 : {
1462 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
1463 0 : if (PyLong_Check(value)) {
1464 : unsigned long long test_var;
1465 0 : test_var = PyLong_AsUnsignedLongLong(value);
1466 0 : if (PyErr_Occurred() != NULL) {
1467 0 : return -1;
1468 : }
1469 0 : if (test_var > uint_max) {
1470 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1471 : PyLong_Type.tp_name, uint_max, test_var);
1472 0 : return -1;
1473 : }
1474 0 : object->in.access_mask = test_var;
1475 : } else {
1476 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1477 : PyLong_Type.tp_name);
1478 0 : return -1;
1479 : }
1480 : }
1481 0 : return 0;
1482 : }
1483 :
1484 0 : static PyObject *py_winreg_OpenHKCR_out_get_handle(PyObject *obj, void *closure)
1485 : {
1486 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(obj);
1487 : PyObject *py_handle;
1488 0 : if (object->out.handle == NULL) {
1489 0 : Py_RETURN_NONE;
1490 : }
1491 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
1492 0 : return py_handle;
1493 : }
1494 :
1495 0 : static int py_winreg_OpenHKCR_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
1496 : {
1497 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(py_obj);
1498 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
1499 0 : if (value == NULL) {
1500 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
1501 0 : return -1;
1502 : }
1503 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
1504 0 : if (object->out.handle == NULL) {
1505 0 : PyErr_NoMemory();
1506 0 : return -1;
1507 : }
1508 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
1509 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1510 0 : PyErr_NoMemory();
1511 0 : return -1;
1512 : }
1513 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
1514 0 : return 0;
1515 : }
1516 :
1517 0 : static PyObject *py_winreg_OpenHKCR_get_result(PyObject *obj, void *closure)
1518 : {
1519 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(obj);
1520 : PyObject *py_result;
1521 0 : py_result = PyErr_FromWERROR(object->out.result);
1522 0 : return py_result;
1523 : }
1524 :
1525 0 : static int py_winreg_OpenHKCR_set_result(PyObject *py_obj, PyObject *value, void *closure)
1526 : {
1527 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(py_obj);
1528 0 : if (value == NULL) {
1529 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
1530 0 : return -1;
1531 : }
1532 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
1533 0 : return 0;
1534 : }
1535 :
1536 : static PyGetSetDef py_winreg_OpenHKCR_getsetters[] = {
1537 : {
1538 : .name = discard_const_p(char, "in_system_name"),
1539 : .get = py_winreg_OpenHKCR_in_get_system_name,
1540 : .set = py_winreg_OpenHKCR_in_set_system_name,
1541 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1542 : },
1543 : {
1544 : .name = discard_const_p(char, "in_access_mask"),
1545 : .get = py_winreg_OpenHKCR_in_get_access_mask,
1546 : .set = py_winreg_OpenHKCR_in_set_access_mask,
1547 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
1548 : },
1549 : {
1550 : .name = discard_const_p(char, "out_handle"),
1551 : .get = py_winreg_OpenHKCR_out_get_handle,
1552 : .set = py_winreg_OpenHKCR_out_set_handle,
1553 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
1554 : },
1555 : {
1556 : .name = discard_const_p(char, "result"),
1557 : .get = py_winreg_OpenHKCR_get_result,
1558 : .set = py_winreg_OpenHKCR_set_result,
1559 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
1560 : },
1561 : { .name = NULL }
1562 : };
1563 :
1564 0 : static PyObject *py_winreg_OpenHKCR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1565 : {
1566 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKCR, type);
1567 0 : struct winreg_OpenHKCR *_self = (struct winreg_OpenHKCR *)pytalloc_get_ptr(self);
1568 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
1569 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
1570 0 : return self;
1571 : }
1572 :
1573 0 : static PyObject *py_winreg_OpenHKCR_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
1574 : {
1575 :
1576 :
1577 0 : return PyLong_FromLong(0);
1578 : }
1579 :
1580 0 : static PyObject *py_winreg_OpenHKCR_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
1581 : {
1582 0 : const struct ndr_interface_call *call = NULL;
1583 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(py_obj);
1584 0 : PyObject *ret = NULL;
1585 0 : struct ndr_push *push = NULL;
1586 : DATA_BLOB blob;
1587 : enum ndr_err_code err;
1588 :
1589 0 : if (ndr_table_winreg.num_calls < 1) {
1590 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCR_ndr_pack");
1591 0 : return NULL;
1592 : }
1593 0 : call = &ndr_table_winreg.calls[0];
1594 :
1595 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
1596 0 : if (push == NULL) {
1597 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1598 0 : return NULL;
1599 : }
1600 :
1601 0 : push->flags |= ndr_push_flags;
1602 :
1603 0 : err = call->ndr_push(push, ndr_inout_flags, object);
1604 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1605 0 : TALLOC_FREE(push);
1606 0 : PyErr_SetNdrError(err);
1607 0 : return NULL;
1608 : }
1609 0 : blob = ndr_push_blob(push);
1610 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1611 0 : TALLOC_FREE(push);
1612 0 : return ret;
1613 : }
1614 :
1615 0 : static PyObject *py_winreg_OpenHKCR_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1616 : {
1617 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
1618 0 : PyObject *bigendian_obj = NULL;
1619 0 : PyObject *ndr64_obj = NULL;
1620 0 : uint32_t ndr_push_flags = 0;
1621 :
1622 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
1623 : discard_const_p(char *, kwnames),
1624 : &bigendian_obj,
1625 : &ndr64_obj)) {
1626 0 : return NULL;
1627 : }
1628 :
1629 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1630 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
1631 : }
1632 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1633 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
1634 : }
1635 :
1636 0 : return py_winreg_OpenHKCR_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
1637 : }
1638 :
1639 0 : static PyObject *py_winreg_OpenHKCR_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1640 : {
1641 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
1642 0 : PyObject *bigendian_obj = NULL;
1643 0 : PyObject *ndr64_obj = NULL;
1644 0 : uint32_t ndr_push_flags = 0;
1645 :
1646 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
1647 : discard_const_p(char *, kwnames),
1648 : &bigendian_obj,
1649 : &ndr64_obj)) {
1650 0 : return NULL;
1651 : }
1652 :
1653 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1654 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
1655 : }
1656 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1657 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
1658 : }
1659 :
1660 0 : return py_winreg_OpenHKCR_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
1661 : }
1662 :
1663 0 : static PyObject *py_winreg_OpenHKCR_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
1664 : {
1665 0 : const struct ndr_interface_call *call = NULL;
1666 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(py_obj);
1667 0 : struct ndr_pull *pull = NULL;
1668 : enum ndr_err_code err;
1669 :
1670 0 : if (ndr_table_winreg.num_calls < 1) {
1671 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCR_ndr_unpack");
1672 0 : return NULL;
1673 : }
1674 0 : call = &ndr_table_winreg.calls[0];
1675 :
1676 0 : pull = ndr_pull_init_blob(blob, object);
1677 0 : if (pull == NULL) {
1678 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1679 0 : return NULL;
1680 : }
1681 :
1682 0 : pull->flags |= ndr_pull_flags;
1683 :
1684 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
1685 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1686 0 : TALLOC_FREE(pull);
1687 0 : PyErr_SetNdrError(err);
1688 0 : return NULL;
1689 : }
1690 0 : if (!allow_remaining) {
1691 : uint32_t highest_ofs;
1692 :
1693 0 : if (pull->offset > pull->relative_highest_offset) {
1694 0 : highest_ofs = pull->offset;
1695 : } else {
1696 0 : highest_ofs = pull->relative_highest_offset;
1697 : }
1698 0 : if (highest_ofs < pull->data_size) {
1699 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
1700 : "not all bytes consumed ofs[%u] size[%u]",
1701 : highest_ofs, pull->data_size);
1702 0 : TALLOC_FREE(pull);
1703 0 : PyErr_SetNdrError(err);
1704 0 : return NULL;
1705 : }
1706 : }
1707 :
1708 0 : TALLOC_FREE(pull);
1709 0 : Py_RETURN_NONE;
1710 : }
1711 :
1712 0 : static PyObject *py_winreg_OpenHKCR_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1713 : {
1714 : DATA_BLOB blob;
1715 0 : Py_ssize_t blob_length = 0;
1716 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
1717 0 : PyObject *bigendian_obj = NULL;
1718 0 : PyObject *ndr64_obj = NULL;
1719 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
1720 0 : PyObject *allow_remaining_obj = NULL;
1721 0 : bool allow_remaining = false;
1722 :
1723 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
1724 : discard_const_p(char *, kwnames),
1725 : &blob.data, &blob_length,
1726 : &bigendian_obj,
1727 : &ndr64_obj,
1728 : &allow_remaining_obj)) {
1729 0 : return NULL;
1730 : }
1731 0 : blob.length = blob_length;
1732 :
1733 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1734 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
1735 : }
1736 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1737 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
1738 : }
1739 :
1740 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1741 0 : allow_remaining = true;
1742 : }
1743 :
1744 0 : return py_winreg_OpenHKCR_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
1745 : }
1746 :
1747 0 : static PyObject *py_winreg_OpenHKCR_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1748 : {
1749 : DATA_BLOB blob;
1750 0 : Py_ssize_t blob_length = 0;
1751 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
1752 0 : PyObject *bigendian_obj = NULL;
1753 0 : PyObject *ndr64_obj = NULL;
1754 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
1755 0 : PyObject *allow_remaining_obj = NULL;
1756 0 : bool allow_remaining = false;
1757 :
1758 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
1759 : discard_const_p(char *, kwnames),
1760 : &blob.data, &blob_length,
1761 : &bigendian_obj,
1762 : &ndr64_obj,
1763 : &allow_remaining_obj)) {
1764 0 : return NULL;
1765 : }
1766 0 : blob.length = blob_length;
1767 :
1768 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
1769 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
1770 : }
1771 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
1772 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
1773 : }
1774 :
1775 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1776 0 : allow_remaining = true;
1777 : }
1778 :
1779 0 : return py_winreg_OpenHKCR_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
1780 : }
1781 :
1782 0 : static PyObject *py_winreg_OpenHKCR_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
1783 : {
1784 0 : const struct ndr_interface_call *call = NULL;
1785 0 : struct winreg_OpenHKCR *object = (struct winreg_OpenHKCR *)pytalloc_get_ptr(py_obj);
1786 : PyObject *ret;
1787 : char *retstr;
1788 :
1789 0 : if (ndr_table_winreg.num_calls < 1) {
1790 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCR_ndr_print");
1791 0 : return NULL;
1792 : }
1793 0 : call = &ndr_table_winreg.calls[0];
1794 :
1795 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
1796 0 : ret = PyUnicode_FromString(retstr);
1797 0 : TALLOC_FREE(retstr);
1798 :
1799 0 : return ret;
1800 : }
1801 :
1802 0 : static PyObject *py_winreg_OpenHKCR_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1803 : {
1804 0 : return py_winreg_OpenHKCR_ndr_print(py_obj, "winreg_OpenHKCR_in", NDR_IN);
1805 : }
1806 :
1807 0 : static PyObject *py_winreg_OpenHKCR_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1808 : {
1809 0 : return py_winreg_OpenHKCR_ndr_print(py_obj, "winreg_OpenHKCR_out", NDR_OUT);
1810 : }
1811 :
1812 : static PyMethodDef py_winreg_OpenHKCR_methods[] = {
1813 : { "opnum", (PyCFunction)py_winreg_OpenHKCR_ndr_opnum, METH_NOARGS|METH_CLASS,
1814 : "winreg.OpenHKCR.opnum() -> 0 (0x00) " },
1815 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
1816 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
1817 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
1818 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
1819 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
1820 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
1821 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCR_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
1822 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
1823 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKCR_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
1824 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKCR_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
1825 : { NULL, NULL, 0, NULL }
1826 : };
1827 :
1828 :
1829 : static PyTypeObject winreg_OpenHKCR_Type = {
1830 : PyVarObject_HEAD_INIT(NULL, 0)
1831 : .tp_name = "winreg.OpenHKCR",
1832 : .tp_getset = py_winreg_OpenHKCR_getsetters,
1833 : .tp_methods = py_winreg_OpenHKCR_methods,
1834 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1835 : .tp_new = py_winreg_OpenHKCR_new,
1836 : };
1837 :
1838 0 : static bool pack_py_winreg_OpenHKCR_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCR *r)
1839 : {
1840 : PyObject *py_system_name;
1841 : PyObject *py_access_mask;
1842 0 : const char *kwnames[] = {
1843 : "system_name", "access_mask", NULL
1844 : };
1845 :
1846 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCR", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
1847 0 : return false;
1848 : }
1849 :
1850 0 : if (py_system_name == NULL) {
1851 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
1852 0 : return false;
1853 : }
1854 0 : if (py_system_name == Py_None) {
1855 0 : r->in.system_name = NULL;
1856 : } else {
1857 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
1858 0 : if (r->in.system_name == NULL) {
1859 0 : PyErr_NoMemory();
1860 0 : return false;
1861 : }
1862 : {
1863 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
1864 0 : if (PyLong_Check(py_system_name)) {
1865 : unsigned long long test_var;
1866 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
1867 0 : if (PyErr_Occurred() != NULL) {
1868 0 : return false;
1869 : }
1870 0 : if (test_var > uint_max) {
1871 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1872 : PyLong_Type.tp_name, uint_max, test_var);
1873 0 : return false;
1874 : }
1875 0 : *r->in.system_name = test_var;
1876 : } else {
1877 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1878 : PyLong_Type.tp_name);
1879 0 : return false;
1880 : }
1881 : }
1882 : }
1883 0 : if (py_access_mask == NULL) {
1884 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
1885 0 : return false;
1886 : }
1887 : {
1888 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
1889 0 : if (PyLong_Check(py_access_mask)) {
1890 : unsigned long long test_var;
1891 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
1892 0 : if (PyErr_Occurred() != NULL) {
1893 0 : return false;
1894 : }
1895 0 : if (test_var > uint_max) {
1896 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1897 : PyLong_Type.tp_name, uint_max, test_var);
1898 0 : return false;
1899 : }
1900 0 : r->in.access_mask = test_var;
1901 : } else {
1902 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1903 : PyLong_Type.tp_name);
1904 0 : return false;
1905 : }
1906 : }
1907 0 : return true;
1908 : }
1909 :
1910 0 : static PyObject *unpack_py_winreg_OpenHKCR_args_out(struct winreg_OpenHKCR *r)
1911 : {
1912 : PyObject *result;
1913 : PyObject *py_handle;
1914 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
1915 0 : result = py_handle;
1916 0 : if (!W_ERROR_IS_OK(r->out.result)) {
1917 0 : PyErr_SetWERROR(r->out.result);
1918 0 : return NULL;
1919 : }
1920 :
1921 0 : return result;
1922 : }
1923 :
1924 :
1925 0 : static PyObject *py_winreg_OpenHKCU_in_get_system_name(PyObject *obj, void *closure)
1926 : {
1927 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(obj);
1928 : PyObject *py_system_name;
1929 0 : if (object->in.system_name == NULL) {
1930 0 : Py_RETURN_NONE;
1931 : }
1932 0 : if (object->in.system_name == NULL) {
1933 0 : py_system_name = Py_None;
1934 0 : Py_INCREF(py_system_name);
1935 : } else {
1936 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
1937 : }
1938 0 : return py_system_name;
1939 : }
1940 :
1941 0 : static int py_winreg_OpenHKCU_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
1942 : {
1943 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(py_obj);
1944 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
1945 0 : if (value == NULL) {
1946 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
1947 0 : return -1;
1948 : }
1949 0 : if (value == Py_None) {
1950 0 : object->in.system_name = NULL;
1951 : } else {
1952 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
1953 0 : if (object->in.system_name == NULL) {
1954 0 : PyErr_NoMemory();
1955 0 : return -1;
1956 : }
1957 : {
1958 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
1959 0 : if (PyLong_Check(value)) {
1960 : unsigned long long test_var;
1961 0 : test_var = PyLong_AsUnsignedLongLong(value);
1962 0 : if (PyErr_Occurred() != NULL) {
1963 0 : return -1;
1964 : }
1965 0 : if (test_var > uint_max) {
1966 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1967 : PyLong_Type.tp_name, uint_max, test_var);
1968 0 : return -1;
1969 : }
1970 0 : *object->in.system_name = test_var;
1971 : } else {
1972 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1973 : PyLong_Type.tp_name);
1974 0 : return -1;
1975 : }
1976 : }
1977 : }
1978 0 : return 0;
1979 : }
1980 :
1981 0 : static PyObject *py_winreg_OpenHKCU_in_get_access_mask(PyObject *obj, void *closure)
1982 : {
1983 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(obj);
1984 : PyObject *py_access_mask;
1985 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
1986 0 : return py_access_mask;
1987 : }
1988 :
1989 0 : static int py_winreg_OpenHKCU_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
1990 : {
1991 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(py_obj);
1992 0 : if (value == NULL) {
1993 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
1994 0 : return -1;
1995 : }
1996 : {
1997 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
1998 0 : if (PyLong_Check(value)) {
1999 : unsigned long long test_var;
2000 0 : test_var = PyLong_AsUnsignedLongLong(value);
2001 0 : if (PyErr_Occurred() != NULL) {
2002 0 : return -1;
2003 : }
2004 0 : if (test_var > uint_max) {
2005 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2006 : PyLong_Type.tp_name, uint_max, test_var);
2007 0 : return -1;
2008 : }
2009 0 : object->in.access_mask = test_var;
2010 : } else {
2011 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2012 : PyLong_Type.tp_name);
2013 0 : return -1;
2014 : }
2015 : }
2016 0 : return 0;
2017 : }
2018 :
2019 0 : static PyObject *py_winreg_OpenHKCU_out_get_handle(PyObject *obj, void *closure)
2020 : {
2021 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(obj);
2022 : PyObject *py_handle;
2023 0 : if (object->out.handle == NULL) {
2024 0 : Py_RETURN_NONE;
2025 : }
2026 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
2027 0 : return py_handle;
2028 : }
2029 :
2030 0 : static int py_winreg_OpenHKCU_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
2031 : {
2032 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(py_obj);
2033 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
2034 0 : if (value == NULL) {
2035 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
2036 0 : return -1;
2037 : }
2038 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
2039 0 : if (object->out.handle == NULL) {
2040 0 : PyErr_NoMemory();
2041 0 : return -1;
2042 : }
2043 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
2044 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2045 0 : PyErr_NoMemory();
2046 0 : return -1;
2047 : }
2048 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
2049 0 : return 0;
2050 : }
2051 :
2052 0 : static PyObject *py_winreg_OpenHKCU_get_result(PyObject *obj, void *closure)
2053 : {
2054 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(obj);
2055 : PyObject *py_result;
2056 0 : py_result = PyErr_FromWERROR(object->out.result);
2057 0 : return py_result;
2058 : }
2059 :
2060 0 : static int py_winreg_OpenHKCU_set_result(PyObject *py_obj, PyObject *value, void *closure)
2061 : {
2062 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(py_obj);
2063 0 : if (value == NULL) {
2064 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
2065 0 : return -1;
2066 : }
2067 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
2068 0 : return 0;
2069 : }
2070 :
2071 : static PyGetSetDef py_winreg_OpenHKCU_getsetters[] = {
2072 : {
2073 : .name = discard_const_p(char, "in_system_name"),
2074 : .get = py_winreg_OpenHKCU_in_get_system_name,
2075 : .set = py_winreg_OpenHKCU_in_set_system_name,
2076 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2077 : },
2078 : {
2079 : .name = discard_const_p(char, "in_access_mask"),
2080 : .get = py_winreg_OpenHKCU_in_get_access_mask,
2081 : .set = py_winreg_OpenHKCU_in_set_access_mask,
2082 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
2083 : },
2084 : {
2085 : .name = discard_const_p(char, "out_handle"),
2086 : .get = py_winreg_OpenHKCU_out_get_handle,
2087 : .set = py_winreg_OpenHKCU_out_set_handle,
2088 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
2089 : },
2090 : {
2091 : .name = discard_const_p(char, "result"),
2092 : .get = py_winreg_OpenHKCU_get_result,
2093 : .set = py_winreg_OpenHKCU_set_result,
2094 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
2095 : },
2096 : { .name = NULL }
2097 : };
2098 :
2099 0 : static PyObject *py_winreg_OpenHKCU_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2100 : {
2101 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKCU, type);
2102 0 : struct winreg_OpenHKCU *_self = (struct winreg_OpenHKCU *)pytalloc_get_ptr(self);
2103 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
2104 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
2105 0 : return self;
2106 : }
2107 :
2108 0 : static PyObject *py_winreg_OpenHKCU_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
2109 : {
2110 :
2111 :
2112 0 : return PyLong_FromLong(1);
2113 : }
2114 :
2115 0 : static PyObject *py_winreg_OpenHKCU_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
2116 : {
2117 0 : const struct ndr_interface_call *call = NULL;
2118 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(py_obj);
2119 0 : PyObject *ret = NULL;
2120 0 : struct ndr_push *push = NULL;
2121 : DATA_BLOB blob;
2122 : enum ndr_err_code err;
2123 :
2124 0 : if (ndr_table_winreg.num_calls < 2) {
2125 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCU_ndr_pack");
2126 0 : return NULL;
2127 : }
2128 0 : call = &ndr_table_winreg.calls[1];
2129 :
2130 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
2131 0 : if (push == NULL) {
2132 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2133 0 : return NULL;
2134 : }
2135 :
2136 0 : push->flags |= ndr_push_flags;
2137 :
2138 0 : err = call->ndr_push(push, ndr_inout_flags, object);
2139 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2140 0 : TALLOC_FREE(push);
2141 0 : PyErr_SetNdrError(err);
2142 0 : return NULL;
2143 : }
2144 0 : blob = ndr_push_blob(push);
2145 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2146 0 : TALLOC_FREE(push);
2147 0 : return ret;
2148 : }
2149 :
2150 0 : static PyObject *py_winreg_OpenHKCU_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2151 : {
2152 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2153 0 : PyObject *bigendian_obj = NULL;
2154 0 : PyObject *ndr64_obj = NULL;
2155 0 : uint32_t ndr_push_flags = 0;
2156 :
2157 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
2158 : discard_const_p(char *, kwnames),
2159 : &bigendian_obj,
2160 : &ndr64_obj)) {
2161 0 : return NULL;
2162 : }
2163 :
2164 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2165 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2166 : }
2167 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2168 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2169 : }
2170 :
2171 0 : return py_winreg_OpenHKCU_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
2172 : }
2173 :
2174 0 : static PyObject *py_winreg_OpenHKCU_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2175 : {
2176 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2177 0 : PyObject *bigendian_obj = NULL;
2178 0 : PyObject *ndr64_obj = NULL;
2179 0 : uint32_t ndr_push_flags = 0;
2180 :
2181 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
2182 : discard_const_p(char *, kwnames),
2183 : &bigendian_obj,
2184 : &ndr64_obj)) {
2185 0 : return NULL;
2186 : }
2187 :
2188 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2189 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2190 : }
2191 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2192 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2193 : }
2194 :
2195 0 : return py_winreg_OpenHKCU_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
2196 : }
2197 :
2198 0 : static PyObject *py_winreg_OpenHKCU_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
2199 : {
2200 0 : const struct ndr_interface_call *call = NULL;
2201 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(py_obj);
2202 0 : struct ndr_pull *pull = NULL;
2203 : enum ndr_err_code err;
2204 :
2205 0 : if (ndr_table_winreg.num_calls < 2) {
2206 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCU_ndr_unpack");
2207 0 : return NULL;
2208 : }
2209 0 : call = &ndr_table_winreg.calls[1];
2210 :
2211 0 : pull = ndr_pull_init_blob(blob, object);
2212 0 : if (pull == NULL) {
2213 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2214 0 : return NULL;
2215 : }
2216 :
2217 0 : pull->flags |= ndr_pull_flags;
2218 :
2219 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
2220 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2221 0 : TALLOC_FREE(pull);
2222 0 : PyErr_SetNdrError(err);
2223 0 : return NULL;
2224 : }
2225 0 : if (!allow_remaining) {
2226 : uint32_t highest_ofs;
2227 :
2228 0 : if (pull->offset > pull->relative_highest_offset) {
2229 0 : highest_ofs = pull->offset;
2230 : } else {
2231 0 : highest_ofs = pull->relative_highest_offset;
2232 : }
2233 0 : if (highest_ofs < pull->data_size) {
2234 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
2235 : "not all bytes consumed ofs[%u] size[%u]",
2236 : highest_ofs, pull->data_size);
2237 0 : TALLOC_FREE(pull);
2238 0 : PyErr_SetNdrError(err);
2239 0 : return NULL;
2240 : }
2241 : }
2242 :
2243 0 : TALLOC_FREE(pull);
2244 0 : Py_RETURN_NONE;
2245 : }
2246 :
2247 0 : static PyObject *py_winreg_OpenHKCU_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2248 : {
2249 : DATA_BLOB blob;
2250 0 : Py_ssize_t blob_length = 0;
2251 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2252 0 : PyObject *bigendian_obj = NULL;
2253 0 : PyObject *ndr64_obj = NULL;
2254 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2255 0 : PyObject *allow_remaining_obj = NULL;
2256 0 : bool allow_remaining = false;
2257 :
2258 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
2259 : discard_const_p(char *, kwnames),
2260 : &blob.data, &blob_length,
2261 : &bigendian_obj,
2262 : &ndr64_obj,
2263 : &allow_remaining_obj)) {
2264 0 : return NULL;
2265 : }
2266 0 : blob.length = blob_length;
2267 :
2268 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2269 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2270 : }
2271 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2272 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2273 : }
2274 :
2275 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2276 0 : allow_remaining = true;
2277 : }
2278 :
2279 0 : return py_winreg_OpenHKCU_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
2280 : }
2281 :
2282 0 : static PyObject *py_winreg_OpenHKCU_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2283 : {
2284 : DATA_BLOB blob;
2285 0 : Py_ssize_t blob_length = 0;
2286 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2287 0 : PyObject *bigendian_obj = NULL;
2288 0 : PyObject *ndr64_obj = NULL;
2289 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2290 0 : PyObject *allow_remaining_obj = NULL;
2291 0 : bool allow_remaining = false;
2292 :
2293 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
2294 : discard_const_p(char *, kwnames),
2295 : &blob.data, &blob_length,
2296 : &bigendian_obj,
2297 : &ndr64_obj,
2298 : &allow_remaining_obj)) {
2299 0 : return NULL;
2300 : }
2301 0 : blob.length = blob_length;
2302 :
2303 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2304 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2305 : }
2306 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2307 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2308 : }
2309 :
2310 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2311 0 : allow_remaining = true;
2312 : }
2313 :
2314 0 : return py_winreg_OpenHKCU_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
2315 : }
2316 :
2317 0 : static PyObject *py_winreg_OpenHKCU_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
2318 : {
2319 0 : const struct ndr_interface_call *call = NULL;
2320 0 : struct winreg_OpenHKCU *object = (struct winreg_OpenHKCU *)pytalloc_get_ptr(py_obj);
2321 : PyObject *ret;
2322 : char *retstr;
2323 :
2324 0 : if (ndr_table_winreg.num_calls < 2) {
2325 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCU_ndr_print");
2326 0 : return NULL;
2327 : }
2328 0 : call = &ndr_table_winreg.calls[1];
2329 :
2330 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
2331 0 : ret = PyUnicode_FromString(retstr);
2332 0 : TALLOC_FREE(retstr);
2333 :
2334 0 : return ret;
2335 : }
2336 :
2337 0 : static PyObject *py_winreg_OpenHKCU_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2338 : {
2339 0 : return py_winreg_OpenHKCU_ndr_print(py_obj, "winreg_OpenHKCU_in", NDR_IN);
2340 : }
2341 :
2342 0 : static PyObject *py_winreg_OpenHKCU_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2343 : {
2344 0 : return py_winreg_OpenHKCU_ndr_print(py_obj, "winreg_OpenHKCU_out", NDR_OUT);
2345 : }
2346 :
2347 : static PyMethodDef py_winreg_OpenHKCU_methods[] = {
2348 : { "opnum", (PyCFunction)py_winreg_OpenHKCU_ndr_opnum, METH_NOARGS|METH_CLASS,
2349 : "winreg.OpenHKCU.opnum() -> 1 (0x01) " },
2350 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
2351 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
2352 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
2353 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
2354 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
2355 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
2356 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCU_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
2357 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
2358 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKCU_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
2359 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKCU_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
2360 : { NULL, NULL, 0, NULL }
2361 : };
2362 :
2363 :
2364 : static PyTypeObject winreg_OpenHKCU_Type = {
2365 : PyVarObject_HEAD_INIT(NULL, 0)
2366 : .tp_name = "winreg.OpenHKCU",
2367 : .tp_getset = py_winreg_OpenHKCU_getsetters,
2368 : .tp_methods = py_winreg_OpenHKCU_methods,
2369 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2370 : .tp_new = py_winreg_OpenHKCU_new,
2371 : };
2372 :
2373 0 : static bool pack_py_winreg_OpenHKCU_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCU *r)
2374 : {
2375 : PyObject *py_system_name;
2376 : PyObject *py_access_mask;
2377 0 : const char *kwnames[] = {
2378 : "system_name", "access_mask", NULL
2379 : };
2380 :
2381 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCU", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2382 0 : return false;
2383 : }
2384 :
2385 0 : if (py_system_name == NULL) {
2386 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
2387 0 : return false;
2388 : }
2389 0 : if (py_system_name == Py_None) {
2390 0 : r->in.system_name = NULL;
2391 : } else {
2392 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2393 0 : if (r->in.system_name == NULL) {
2394 0 : PyErr_NoMemory();
2395 0 : return false;
2396 : }
2397 : {
2398 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
2399 0 : if (PyLong_Check(py_system_name)) {
2400 : unsigned long long test_var;
2401 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
2402 0 : if (PyErr_Occurred() != NULL) {
2403 0 : return false;
2404 : }
2405 0 : if (test_var > uint_max) {
2406 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2407 : PyLong_Type.tp_name, uint_max, test_var);
2408 0 : return false;
2409 : }
2410 0 : *r->in.system_name = test_var;
2411 : } else {
2412 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2413 : PyLong_Type.tp_name);
2414 0 : return false;
2415 : }
2416 : }
2417 : }
2418 0 : if (py_access_mask == NULL) {
2419 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
2420 0 : return false;
2421 : }
2422 : {
2423 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
2424 0 : if (PyLong_Check(py_access_mask)) {
2425 : unsigned long long test_var;
2426 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
2427 0 : if (PyErr_Occurred() != NULL) {
2428 0 : return false;
2429 : }
2430 0 : if (test_var > uint_max) {
2431 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2432 : PyLong_Type.tp_name, uint_max, test_var);
2433 0 : return false;
2434 : }
2435 0 : r->in.access_mask = test_var;
2436 : } else {
2437 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2438 : PyLong_Type.tp_name);
2439 0 : return false;
2440 : }
2441 : }
2442 0 : return true;
2443 : }
2444 :
2445 0 : static PyObject *unpack_py_winreg_OpenHKCU_args_out(struct winreg_OpenHKCU *r)
2446 : {
2447 : PyObject *result;
2448 : PyObject *py_handle;
2449 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2450 0 : result = py_handle;
2451 0 : if (!W_ERROR_IS_OK(r->out.result)) {
2452 0 : PyErr_SetWERROR(r->out.result);
2453 0 : return NULL;
2454 : }
2455 :
2456 0 : return result;
2457 : }
2458 :
2459 :
2460 0 : static PyObject *py_winreg_OpenHKLM_in_get_system_name(PyObject *obj, void *closure)
2461 : {
2462 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(obj);
2463 : PyObject *py_system_name;
2464 0 : if (object->in.system_name == NULL) {
2465 0 : Py_RETURN_NONE;
2466 : }
2467 0 : if (object->in.system_name == NULL) {
2468 0 : py_system_name = Py_None;
2469 0 : Py_INCREF(py_system_name);
2470 : } else {
2471 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
2472 : }
2473 0 : return py_system_name;
2474 : }
2475 :
2476 0 : static int py_winreg_OpenHKLM_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
2477 : {
2478 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(py_obj);
2479 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
2480 0 : if (value == NULL) {
2481 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
2482 0 : return -1;
2483 : }
2484 0 : if (value == Py_None) {
2485 0 : object->in.system_name = NULL;
2486 : } else {
2487 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
2488 0 : if (object->in.system_name == NULL) {
2489 0 : PyErr_NoMemory();
2490 0 : return -1;
2491 : }
2492 : {
2493 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
2494 0 : if (PyLong_Check(value)) {
2495 : unsigned long long test_var;
2496 0 : test_var = PyLong_AsUnsignedLongLong(value);
2497 0 : if (PyErr_Occurred() != NULL) {
2498 0 : return -1;
2499 : }
2500 0 : if (test_var > uint_max) {
2501 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2502 : PyLong_Type.tp_name, uint_max, test_var);
2503 0 : return -1;
2504 : }
2505 0 : *object->in.system_name = test_var;
2506 : } else {
2507 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2508 : PyLong_Type.tp_name);
2509 0 : return -1;
2510 : }
2511 : }
2512 : }
2513 0 : return 0;
2514 : }
2515 :
2516 0 : static PyObject *py_winreg_OpenHKLM_in_get_access_mask(PyObject *obj, void *closure)
2517 : {
2518 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(obj);
2519 : PyObject *py_access_mask;
2520 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
2521 0 : return py_access_mask;
2522 : }
2523 :
2524 0 : static int py_winreg_OpenHKLM_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
2525 : {
2526 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(py_obj);
2527 0 : if (value == NULL) {
2528 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
2529 0 : return -1;
2530 : }
2531 : {
2532 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
2533 0 : if (PyLong_Check(value)) {
2534 : unsigned long long test_var;
2535 0 : test_var = PyLong_AsUnsignedLongLong(value);
2536 0 : if (PyErr_Occurred() != NULL) {
2537 0 : return -1;
2538 : }
2539 0 : if (test_var > uint_max) {
2540 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2541 : PyLong_Type.tp_name, uint_max, test_var);
2542 0 : return -1;
2543 : }
2544 0 : object->in.access_mask = test_var;
2545 : } else {
2546 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2547 : PyLong_Type.tp_name);
2548 0 : return -1;
2549 : }
2550 : }
2551 0 : return 0;
2552 : }
2553 :
2554 0 : static PyObject *py_winreg_OpenHKLM_out_get_handle(PyObject *obj, void *closure)
2555 : {
2556 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(obj);
2557 : PyObject *py_handle;
2558 0 : if (object->out.handle == NULL) {
2559 0 : Py_RETURN_NONE;
2560 : }
2561 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
2562 0 : return py_handle;
2563 : }
2564 :
2565 0 : static int py_winreg_OpenHKLM_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
2566 : {
2567 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(py_obj);
2568 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
2569 0 : if (value == NULL) {
2570 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
2571 0 : return -1;
2572 : }
2573 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
2574 0 : if (object->out.handle == NULL) {
2575 0 : PyErr_NoMemory();
2576 0 : return -1;
2577 : }
2578 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
2579 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2580 0 : PyErr_NoMemory();
2581 0 : return -1;
2582 : }
2583 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
2584 0 : return 0;
2585 : }
2586 :
2587 0 : static PyObject *py_winreg_OpenHKLM_get_result(PyObject *obj, void *closure)
2588 : {
2589 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(obj);
2590 : PyObject *py_result;
2591 0 : py_result = PyErr_FromWERROR(object->out.result);
2592 0 : return py_result;
2593 : }
2594 :
2595 0 : static int py_winreg_OpenHKLM_set_result(PyObject *py_obj, PyObject *value, void *closure)
2596 : {
2597 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(py_obj);
2598 0 : if (value == NULL) {
2599 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
2600 0 : return -1;
2601 : }
2602 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
2603 0 : return 0;
2604 : }
2605 :
2606 : static PyGetSetDef py_winreg_OpenHKLM_getsetters[] = {
2607 : {
2608 : .name = discard_const_p(char, "in_system_name"),
2609 : .get = py_winreg_OpenHKLM_in_get_system_name,
2610 : .set = py_winreg_OpenHKLM_in_set_system_name,
2611 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2612 : },
2613 : {
2614 : .name = discard_const_p(char, "in_access_mask"),
2615 : .get = py_winreg_OpenHKLM_in_get_access_mask,
2616 : .set = py_winreg_OpenHKLM_in_set_access_mask,
2617 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
2618 : },
2619 : {
2620 : .name = discard_const_p(char, "out_handle"),
2621 : .get = py_winreg_OpenHKLM_out_get_handle,
2622 : .set = py_winreg_OpenHKLM_out_set_handle,
2623 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
2624 : },
2625 : {
2626 : .name = discard_const_p(char, "result"),
2627 : .get = py_winreg_OpenHKLM_get_result,
2628 : .set = py_winreg_OpenHKLM_set_result,
2629 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
2630 : },
2631 : { .name = NULL }
2632 : };
2633 :
2634 0 : static PyObject *py_winreg_OpenHKLM_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2635 : {
2636 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKLM, type);
2637 0 : struct winreg_OpenHKLM *_self = (struct winreg_OpenHKLM *)pytalloc_get_ptr(self);
2638 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
2639 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
2640 0 : return self;
2641 : }
2642 :
2643 0 : static PyObject *py_winreg_OpenHKLM_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
2644 : {
2645 :
2646 :
2647 0 : return PyLong_FromLong(2);
2648 : }
2649 :
2650 0 : static PyObject *py_winreg_OpenHKLM_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
2651 : {
2652 0 : const struct ndr_interface_call *call = NULL;
2653 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(py_obj);
2654 0 : PyObject *ret = NULL;
2655 0 : struct ndr_push *push = NULL;
2656 : DATA_BLOB blob;
2657 : enum ndr_err_code err;
2658 :
2659 0 : if (ndr_table_winreg.num_calls < 3) {
2660 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKLM_ndr_pack");
2661 0 : return NULL;
2662 : }
2663 0 : call = &ndr_table_winreg.calls[2];
2664 :
2665 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
2666 0 : if (push == NULL) {
2667 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2668 0 : return NULL;
2669 : }
2670 :
2671 0 : push->flags |= ndr_push_flags;
2672 :
2673 0 : err = call->ndr_push(push, ndr_inout_flags, object);
2674 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2675 0 : TALLOC_FREE(push);
2676 0 : PyErr_SetNdrError(err);
2677 0 : return NULL;
2678 : }
2679 0 : blob = ndr_push_blob(push);
2680 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2681 0 : TALLOC_FREE(push);
2682 0 : return ret;
2683 : }
2684 :
2685 0 : static PyObject *py_winreg_OpenHKLM_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2686 : {
2687 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2688 0 : PyObject *bigendian_obj = NULL;
2689 0 : PyObject *ndr64_obj = NULL;
2690 0 : uint32_t ndr_push_flags = 0;
2691 :
2692 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
2693 : discard_const_p(char *, kwnames),
2694 : &bigendian_obj,
2695 : &ndr64_obj)) {
2696 0 : return NULL;
2697 : }
2698 :
2699 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2700 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2701 : }
2702 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2703 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2704 : }
2705 :
2706 0 : return py_winreg_OpenHKLM_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
2707 : }
2708 :
2709 0 : static PyObject *py_winreg_OpenHKLM_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2710 : {
2711 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
2712 0 : PyObject *bigendian_obj = NULL;
2713 0 : PyObject *ndr64_obj = NULL;
2714 0 : uint32_t ndr_push_flags = 0;
2715 :
2716 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
2717 : discard_const_p(char *, kwnames),
2718 : &bigendian_obj,
2719 : &ndr64_obj)) {
2720 0 : return NULL;
2721 : }
2722 :
2723 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2724 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
2725 : }
2726 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2727 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
2728 : }
2729 :
2730 0 : return py_winreg_OpenHKLM_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
2731 : }
2732 :
2733 0 : static PyObject *py_winreg_OpenHKLM_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
2734 : {
2735 0 : const struct ndr_interface_call *call = NULL;
2736 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(py_obj);
2737 0 : struct ndr_pull *pull = NULL;
2738 : enum ndr_err_code err;
2739 :
2740 0 : if (ndr_table_winreg.num_calls < 3) {
2741 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKLM_ndr_unpack");
2742 0 : return NULL;
2743 : }
2744 0 : call = &ndr_table_winreg.calls[2];
2745 :
2746 0 : pull = ndr_pull_init_blob(blob, object);
2747 0 : if (pull == NULL) {
2748 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2749 0 : return NULL;
2750 : }
2751 :
2752 0 : pull->flags |= ndr_pull_flags;
2753 :
2754 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
2755 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2756 0 : TALLOC_FREE(pull);
2757 0 : PyErr_SetNdrError(err);
2758 0 : return NULL;
2759 : }
2760 0 : if (!allow_remaining) {
2761 : uint32_t highest_ofs;
2762 :
2763 0 : if (pull->offset > pull->relative_highest_offset) {
2764 0 : highest_ofs = pull->offset;
2765 : } else {
2766 0 : highest_ofs = pull->relative_highest_offset;
2767 : }
2768 0 : if (highest_ofs < pull->data_size) {
2769 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
2770 : "not all bytes consumed ofs[%u] size[%u]",
2771 : highest_ofs, pull->data_size);
2772 0 : TALLOC_FREE(pull);
2773 0 : PyErr_SetNdrError(err);
2774 0 : return NULL;
2775 : }
2776 : }
2777 :
2778 0 : TALLOC_FREE(pull);
2779 0 : Py_RETURN_NONE;
2780 : }
2781 :
2782 0 : static PyObject *py_winreg_OpenHKLM_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2783 : {
2784 : DATA_BLOB blob;
2785 0 : Py_ssize_t blob_length = 0;
2786 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2787 0 : PyObject *bigendian_obj = NULL;
2788 0 : PyObject *ndr64_obj = NULL;
2789 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2790 0 : PyObject *allow_remaining_obj = NULL;
2791 0 : bool allow_remaining = false;
2792 :
2793 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
2794 : discard_const_p(char *, kwnames),
2795 : &blob.data, &blob_length,
2796 : &bigendian_obj,
2797 : &ndr64_obj,
2798 : &allow_remaining_obj)) {
2799 0 : return NULL;
2800 : }
2801 0 : blob.length = blob_length;
2802 :
2803 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2804 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2805 : }
2806 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2807 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2808 : }
2809 :
2810 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2811 0 : allow_remaining = true;
2812 : }
2813 :
2814 0 : return py_winreg_OpenHKLM_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
2815 : }
2816 :
2817 0 : static PyObject *py_winreg_OpenHKLM_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2818 : {
2819 : DATA_BLOB blob;
2820 0 : Py_ssize_t blob_length = 0;
2821 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
2822 0 : PyObject *bigendian_obj = NULL;
2823 0 : PyObject *ndr64_obj = NULL;
2824 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
2825 0 : PyObject *allow_remaining_obj = NULL;
2826 0 : bool allow_remaining = false;
2827 :
2828 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
2829 : discard_const_p(char *, kwnames),
2830 : &blob.data, &blob_length,
2831 : &bigendian_obj,
2832 : &ndr64_obj,
2833 : &allow_remaining_obj)) {
2834 0 : return NULL;
2835 : }
2836 0 : blob.length = blob_length;
2837 :
2838 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
2839 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
2840 : }
2841 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
2842 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
2843 : }
2844 :
2845 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2846 0 : allow_remaining = true;
2847 : }
2848 :
2849 0 : return py_winreg_OpenHKLM_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
2850 : }
2851 :
2852 0 : static PyObject *py_winreg_OpenHKLM_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
2853 : {
2854 0 : const struct ndr_interface_call *call = NULL;
2855 0 : struct winreg_OpenHKLM *object = (struct winreg_OpenHKLM *)pytalloc_get_ptr(py_obj);
2856 : PyObject *ret;
2857 : char *retstr;
2858 :
2859 0 : if (ndr_table_winreg.num_calls < 3) {
2860 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKLM_ndr_print");
2861 0 : return NULL;
2862 : }
2863 0 : call = &ndr_table_winreg.calls[2];
2864 :
2865 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
2866 0 : ret = PyUnicode_FromString(retstr);
2867 0 : TALLOC_FREE(retstr);
2868 :
2869 0 : return ret;
2870 : }
2871 :
2872 0 : static PyObject *py_winreg_OpenHKLM_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2873 : {
2874 0 : return py_winreg_OpenHKLM_ndr_print(py_obj, "winreg_OpenHKLM_in", NDR_IN);
2875 : }
2876 :
2877 0 : static PyObject *py_winreg_OpenHKLM_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2878 : {
2879 0 : return py_winreg_OpenHKLM_ndr_print(py_obj, "winreg_OpenHKLM_out", NDR_OUT);
2880 : }
2881 :
2882 : static PyMethodDef py_winreg_OpenHKLM_methods[] = {
2883 : { "opnum", (PyCFunction)py_winreg_OpenHKLM_ndr_opnum, METH_NOARGS|METH_CLASS,
2884 : "winreg.OpenHKLM.opnum() -> 2 (0x02) " },
2885 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
2886 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
2887 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
2888 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
2889 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
2890 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
2891 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKLM_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
2892 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
2893 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKLM_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
2894 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKLM_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
2895 : { NULL, NULL, 0, NULL }
2896 : };
2897 :
2898 :
2899 : static PyTypeObject winreg_OpenHKLM_Type = {
2900 : PyVarObject_HEAD_INIT(NULL, 0)
2901 : .tp_name = "winreg.OpenHKLM",
2902 : .tp_getset = py_winreg_OpenHKLM_getsetters,
2903 : .tp_methods = py_winreg_OpenHKLM_methods,
2904 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2905 : .tp_new = py_winreg_OpenHKLM_new,
2906 : };
2907 :
2908 3 : static bool pack_py_winreg_OpenHKLM_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKLM *r)
2909 : {
2910 : PyObject *py_system_name;
2911 : PyObject *py_access_mask;
2912 3 : const char *kwnames[] = {
2913 : "system_name", "access_mask", NULL
2914 : };
2915 :
2916 3 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKLM", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
2917 0 : return false;
2918 : }
2919 :
2920 3 : if (py_system_name == NULL) {
2921 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
2922 0 : return false;
2923 : }
2924 3 : if (py_system_name == Py_None) {
2925 3 : r->in.system_name = NULL;
2926 : } else {
2927 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
2928 0 : if (r->in.system_name == NULL) {
2929 0 : PyErr_NoMemory();
2930 0 : return false;
2931 : }
2932 : {
2933 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
2934 0 : if (PyLong_Check(py_system_name)) {
2935 : unsigned long long test_var;
2936 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
2937 0 : if (PyErr_Occurred() != NULL) {
2938 0 : return false;
2939 : }
2940 0 : if (test_var > uint_max) {
2941 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2942 : PyLong_Type.tp_name, uint_max, test_var);
2943 0 : return false;
2944 : }
2945 0 : *r->in.system_name = test_var;
2946 : } else {
2947 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2948 : PyLong_Type.tp_name);
2949 0 : return false;
2950 : }
2951 : }
2952 : }
2953 3 : if (py_access_mask == NULL) {
2954 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
2955 0 : return false;
2956 : }
2957 : {
2958 3 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
2959 3 : if (PyLong_Check(py_access_mask)) {
2960 : unsigned long long test_var;
2961 3 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
2962 3 : if (PyErr_Occurred() != NULL) {
2963 0 : return false;
2964 : }
2965 3 : if (test_var > uint_max) {
2966 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2967 : PyLong_Type.tp_name, uint_max, test_var);
2968 0 : return false;
2969 : }
2970 3 : r->in.access_mask = test_var;
2971 : } else {
2972 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2973 : PyLong_Type.tp_name);
2974 0 : return false;
2975 : }
2976 : }
2977 3 : return true;
2978 : }
2979 :
2980 3 : static PyObject *unpack_py_winreg_OpenHKLM_args_out(struct winreg_OpenHKLM *r)
2981 : {
2982 : PyObject *result;
2983 : PyObject *py_handle;
2984 3 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
2985 3 : result = py_handle;
2986 3 : if (!W_ERROR_IS_OK(r->out.result)) {
2987 0 : PyErr_SetWERROR(r->out.result);
2988 0 : return NULL;
2989 : }
2990 :
2991 3 : return result;
2992 : }
2993 :
2994 :
2995 0 : static PyObject *py_winreg_OpenHKPD_in_get_system_name(PyObject *obj, void *closure)
2996 : {
2997 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(obj);
2998 : PyObject *py_system_name;
2999 0 : if (object->in.system_name == NULL) {
3000 0 : Py_RETURN_NONE;
3001 : }
3002 0 : if (object->in.system_name == NULL) {
3003 0 : py_system_name = Py_None;
3004 0 : Py_INCREF(py_system_name);
3005 : } else {
3006 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
3007 : }
3008 0 : return py_system_name;
3009 : }
3010 :
3011 0 : static int py_winreg_OpenHKPD_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
3012 : {
3013 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(py_obj);
3014 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
3015 0 : if (value == NULL) {
3016 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
3017 0 : return -1;
3018 : }
3019 0 : if (value == Py_None) {
3020 0 : object->in.system_name = NULL;
3021 : } else {
3022 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
3023 0 : if (object->in.system_name == NULL) {
3024 0 : PyErr_NoMemory();
3025 0 : return -1;
3026 : }
3027 : {
3028 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
3029 0 : if (PyLong_Check(value)) {
3030 : unsigned long long test_var;
3031 0 : test_var = PyLong_AsUnsignedLongLong(value);
3032 0 : if (PyErr_Occurred() != NULL) {
3033 0 : return -1;
3034 : }
3035 0 : if (test_var > uint_max) {
3036 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3037 : PyLong_Type.tp_name, uint_max, test_var);
3038 0 : return -1;
3039 : }
3040 0 : *object->in.system_name = test_var;
3041 : } else {
3042 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3043 : PyLong_Type.tp_name);
3044 0 : return -1;
3045 : }
3046 : }
3047 : }
3048 0 : return 0;
3049 : }
3050 :
3051 0 : static PyObject *py_winreg_OpenHKPD_in_get_access_mask(PyObject *obj, void *closure)
3052 : {
3053 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(obj);
3054 : PyObject *py_access_mask;
3055 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
3056 0 : return py_access_mask;
3057 : }
3058 :
3059 0 : static int py_winreg_OpenHKPD_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
3060 : {
3061 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(py_obj);
3062 0 : if (value == NULL) {
3063 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
3064 0 : return -1;
3065 : }
3066 : {
3067 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
3068 0 : if (PyLong_Check(value)) {
3069 : unsigned long long test_var;
3070 0 : test_var = PyLong_AsUnsignedLongLong(value);
3071 0 : if (PyErr_Occurred() != NULL) {
3072 0 : return -1;
3073 : }
3074 0 : if (test_var > uint_max) {
3075 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3076 : PyLong_Type.tp_name, uint_max, test_var);
3077 0 : return -1;
3078 : }
3079 0 : object->in.access_mask = test_var;
3080 : } else {
3081 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3082 : PyLong_Type.tp_name);
3083 0 : return -1;
3084 : }
3085 : }
3086 0 : return 0;
3087 : }
3088 :
3089 0 : static PyObject *py_winreg_OpenHKPD_out_get_handle(PyObject *obj, void *closure)
3090 : {
3091 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(obj);
3092 : PyObject *py_handle;
3093 0 : if (object->out.handle == NULL) {
3094 0 : Py_RETURN_NONE;
3095 : }
3096 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
3097 0 : return py_handle;
3098 : }
3099 :
3100 0 : static int py_winreg_OpenHKPD_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
3101 : {
3102 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(py_obj);
3103 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
3104 0 : if (value == NULL) {
3105 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
3106 0 : return -1;
3107 : }
3108 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
3109 0 : if (object->out.handle == NULL) {
3110 0 : PyErr_NoMemory();
3111 0 : return -1;
3112 : }
3113 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
3114 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3115 0 : PyErr_NoMemory();
3116 0 : return -1;
3117 : }
3118 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
3119 0 : return 0;
3120 : }
3121 :
3122 0 : static PyObject *py_winreg_OpenHKPD_get_result(PyObject *obj, void *closure)
3123 : {
3124 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(obj);
3125 : PyObject *py_result;
3126 0 : py_result = PyErr_FromWERROR(object->out.result);
3127 0 : return py_result;
3128 : }
3129 :
3130 0 : static int py_winreg_OpenHKPD_set_result(PyObject *py_obj, PyObject *value, void *closure)
3131 : {
3132 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(py_obj);
3133 0 : if (value == NULL) {
3134 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
3135 0 : return -1;
3136 : }
3137 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
3138 0 : return 0;
3139 : }
3140 :
3141 : static PyGetSetDef py_winreg_OpenHKPD_getsetters[] = {
3142 : {
3143 : .name = discard_const_p(char, "in_system_name"),
3144 : .get = py_winreg_OpenHKPD_in_get_system_name,
3145 : .set = py_winreg_OpenHKPD_in_set_system_name,
3146 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3147 : },
3148 : {
3149 : .name = discard_const_p(char, "in_access_mask"),
3150 : .get = py_winreg_OpenHKPD_in_get_access_mask,
3151 : .set = py_winreg_OpenHKPD_in_set_access_mask,
3152 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
3153 : },
3154 : {
3155 : .name = discard_const_p(char, "out_handle"),
3156 : .get = py_winreg_OpenHKPD_out_get_handle,
3157 : .set = py_winreg_OpenHKPD_out_set_handle,
3158 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
3159 : },
3160 : {
3161 : .name = discard_const_p(char, "result"),
3162 : .get = py_winreg_OpenHKPD_get_result,
3163 : .set = py_winreg_OpenHKPD_set_result,
3164 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
3165 : },
3166 : { .name = NULL }
3167 : };
3168 :
3169 0 : static PyObject *py_winreg_OpenHKPD_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3170 : {
3171 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKPD, type);
3172 0 : struct winreg_OpenHKPD *_self = (struct winreg_OpenHKPD *)pytalloc_get_ptr(self);
3173 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
3174 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3175 0 : return self;
3176 : }
3177 :
3178 0 : static PyObject *py_winreg_OpenHKPD_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
3179 : {
3180 :
3181 :
3182 0 : return PyLong_FromLong(3);
3183 : }
3184 :
3185 0 : static PyObject *py_winreg_OpenHKPD_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
3186 : {
3187 0 : const struct ndr_interface_call *call = NULL;
3188 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(py_obj);
3189 0 : PyObject *ret = NULL;
3190 0 : struct ndr_push *push = NULL;
3191 : DATA_BLOB blob;
3192 : enum ndr_err_code err;
3193 :
3194 0 : if (ndr_table_winreg.num_calls < 4) {
3195 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPD_ndr_pack");
3196 0 : return NULL;
3197 : }
3198 0 : call = &ndr_table_winreg.calls[3];
3199 :
3200 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
3201 0 : if (push == NULL) {
3202 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3203 0 : return NULL;
3204 : }
3205 :
3206 0 : push->flags |= ndr_push_flags;
3207 :
3208 0 : err = call->ndr_push(push, ndr_inout_flags, object);
3209 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3210 0 : TALLOC_FREE(push);
3211 0 : PyErr_SetNdrError(err);
3212 0 : return NULL;
3213 : }
3214 0 : blob = ndr_push_blob(push);
3215 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3216 0 : TALLOC_FREE(push);
3217 0 : return ret;
3218 : }
3219 :
3220 0 : static PyObject *py_winreg_OpenHKPD_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3221 : {
3222 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3223 0 : PyObject *bigendian_obj = NULL;
3224 0 : PyObject *ndr64_obj = NULL;
3225 0 : uint32_t ndr_push_flags = 0;
3226 :
3227 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
3228 : discard_const_p(char *, kwnames),
3229 : &bigendian_obj,
3230 : &ndr64_obj)) {
3231 0 : return NULL;
3232 : }
3233 :
3234 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3235 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3236 : }
3237 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3238 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3239 : }
3240 :
3241 0 : return py_winreg_OpenHKPD_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
3242 : }
3243 :
3244 0 : static PyObject *py_winreg_OpenHKPD_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3245 : {
3246 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3247 0 : PyObject *bigendian_obj = NULL;
3248 0 : PyObject *ndr64_obj = NULL;
3249 0 : uint32_t ndr_push_flags = 0;
3250 :
3251 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
3252 : discard_const_p(char *, kwnames),
3253 : &bigendian_obj,
3254 : &ndr64_obj)) {
3255 0 : return NULL;
3256 : }
3257 :
3258 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3259 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3260 : }
3261 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3262 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3263 : }
3264 :
3265 0 : return py_winreg_OpenHKPD_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
3266 : }
3267 :
3268 0 : static PyObject *py_winreg_OpenHKPD_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
3269 : {
3270 0 : const struct ndr_interface_call *call = NULL;
3271 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(py_obj);
3272 0 : struct ndr_pull *pull = NULL;
3273 : enum ndr_err_code err;
3274 :
3275 0 : if (ndr_table_winreg.num_calls < 4) {
3276 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPD_ndr_unpack");
3277 0 : return NULL;
3278 : }
3279 0 : call = &ndr_table_winreg.calls[3];
3280 :
3281 0 : pull = ndr_pull_init_blob(blob, object);
3282 0 : if (pull == NULL) {
3283 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3284 0 : return NULL;
3285 : }
3286 :
3287 0 : pull->flags |= ndr_pull_flags;
3288 :
3289 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
3290 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3291 0 : TALLOC_FREE(pull);
3292 0 : PyErr_SetNdrError(err);
3293 0 : return NULL;
3294 : }
3295 0 : if (!allow_remaining) {
3296 : uint32_t highest_ofs;
3297 :
3298 0 : if (pull->offset > pull->relative_highest_offset) {
3299 0 : highest_ofs = pull->offset;
3300 : } else {
3301 0 : highest_ofs = pull->relative_highest_offset;
3302 : }
3303 0 : if (highest_ofs < pull->data_size) {
3304 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
3305 : "not all bytes consumed ofs[%u] size[%u]",
3306 : highest_ofs, pull->data_size);
3307 0 : TALLOC_FREE(pull);
3308 0 : PyErr_SetNdrError(err);
3309 0 : return NULL;
3310 : }
3311 : }
3312 :
3313 0 : TALLOC_FREE(pull);
3314 0 : Py_RETURN_NONE;
3315 : }
3316 :
3317 0 : static PyObject *py_winreg_OpenHKPD_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3318 : {
3319 : DATA_BLOB blob;
3320 0 : Py_ssize_t blob_length = 0;
3321 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3322 0 : PyObject *bigendian_obj = NULL;
3323 0 : PyObject *ndr64_obj = NULL;
3324 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3325 0 : PyObject *allow_remaining_obj = NULL;
3326 0 : bool allow_remaining = false;
3327 :
3328 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
3329 : discard_const_p(char *, kwnames),
3330 : &blob.data, &blob_length,
3331 : &bigendian_obj,
3332 : &ndr64_obj,
3333 : &allow_remaining_obj)) {
3334 0 : return NULL;
3335 : }
3336 0 : blob.length = blob_length;
3337 :
3338 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3339 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3340 : }
3341 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3342 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3343 : }
3344 :
3345 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3346 0 : allow_remaining = true;
3347 : }
3348 :
3349 0 : return py_winreg_OpenHKPD_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
3350 : }
3351 :
3352 0 : static PyObject *py_winreg_OpenHKPD_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3353 : {
3354 : DATA_BLOB blob;
3355 0 : Py_ssize_t blob_length = 0;
3356 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3357 0 : PyObject *bigendian_obj = NULL;
3358 0 : PyObject *ndr64_obj = NULL;
3359 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3360 0 : PyObject *allow_remaining_obj = NULL;
3361 0 : bool allow_remaining = false;
3362 :
3363 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
3364 : discard_const_p(char *, kwnames),
3365 : &blob.data, &blob_length,
3366 : &bigendian_obj,
3367 : &ndr64_obj,
3368 : &allow_remaining_obj)) {
3369 0 : return NULL;
3370 : }
3371 0 : blob.length = blob_length;
3372 :
3373 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3374 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3375 : }
3376 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3377 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3378 : }
3379 :
3380 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3381 0 : allow_remaining = true;
3382 : }
3383 :
3384 0 : return py_winreg_OpenHKPD_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
3385 : }
3386 :
3387 0 : static PyObject *py_winreg_OpenHKPD_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
3388 : {
3389 0 : const struct ndr_interface_call *call = NULL;
3390 0 : struct winreg_OpenHKPD *object = (struct winreg_OpenHKPD *)pytalloc_get_ptr(py_obj);
3391 : PyObject *ret;
3392 : char *retstr;
3393 :
3394 0 : if (ndr_table_winreg.num_calls < 4) {
3395 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPD_ndr_print");
3396 0 : return NULL;
3397 : }
3398 0 : call = &ndr_table_winreg.calls[3];
3399 :
3400 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
3401 0 : ret = PyUnicode_FromString(retstr);
3402 0 : TALLOC_FREE(retstr);
3403 :
3404 0 : return ret;
3405 : }
3406 :
3407 0 : static PyObject *py_winreg_OpenHKPD_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3408 : {
3409 0 : return py_winreg_OpenHKPD_ndr_print(py_obj, "winreg_OpenHKPD_in", NDR_IN);
3410 : }
3411 :
3412 0 : static PyObject *py_winreg_OpenHKPD_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3413 : {
3414 0 : return py_winreg_OpenHKPD_ndr_print(py_obj, "winreg_OpenHKPD_out", NDR_OUT);
3415 : }
3416 :
3417 : static PyMethodDef py_winreg_OpenHKPD_methods[] = {
3418 : { "opnum", (PyCFunction)py_winreg_OpenHKPD_ndr_opnum, METH_NOARGS|METH_CLASS,
3419 : "winreg.OpenHKPD.opnum() -> 3 (0x03) " },
3420 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
3421 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
3422 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
3423 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
3424 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
3425 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
3426 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPD_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
3427 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
3428 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKPD_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
3429 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKPD_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
3430 : { NULL, NULL, 0, NULL }
3431 : };
3432 :
3433 :
3434 : static PyTypeObject winreg_OpenHKPD_Type = {
3435 : PyVarObject_HEAD_INIT(NULL, 0)
3436 : .tp_name = "winreg.OpenHKPD",
3437 : .tp_getset = py_winreg_OpenHKPD_getsetters,
3438 : .tp_methods = py_winreg_OpenHKPD_methods,
3439 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3440 : .tp_new = py_winreg_OpenHKPD_new,
3441 : };
3442 :
3443 0 : static bool pack_py_winreg_OpenHKPD_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPD *r)
3444 : {
3445 : PyObject *py_system_name;
3446 : PyObject *py_access_mask;
3447 0 : const char *kwnames[] = {
3448 : "system_name", "access_mask", NULL
3449 : };
3450 :
3451 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPD", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
3452 0 : return false;
3453 : }
3454 :
3455 0 : if (py_system_name == NULL) {
3456 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
3457 0 : return false;
3458 : }
3459 0 : if (py_system_name == Py_None) {
3460 0 : r->in.system_name = NULL;
3461 : } else {
3462 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
3463 0 : if (r->in.system_name == NULL) {
3464 0 : PyErr_NoMemory();
3465 0 : return false;
3466 : }
3467 : {
3468 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
3469 0 : if (PyLong_Check(py_system_name)) {
3470 : unsigned long long test_var;
3471 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
3472 0 : if (PyErr_Occurred() != NULL) {
3473 0 : return false;
3474 : }
3475 0 : if (test_var > uint_max) {
3476 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3477 : PyLong_Type.tp_name, uint_max, test_var);
3478 0 : return false;
3479 : }
3480 0 : *r->in.system_name = test_var;
3481 : } else {
3482 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3483 : PyLong_Type.tp_name);
3484 0 : return false;
3485 : }
3486 : }
3487 : }
3488 0 : if (py_access_mask == NULL) {
3489 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
3490 0 : return false;
3491 : }
3492 : {
3493 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
3494 0 : if (PyLong_Check(py_access_mask)) {
3495 : unsigned long long test_var;
3496 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
3497 0 : if (PyErr_Occurred() != NULL) {
3498 0 : return false;
3499 : }
3500 0 : if (test_var > uint_max) {
3501 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3502 : PyLong_Type.tp_name, uint_max, test_var);
3503 0 : return false;
3504 : }
3505 0 : r->in.access_mask = test_var;
3506 : } else {
3507 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3508 : PyLong_Type.tp_name);
3509 0 : return false;
3510 : }
3511 : }
3512 0 : return true;
3513 : }
3514 :
3515 0 : static PyObject *unpack_py_winreg_OpenHKPD_args_out(struct winreg_OpenHKPD *r)
3516 : {
3517 : PyObject *result;
3518 : PyObject *py_handle;
3519 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
3520 0 : result = py_handle;
3521 0 : if (!W_ERROR_IS_OK(r->out.result)) {
3522 0 : PyErr_SetWERROR(r->out.result);
3523 0 : return NULL;
3524 : }
3525 :
3526 0 : return result;
3527 : }
3528 :
3529 :
3530 0 : static PyObject *py_winreg_OpenHKU_in_get_system_name(PyObject *obj, void *closure)
3531 : {
3532 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(obj);
3533 : PyObject *py_system_name;
3534 0 : if (object->in.system_name == NULL) {
3535 0 : Py_RETURN_NONE;
3536 : }
3537 0 : if (object->in.system_name == NULL) {
3538 0 : py_system_name = Py_None;
3539 0 : Py_INCREF(py_system_name);
3540 : } else {
3541 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
3542 : }
3543 0 : return py_system_name;
3544 : }
3545 :
3546 0 : static int py_winreg_OpenHKU_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
3547 : {
3548 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(py_obj);
3549 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
3550 0 : if (value == NULL) {
3551 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
3552 0 : return -1;
3553 : }
3554 0 : if (value == Py_None) {
3555 0 : object->in.system_name = NULL;
3556 : } else {
3557 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
3558 0 : if (object->in.system_name == NULL) {
3559 0 : PyErr_NoMemory();
3560 0 : return -1;
3561 : }
3562 : {
3563 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
3564 0 : if (PyLong_Check(value)) {
3565 : unsigned long long test_var;
3566 0 : test_var = PyLong_AsUnsignedLongLong(value);
3567 0 : if (PyErr_Occurred() != NULL) {
3568 0 : return -1;
3569 : }
3570 0 : if (test_var > uint_max) {
3571 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3572 : PyLong_Type.tp_name, uint_max, test_var);
3573 0 : return -1;
3574 : }
3575 0 : *object->in.system_name = test_var;
3576 : } else {
3577 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3578 : PyLong_Type.tp_name);
3579 0 : return -1;
3580 : }
3581 : }
3582 : }
3583 0 : return 0;
3584 : }
3585 :
3586 0 : static PyObject *py_winreg_OpenHKU_in_get_access_mask(PyObject *obj, void *closure)
3587 : {
3588 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(obj);
3589 : PyObject *py_access_mask;
3590 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
3591 0 : return py_access_mask;
3592 : }
3593 :
3594 0 : static int py_winreg_OpenHKU_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
3595 : {
3596 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(py_obj);
3597 0 : if (value == NULL) {
3598 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
3599 0 : return -1;
3600 : }
3601 : {
3602 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
3603 0 : if (PyLong_Check(value)) {
3604 : unsigned long long test_var;
3605 0 : test_var = PyLong_AsUnsignedLongLong(value);
3606 0 : if (PyErr_Occurred() != NULL) {
3607 0 : return -1;
3608 : }
3609 0 : if (test_var > uint_max) {
3610 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3611 : PyLong_Type.tp_name, uint_max, test_var);
3612 0 : return -1;
3613 : }
3614 0 : object->in.access_mask = test_var;
3615 : } else {
3616 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3617 : PyLong_Type.tp_name);
3618 0 : return -1;
3619 : }
3620 : }
3621 0 : return 0;
3622 : }
3623 :
3624 0 : static PyObject *py_winreg_OpenHKU_out_get_handle(PyObject *obj, void *closure)
3625 : {
3626 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(obj);
3627 : PyObject *py_handle;
3628 0 : if (object->out.handle == NULL) {
3629 0 : Py_RETURN_NONE;
3630 : }
3631 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
3632 0 : return py_handle;
3633 : }
3634 :
3635 0 : static int py_winreg_OpenHKU_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
3636 : {
3637 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(py_obj);
3638 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
3639 0 : if (value == NULL) {
3640 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
3641 0 : return -1;
3642 : }
3643 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
3644 0 : if (object->out.handle == NULL) {
3645 0 : PyErr_NoMemory();
3646 0 : return -1;
3647 : }
3648 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
3649 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3650 0 : PyErr_NoMemory();
3651 0 : return -1;
3652 : }
3653 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
3654 0 : return 0;
3655 : }
3656 :
3657 0 : static PyObject *py_winreg_OpenHKU_get_result(PyObject *obj, void *closure)
3658 : {
3659 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(obj);
3660 : PyObject *py_result;
3661 0 : py_result = PyErr_FromWERROR(object->out.result);
3662 0 : return py_result;
3663 : }
3664 :
3665 0 : static int py_winreg_OpenHKU_set_result(PyObject *py_obj, PyObject *value, void *closure)
3666 : {
3667 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(py_obj);
3668 0 : if (value == NULL) {
3669 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
3670 0 : return -1;
3671 : }
3672 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
3673 0 : return 0;
3674 : }
3675 :
3676 : static PyGetSetDef py_winreg_OpenHKU_getsetters[] = {
3677 : {
3678 : .name = discard_const_p(char, "in_system_name"),
3679 : .get = py_winreg_OpenHKU_in_get_system_name,
3680 : .set = py_winreg_OpenHKU_in_set_system_name,
3681 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3682 : },
3683 : {
3684 : .name = discard_const_p(char, "in_access_mask"),
3685 : .get = py_winreg_OpenHKU_in_get_access_mask,
3686 : .set = py_winreg_OpenHKU_in_set_access_mask,
3687 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
3688 : },
3689 : {
3690 : .name = discard_const_p(char, "out_handle"),
3691 : .get = py_winreg_OpenHKU_out_get_handle,
3692 : .set = py_winreg_OpenHKU_out_set_handle,
3693 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
3694 : },
3695 : {
3696 : .name = discard_const_p(char, "result"),
3697 : .get = py_winreg_OpenHKU_get_result,
3698 : .set = py_winreg_OpenHKU_set_result,
3699 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
3700 : },
3701 : { .name = NULL }
3702 : };
3703 :
3704 0 : static PyObject *py_winreg_OpenHKU_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3705 : {
3706 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKU, type);
3707 0 : struct winreg_OpenHKU *_self = (struct winreg_OpenHKU *)pytalloc_get_ptr(self);
3708 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
3709 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3710 0 : return self;
3711 : }
3712 :
3713 0 : static PyObject *py_winreg_OpenHKU_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
3714 : {
3715 :
3716 :
3717 0 : return PyLong_FromLong(4);
3718 : }
3719 :
3720 0 : static PyObject *py_winreg_OpenHKU_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
3721 : {
3722 0 : const struct ndr_interface_call *call = NULL;
3723 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(py_obj);
3724 0 : PyObject *ret = NULL;
3725 0 : struct ndr_push *push = NULL;
3726 : DATA_BLOB blob;
3727 : enum ndr_err_code err;
3728 :
3729 0 : if (ndr_table_winreg.num_calls < 5) {
3730 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKU_ndr_pack");
3731 0 : return NULL;
3732 : }
3733 0 : call = &ndr_table_winreg.calls[4];
3734 :
3735 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
3736 0 : if (push == NULL) {
3737 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3738 0 : return NULL;
3739 : }
3740 :
3741 0 : push->flags |= ndr_push_flags;
3742 :
3743 0 : err = call->ndr_push(push, ndr_inout_flags, object);
3744 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3745 0 : TALLOC_FREE(push);
3746 0 : PyErr_SetNdrError(err);
3747 0 : return NULL;
3748 : }
3749 0 : blob = ndr_push_blob(push);
3750 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3751 0 : TALLOC_FREE(push);
3752 0 : return ret;
3753 : }
3754 :
3755 0 : static PyObject *py_winreg_OpenHKU_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3756 : {
3757 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3758 0 : PyObject *bigendian_obj = NULL;
3759 0 : PyObject *ndr64_obj = NULL;
3760 0 : uint32_t ndr_push_flags = 0;
3761 :
3762 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
3763 : discard_const_p(char *, kwnames),
3764 : &bigendian_obj,
3765 : &ndr64_obj)) {
3766 0 : return NULL;
3767 : }
3768 :
3769 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3770 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3771 : }
3772 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3773 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3774 : }
3775 :
3776 0 : return py_winreg_OpenHKU_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
3777 : }
3778 :
3779 0 : static PyObject *py_winreg_OpenHKU_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3780 : {
3781 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
3782 0 : PyObject *bigendian_obj = NULL;
3783 0 : PyObject *ndr64_obj = NULL;
3784 0 : uint32_t ndr_push_flags = 0;
3785 :
3786 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
3787 : discard_const_p(char *, kwnames),
3788 : &bigendian_obj,
3789 : &ndr64_obj)) {
3790 0 : return NULL;
3791 : }
3792 :
3793 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3794 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
3795 : }
3796 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3797 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
3798 : }
3799 :
3800 0 : return py_winreg_OpenHKU_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
3801 : }
3802 :
3803 0 : static PyObject *py_winreg_OpenHKU_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
3804 : {
3805 0 : const struct ndr_interface_call *call = NULL;
3806 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(py_obj);
3807 0 : struct ndr_pull *pull = NULL;
3808 : enum ndr_err_code err;
3809 :
3810 0 : if (ndr_table_winreg.num_calls < 5) {
3811 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKU_ndr_unpack");
3812 0 : return NULL;
3813 : }
3814 0 : call = &ndr_table_winreg.calls[4];
3815 :
3816 0 : pull = ndr_pull_init_blob(blob, object);
3817 0 : if (pull == NULL) {
3818 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3819 0 : return NULL;
3820 : }
3821 :
3822 0 : pull->flags |= ndr_pull_flags;
3823 :
3824 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
3825 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3826 0 : TALLOC_FREE(pull);
3827 0 : PyErr_SetNdrError(err);
3828 0 : return NULL;
3829 : }
3830 0 : if (!allow_remaining) {
3831 : uint32_t highest_ofs;
3832 :
3833 0 : if (pull->offset > pull->relative_highest_offset) {
3834 0 : highest_ofs = pull->offset;
3835 : } else {
3836 0 : highest_ofs = pull->relative_highest_offset;
3837 : }
3838 0 : if (highest_ofs < pull->data_size) {
3839 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
3840 : "not all bytes consumed ofs[%u] size[%u]",
3841 : highest_ofs, pull->data_size);
3842 0 : TALLOC_FREE(pull);
3843 0 : PyErr_SetNdrError(err);
3844 0 : return NULL;
3845 : }
3846 : }
3847 :
3848 0 : TALLOC_FREE(pull);
3849 0 : Py_RETURN_NONE;
3850 : }
3851 :
3852 0 : static PyObject *py_winreg_OpenHKU_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3853 : {
3854 : DATA_BLOB blob;
3855 0 : Py_ssize_t blob_length = 0;
3856 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3857 0 : PyObject *bigendian_obj = NULL;
3858 0 : PyObject *ndr64_obj = NULL;
3859 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3860 0 : PyObject *allow_remaining_obj = NULL;
3861 0 : bool allow_remaining = false;
3862 :
3863 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
3864 : discard_const_p(char *, kwnames),
3865 : &blob.data, &blob_length,
3866 : &bigendian_obj,
3867 : &ndr64_obj,
3868 : &allow_remaining_obj)) {
3869 0 : return NULL;
3870 : }
3871 0 : blob.length = blob_length;
3872 :
3873 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3874 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3875 : }
3876 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3877 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3878 : }
3879 :
3880 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3881 0 : allow_remaining = true;
3882 : }
3883 :
3884 0 : return py_winreg_OpenHKU_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
3885 : }
3886 :
3887 0 : static PyObject *py_winreg_OpenHKU_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3888 : {
3889 : DATA_BLOB blob;
3890 0 : Py_ssize_t blob_length = 0;
3891 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
3892 0 : PyObject *bigendian_obj = NULL;
3893 0 : PyObject *ndr64_obj = NULL;
3894 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
3895 0 : PyObject *allow_remaining_obj = NULL;
3896 0 : bool allow_remaining = false;
3897 :
3898 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
3899 : discard_const_p(char *, kwnames),
3900 : &blob.data, &blob_length,
3901 : &bigendian_obj,
3902 : &ndr64_obj,
3903 : &allow_remaining_obj)) {
3904 0 : return NULL;
3905 : }
3906 0 : blob.length = blob_length;
3907 :
3908 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
3909 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
3910 : }
3911 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
3912 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
3913 : }
3914 :
3915 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3916 0 : allow_remaining = true;
3917 : }
3918 :
3919 0 : return py_winreg_OpenHKU_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
3920 : }
3921 :
3922 0 : static PyObject *py_winreg_OpenHKU_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
3923 : {
3924 0 : const struct ndr_interface_call *call = NULL;
3925 0 : struct winreg_OpenHKU *object = (struct winreg_OpenHKU *)pytalloc_get_ptr(py_obj);
3926 : PyObject *ret;
3927 : char *retstr;
3928 :
3929 0 : if (ndr_table_winreg.num_calls < 5) {
3930 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKU_ndr_print");
3931 0 : return NULL;
3932 : }
3933 0 : call = &ndr_table_winreg.calls[4];
3934 :
3935 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
3936 0 : ret = PyUnicode_FromString(retstr);
3937 0 : TALLOC_FREE(retstr);
3938 :
3939 0 : return ret;
3940 : }
3941 :
3942 0 : static PyObject *py_winreg_OpenHKU_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3943 : {
3944 0 : return py_winreg_OpenHKU_ndr_print(py_obj, "winreg_OpenHKU_in", NDR_IN);
3945 : }
3946 :
3947 0 : static PyObject *py_winreg_OpenHKU_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3948 : {
3949 0 : return py_winreg_OpenHKU_ndr_print(py_obj, "winreg_OpenHKU_out", NDR_OUT);
3950 : }
3951 :
3952 : static PyMethodDef py_winreg_OpenHKU_methods[] = {
3953 : { "opnum", (PyCFunction)py_winreg_OpenHKU_ndr_opnum, METH_NOARGS|METH_CLASS,
3954 : "winreg.OpenHKU.opnum() -> 4 (0x04) " },
3955 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
3956 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
3957 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
3958 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
3959 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
3960 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
3961 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKU_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
3962 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
3963 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKU_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
3964 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKU_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
3965 : { NULL, NULL, 0, NULL }
3966 : };
3967 :
3968 :
3969 : static PyTypeObject winreg_OpenHKU_Type = {
3970 : PyVarObject_HEAD_INIT(NULL, 0)
3971 : .tp_name = "winreg.OpenHKU",
3972 : .tp_getset = py_winreg_OpenHKU_getsetters,
3973 : .tp_methods = py_winreg_OpenHKU_methods,
3974 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3975 : .tp_new = py_winreg_OpenHKU_new,
3976 : };
3977 :
3978 0 : static bool pack_py_winreg_OpenHKU_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKU *r)
3979 : {
3980 : PyObject *py_system_name;
3981 : PyObject *py_access_mask;
3982 0 : const char *kwnames[] = {
3983 : "system_name", "access_mask", NULL
3984 : };
3985 :
3986 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKU", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
3987 0 : return false;
3988 : }
3989 :
3990 0 : if (py_system_name == NULL) {
3991 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
3992 0 : return false;
3993 : }
3994 0 : if (py_system_name == Py_None) {
3995 0 : r->in.system_name = NULL;
3996 : } else {
3997 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
3998 0 : if (r->in.system_name == NULL) {
3999 0 : PyErr_NoMemory();
4000 0 : return false;
4001 : }
4002 : {
4003 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
4004 0 : if (PyLong_Check(py_system_name)) {
4005 : unsigned long long test_var;
4006 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
4007 0 : if (PyErr_Occurred() != NULL) {
4008 0 : return false;
4009 : }
4010 0 : if (test_var > uint_max) {
4011 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4012 : PyLong_Type.tp_name, uint_max, test_var);
4013 0 : return false;
4014 : }
4015 0 : *r->in.system_name = test_var;
4016 : } else {
4017 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4018 : PyLong_Type.tp_name);
4019 0 : return false;
4020 : }
4021 : }
4022 : }
4023 0 : if (py_access_mask == NULL) {
4024 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
4025 0 : return false;
4026 : }
4027 : {
4028 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
4029 0 : if (PyLong_Check(py_access_mask)) {
4030 : unsigned long long test_var;
4031 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
4032 0 : if (PyErr_Occurred() != NULL) {
4033 0 : return false;
4034 : }
4035 0 : if (test_var > uint_max) {
4036 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4037 : PyLong_Type.tp_name, uint_max, test_var);
4038 0 : return false;
4039 : }
4040 0 : r->in.access_mask = test_var;
4041 : } else {
4042 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4043 : PyLong_Type.tp_name);
4044 0 : return false;
4045 : }
4046 : }
4047 0 : return true;
4048 : }
4049 :
4050 0 : static PyObject *unpack_py_winreg_OpenHKU_args_out(struct winreg_OpenHKU *r)
4051 : {
4052 : PyObject *result;
4053 : PyObject *py_handle;
4054 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
4055 0 : result = py_handle;
4056 0 : if (!W_ERROR_IS_OK(r->out.result)) {
4057 0 : PyErr_SetWERROR(r->out.result);
4058 0 : return NULL;
4059 : }
4060 :
4061 0 : return result;
4062 : }
4063 :
4064 :
4065 0 : static PyObject *py_winreg_CloseKey_in_get_handle(PyObject *obj, void *closure)
4066 : {
4067 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(obj);
4068 : PyObject *py_handle;
4069 0 : if (object->in.handle == NULL) {
4070 0 : Py_RETURN_NONE;
4071 : }
4072 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
4073 0 : return py_handle;
4074 : }
4075 :
4076 0 : static int py_winreg_CloseKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
4077 : {
4078 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(py_obj);
4079 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
4080 0 : if (value == NULL) {
4081 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
4082 0 : return -1;
4083 : }
4084 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
4085 0 : if (object->in.handle == NULL) {
4086 0 : PyErr_NoMemory();
4087 0 : return -1;
4088 : }
4089 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4090 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4091 0 : PyErr_NoMemory();
4092 0 : return -1;
4093 : }
4094 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
4095 0 : return 0;
4096 : }
4097 :
4098 0 : static PyObject *py_winreg_CloseKey_out_get_handle(PyObject *obj, void *closure)
4099 : {
4100 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(obj);
4101 : PyObject *py_handle;
4102 0 : if (object->out.handle == NULL) {
4103 0 : Py_RETURN_NONE;
4104 : }
4105 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
4106 0 : return py_handle;
4107 : }
4108 :
4109 0 : static int py_winreg_CloseKey_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
4110 : {
4111 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(py_obj);
4112 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
4113 0 : if (value == NULL) {
4114 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
4115 0 : return -1;
4116 : }
4117 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
4118 0 : if (object->out.handle == NULL) {
4119 0 : PyErr_NoMemory();
4120 0 : return -1;
4121 : }
4122 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4123 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4124 0 : PyErr_NoMemory();
4125 0 : return -1;
4126 : }
4127 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
4128 0 : return 0;
4129 : }
4130 :
4131 0 : static PyObject *py_winreg_CloseKey_get_result(PyObject *obj, void *closure)
4132 : {
4133 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(obj);
4134 : PyObject *py_result;
4135 0 : py_result = PyErr_FromWERROR(object->out.result);
4136 0 : return py_result;
4137 : }
4138 :
4139 0 : static int py_winreg_CloseKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
4140 : {
4141 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(py_obj);
4142 0 : if (value == NULL) {
4143 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
4144 0 : return -1;
4145 : }
4146 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
4147 0 : return 0;
4148 : }
4149 :
4150 : static PyGetSetDef py_winreg_CloseKey_getsetters[] = {
4151 : {
4152 : .name = discard_const_p(char, "in_handle"),
4153 : .get = py_winreg_CloseKey_in_get_handle,
4154 : .set = py_winreg_CloseKey_in_set_handle,
4155 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4156 : },
4157 : {
4158 : .name = discard_const_p(char, "out_handle"),
4159 : .get = py_winreg_CloseKey_out_get_handle,
4160 : .set = py_winreg_CloseKey_out_set_handle,
4161 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4162 : },
4163 : {
4164 : .name = discard_const_p(char, "result"),
4165 : .get = py_winreg_CloseKey_get_result,
4166 : .set = py_winreg_CloseKey_set_result,
4167 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
4168 : },
4169 : { .name = NULL }
4170 : };
4171 :
4172 0 : static PyObject *py_winreg_CloseKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4173 : {
4174 0 : PyObject *self = pytalloc_new(struct winreg_CloseKey, type);
4175 0 : struct winreg_CloseKey *_self = (struct winreg_CloseKey *)pytalloc_get_ptr(self);
4176 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
4177 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
4178 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
4179 0 : return self;
4180 : }
4181 :
4182 0 : static PyObject *py_winreg_CloseKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
4183 : {
4184 :
4185 :
4186 0 : return PyLong_FromLong(5);
4187 : }
4188 :
4189 0 : static PyObject *py_winreg_CloseKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
4190 : {
4191 0 : const struct ndr_interface_call *call = NULL;
4192 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(py_obj);
4193 0 : PyObject *ret = NULL;
4194 0 : struct ndr_push *push = NULL;
4195 : DATA_BLOB blob;
4196 : enum ndr_err_code err;
4197 :
4198 0 : if (ndr_table_winreg.num_calls < 6) {
4199 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CloseKey_ndr_pack");
4200 0 : return NULL;
4201 : }
4202 0 : call = &ndr_table_winreg.calls[5];
4203 :
4204 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
4205 0 : if (push == NULL) {
4206 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4207 0 : return NULL;
4208 : }
4209 :
4210 0 : push->flags |= ndr_push_flags;
4211 :
4212 0 : err = call->ndr_push(push, ndr_inout_flags, object);
4213 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4214 0 : TALLOC_FREE(push);
4215 0 : PyErr_SetNdrError(err);
4216 0 : return NULL;
4217 : }
4218 0 : blob = ndr_push_blob(push);
4219 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4220 0 : TALLOC_FREE(push);
4221 0 : return ret;
4222 : }
4223 :
4224 0 : static PyObject *py_winreg_CloseKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4225 : {
4226 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4227 0 : PyObject *bigendian_obj = NULL;
4228 0 : PyObject *ndr64_obj = NULL;
4229 0 : uint32_t ndr_push_flags = 0;
4230 :
4231 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
4232 : discard_const_p(char *, kwnames),
4233 : &bigendian_obj,
4234 : &ndr64_obj)) {
4235 0 : return NULL;
4236 : }
4237 :
4238 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4239 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
4240 : }
4241 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4242 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
4243 : }
4244 :
4245 0 : return py_winreg_CloseKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
4246 : }
4247 :
4248 0 : static PyObject *py_winreg_CloseKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4249 : {
4250 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4251 0 : PyObject *bigendian_obj = NULL;
4252 0 : PyObject *ndr64_obj = NULL;
4253 0 : uint32_t ndr_push_flags = 0;
4254 :
4255 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
4256 : discard_const_p(char *, kwnames),
4257 : &bigendian_obj,
4258 : &ndr64_obj)) {
4259 0 : return NULL;
4260 : }
4261 :
4262 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4263 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
4264 : }
4265 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4266 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
4267 : }
4268 :
4269 0 : return py_winreg_CloseKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
4270 : }
4271 :
4272 0 : static PyObject *py_winreg_CloseKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
4273 : {
4274 0 : const struct ndr_interface_call *call = NULL;
4275 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(py_obj);
4276 0 : struct ndr_pull *pull = NULL;
4277 : enum ndr_err_code err;
4278 :
4279 0 : if (ndr_table_winreg.num_calls < 6) {
4280 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CloseKey_ndr_unpack");
4281 0 : return NULL;
4282 : }
4283 0 : call = &ndr_table_winreg.calls[5];
4284 :
4285 0 : pull = ndr_pull_init_blob(blob, object);
4286 0 : if (pull == NULL) {
4287 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4288 0 : return NULL;
4289 : }
4290 :
4291 0 : pull->flags |= ndr_pull_flags;
4292 :
4293 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
4294 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4295 0 : TALLOC_FREE(pull);
4296 0 : PyErr_SetNdrError(err);
4297 0 : return NULL;
4298 : }
4299 0 : if (!allow_remaining) {
4300 : uint32_t highest_ofs;
4301 :
4302 0 : if (pull->offset > pull->relative_highest_offset) {
4303 0 : highest_ofs = pull->offset;
4304 : } else {
4305 0 : highest_ofs = pull->relative_highest_offset;
4306 : }
4307 0 : if (highest_ofs < pull->data_size) {
4308 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
4309 : "not all bytes consumed ofs[%u] size[%u]",
4310 : highest_ofs, pull->data_size);
4311 0 : TALLOC_FREE(pull);
4312 0 : PyErr_SetNdrError(err);
4313 0 : return NULL;
4314 : }
4315 : }
4316 :
4317 0 : TALLOC_FREE(pull);
4318 0 : Py_RETURN_NONE;
4319 : }
4320 :
4321 0 : static PyObject *py_winreg_CloseKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4322 : {
4323 : DATA_BLOB blob;
4324 0 : Py_ssize_t blob_length = 0;
4325 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
4326 0 : PyObject *bigendian_obj = NULL;
4327 0 : PyObject *ndr64_obj = NULL;
4328 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
4329 0 : PyObject *allow_remaining_obj = NULL;
4330 0 : bool allow_remaining = false;
4331 :
4332 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
4333 : discard_const_p(char *, kwnames),
4334 : &blob.data, &blob_length,
4335 : &bigendian_obj,
4336 : &ndr64_obj,
4337 : &allow_remaining_obj)) {
4338 0 : return NULL;
4339 : }
4340 0 : blob.length = blob_length;
4341 :
4342 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4343 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
4344 : }
4345 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4346 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
4347 : }
4348 :
4349 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4350 0 : allow_remaining = true;
4351 : }
4352 :
4353 0 : return py_winreg_CloseKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
4354 : }
4355 :
4356 0 : static PyObject *py_winreg_CloseKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4357 : {
4358 : DATA_BLOB blob;
4359 0 : Py_ssize_t blob_length = 0;
4360 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
4361 0 : PyObject *bigendian_obj = NULL;
4362 0 : PyObject *ndr64_obj = NULL;
4363 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
4364 0 : PyObject *allow_remaining_obj = NULL;
4365 0 : bool allow_remaining = false;
4366 :
4367 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
4368 : discard_const_p(char *, kwnames),
4369 : &blob.data, &blob_length,
4370 : &bigendian_obj,
4371 : &ndr64_obj,
4372 : &allow_remaining_obj)) {
4373 0 : return NULL;
4374 : }
4375 0 : blob.length = blob_length;
4376 :
4377 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4378 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
4379 : }
4380 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4381 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
4382 : }
4383 :
4384 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4385 0 : allow_remaining = true;
4386 : }
4387 :
4388 0 : return py_winreg_CloseKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
4389 : }
4390 :
4391 0 : static PyObject *py_winreg_CloseKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
4392 : {
4393 0 : const struct ndr_interface_call *call = NULL;
4394 0 : struct winreg_CloseKey *object = (struct winreg_CloseKey *)pytalloc_get_ptr(py_obj);
4395 : PyObject *ret;
4396 : char *retstr;
4397 :
4398 0 : if (ndr_table_winreg.num_calls < 6) {
4399 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CloseKey_ndr_print");
4400 0 : return NULL;
4401 : }
4402 0 : call = &ndr_table_winreg.calls[5];
4403 :
4404 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
4405 0 : ret = PyUnicode_FromString(retstr);
4406 0 : TALLOC_FREE(retstr);
4407 :
4408 0 : return ret;
4409 : }
4410 :
4411 0 : static PyObject *py_winreg_CloseKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4412 : {
4413 0 : return py_winreg_CloseKey_ndr_print(py_obj, "winreg_CloseKey_in", NDR_IN);
4414 : }
4415 :
4416 0 : static PyObject *py_winreg_CloseKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4417 : {
4418 0 : return py_winreg_CloseKey_ndr_print(py_obj, "winreg_CloseKey_out", NDR_OUT);
4419 : }
4420 :
4421 : static PyMethodDef py_winreg_CloseKey_methods[] = {
4422 : { "opnum", (PyCFunction)py_winreg_CloseKey_ndr_opnum, METH_NOARGS|METH_CLASS,
4423 : "winreg.CloseKey.opnum() -> 5 (0x05) " },
4424 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
4425 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
4426 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
4427 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
4428 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
4429 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
4430 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CloseKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
4431 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
4432 : { "__ndr_print_in__", (PyCFunction)py_winreg_CloseKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
4433 : { "__ndr_print_out__", (PyCFunction)py_winreg_CloseKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
4434 : { NULL, NULL, 0, NULL }
4435 : };
4436 :
4437 :
4438 : static PyTypeObject winreg_CloseKey_Type = {
4439 : PyVarObject_HEAD_INIT(NULL, 0)
4440 : .tp_name = "winreg.CloseKey",
4441 : .tp_getset = py_winreg_CloseKey_getsetters,
4442 : .tp_methods = py_winreg_CloseKey_methods,
4443 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4444 : .tp_new = py_winreg_CloseKey_new,
4445 : };
4446 :
4447 3 : static bool pack_py_winreg_CloseKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_CloseKey *r)
4448 : {
4449 : PyObject *py_handle;
4450 3 : const char *kwnames[] = {
4451 : "handle", NULL
4452 : };
4453 :
4454 3 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_CloseKey", discard_const_p(char *, kwnames), &py_handle)) {
4455 0 : return false;
4456 : }
4457 :
4458 3 : if (py_handle == NULL) {
4459 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
4460 0 : return false;
4461 : }
4462 3 : r->in.handle = talloc_ptrtype(r, r->in.handle);
4463 3 : if (r->in.handle == NULL) {
4464 0 : PyErr_NoMemory();
4465 0 : return false;
4466 : }
4467 3 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
4468 3 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
4469 0 : PyErr_NoMemory();
4470 0 : return false;
4471 : }
4472 3 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
4473 3 : return true;
4474 : }
4475 :
4476 3 : static PyObject *unpack_py_winreg_CloseKey_args_out(struct winreg_CloseKey *r)
4477 : {
4478 : PyObject *result;
4479 : PyObject *py_handle;
4480 3 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
4481 3 : result = py_handle;
4482 3 : if (!W_ERROR_IS_OK(r->out.result)) {
4483 0 : PyErr_SetWERROR(r->out.result);
4484 0 : return NULL;
4485 : }
4486 :
4487 3 : return result;
4488 : }
4489 :
4490 :
4491 0 : static PyObject *py_winreg_CreateKey_in_get_handle(PyObject *obj, void *closure)
4492 : {
4493 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4494 : PyObject *py_handle;
4495 0 : if (object->in.handle == NULL) {
4496 0 : Py_RETURN_NONE;
4497 : }
4498 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
4499 0 : return py_handle;
4500 : }
4501 :
4502 0 : static int py_winreg_CreateKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
4503 : {
4504 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4505 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
4506 0 : if (value == NULL) {
4507 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
4508 0 : return -1;
4509 : }
4510 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
4511 0 : if (object->in.handle == NULL) {
4512 0 : PyErr_NoMemory();
4513 0 : return -1;
4514 : }
4515 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4516 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4517 0 : PyErr_NoMemory();
4518 0 : return -1;
4519 : }
4520 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
4521 0 : return 0;
4522 : }
4523 :
4524 0 : static PyObject *py_winreg_CreateKey_in_get_name(PyObject *obj, void *closure)
4525 : {
4526 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4527 : PyObject *py_name;
4528 0 : py_name = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.name);
4529 0 : return py_name;
4530 : }
4531 :
4532 0 : static int py_winreg_CreateKey_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
4533 : {
4534 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4535 0 : if (value == NULL) {
4536 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.name");
4537 0 : return -1;
4538 : }
4539 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
4540 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4541 0 : PyErr_NoMemory();
4542 0 : return -1;
4543 : }
4544 0 : object->in.name = *(struct winreg_String *)pytalloc_get_ptr(value);
4545 0 : return 0;
4546 : }
4547 :
4548 0 : static PyObject *py_winreg_CreateKey_in_get_keyclass(PyObject *obj, void *closure)
4549 : {
4550 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4551 : PyObject *py_keyclass;
4552 0 : py_keyclass = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.keyclass);
4553 0 : return py_keyclass;
4554 : }
4555 :
4556 0 : static int py_winreg_CreateKey_in_set_keyclass(PyObject *py_obj, PyObject *value, void *closure)
4557 : {
4558 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4559 0 : if (value == NULL) {
4560 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.keyclass");
4561 0 : return -1;
4562 : }
4563 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
4564 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4565 0 : PyErr_NoMemory();
4566 0 : return -1;
4567 : }
4568 0 : object->in.keyclass = *(struct winreg_String *)pytalloc_get_ptr(value);
4569 0 : return 0;
4570 : }
4571 :
4572 0 : static PyObject *py_winreg_CreateKey_in_get_options(PyObject *obj, void *closure)
4573 : {
4574 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4575 : PyObject *py_options;
4576 0 : py_options = PyLong_FromUnsignedLongLong((uint32_t)object->in.options);
4577 0 : return py_options;
4578 : }
4579 :
4580 0 : static int py_winreg_CreateKey_in_set_options(PyObject *py_obj, PyObject *value, void *closure)
4581 : {
4582 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4583 0 : if (value == NULL) {
4584 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.options");
4585 0 : return -1;
4586 : }
4587 : {
4588 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.options));
4589 0 : if (PyLong_Check(value)) {
4590 : unsigned long long test_var;
4591 0 : test_var = PyLong_AsUnsignedLongLong(value);
4592 0 : if (PyErr_Occurred() != NULL) {
4593 0 : return -1;
4594 : }
4595 0 : if (test_var > uint_max) {
4596 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4597 : PyLong_Type.tp_name, uint_max, test_var);
4598 0 : return -1;
4599 : }
4600 0 : object->in.options = test_var;
4601 : } else {
4602 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4603 : PyLong_Type.tp_name);
4604 0 : return -1;
4605 : }
4606 : }
4607 0 : return 0;
4608 : }
4609 :
4610 0 : static PyObject *py_winreg_CreateKey_in_get_access_mask(PyObject *obj, void *closure)
4611 : {
4612 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4613 : PyObject *py_access_mask;
4614 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
4615 0 : return py_access_mask;
4616 : }
4617 :
4618 0 : static int py_winreg_CreateKey_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
4619 : {
4620 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4621 0 : if (value == NULL) {
4622 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
4623 0 : return -1;
4624 : }
4625 : {
4626 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
4627 0 : if (PyLong_Check(value)) {
4628 : unsigned long long test_var;
4629 0 : test_var = PyLong_AsUnsignedLongLong(value);
4630 0 : if (PyErr_Occurred() != NULL) {
4631 0 : return -1;
4632 : }
4633 0 : if (test_var > uint_max) {
4634 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4635 : PyLong_Type.tp_name, uint_max, test_var);
4636 0 : return -1;
4637 : }
4638 0 : object->in.access_mask = test_var;
4639 : } else {
4640 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4641 : PyLong_Type.tp_name);
4642 0 : return -1;
4643 : }
4644 : }
4645 0 : return 0;
4646 : }
4647 :
4648 0 : static PyObject *py_winreg_CreateKey_in_get_secdesc(PyObject *obj, void *closure)
4649 : {
4650 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4651 : PyObject *py_secdesc;
4652 0 : if (object->in.secdesc == NULL) {
4653 0 : Py_RETURN_NONE;
4654 : }
4655 0 : if (object->in.secdesc == NULL) {
4656 0 : py_secdesc = Py_None;
4657 0 : Py_INCREF(py_secdesc);
4658 : } else {
4659 0 : py_secdesc = pytalloc_reference_ex(&winreg_SecBuf_Type, object->in.secdesc, object->in.secdesc);
4660 : }
4661 0 : return py_secdesc;
4662 : }
4663 :
4664 0 : static int py_winreg_CreateKey_in_set_secdesc(PyObject *py_obj, PyObject *value, void *closure)
4665 : {
4666 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4667 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.secdesc));
4668 0 : if (value == NULL) {
4669 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.secdesc");
4670 0 : return -1;
4671 : }
4672 0 : if (value == Py_None) {
4673 0 : object->in.secdesc = NULL;
4674 : } else {
4675 0 : object->in.secdesc = NULL;
4676 0 : PY_CHECK_TYPE(&winreg_SecBuf_Type, value, return -1;);
4677 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4678 0 : PyErr_NoMemory();
4679 0 : return -1;
4680 : }
4681 0 : object->in.secdesc = (struct winreg_SecBuf *)pytalloc_get_ptr(value);
4682 : }
4683 0 : return 0;
4684 : }
4685 :
4686 0 : static PyObject *py_winreg_CreateKey_out_get_new_handle(PyObject *obj, void *closure)
4687 : {
4688 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4689 : PyObject *py_new_handle;
4690 0 : if (object->out.new_handle == NULL) {
4691 0 : Py_RETURN_NONE;
4692 : }
4693 0 : py_new_handle = pytalloc_reference_ex(policy_handle_Type, object->out.new_handle, object->out.new_handle);
4694 0 : return py_new_handle;
4695 : }
4696 :
4697 0 : static int py_winreg_CreateKey_out_set_new_handle(PyObject *py_obj, PyObject *value, void *closure)
4698 : {
4699 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4700 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.new_handle));
4701 0 : if (value == NULL) {
4702 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.new_handle");
4703 0 : return -1;
4704 : }
4705 0 : object->out.new_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.new_handle);
4706 0 : if (object->out.new_handle == NULL) {
4707 0 : PyErr_NoMemory();
4708 0 : return -1;
4709 : }
4710 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
4711 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4712 0 : PyErr_NoMemory();
4713 0 : return -1;
4714 : }
4715 0 : object->out.new_handle = (struct policy_handle *)pytalloc_get_ptr(value);
4716 0 : return 0;
4717 : }
4718 :
4719 0 : static PyObject *py_winreg_CreateKey_in_get_action_taken(PyObject *obj, void *closure)
4720 : {
4721 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4722 : PyObject *py_action_taken;
4723 0 : if (object->in.action_taken == NULL) {
4724 0 : Py_RETURN_NONE;
4725 : }
4726 0 : if (object->in.action_taken == NULL) {
4727 0 : py_action_taken = Py_None;
4728 0 : Py_INCREF(py_action_taken);
4729 : } else {
4730 0 : py_action_taken = PyLong_FromUnsignedLongLong((uint32_t)*object->in.action_taken);
4731 : }
4732 0 : return py_action_taken;
4733 : }
4734 :
4735 0 : static int py_winreg_CreateKey_in_set_action_taken(PyObject *py_obj, PyObject *value, void *closure)
4736 : {
4737 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4738 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.action_taken));
4739 0 : if (value == NULL) {
4740 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.action_taken");
4741 0 : return -1;
4742 : }
4743 0 : if (value == Py_None) {
4744 0 : object->in.action_taken = NULL;
4745 : } else {
4746 0 : object->in.action_taken = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.action_taken);
4747 0 : if (object->in.action_taken == NULL) {
4748 0 : PyErr_NoMemory();
4749 0 : return -1;
4750 : }
4751 : {
4752 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.action_taken));
4753 0 : if (PyLong_Check(value)) {
4754 : unsigned long long test_var;
4755 0 : test_var = PyLong_AsUnsignedLongLong(value);
4756 0 : if (PyErr_Occurred() != NULL) {
4757 0 : return -1;
4758 : }
4759 0 : if (test_var > uint_max) {
4760 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4761 : PyLong_Type.tp_name, uint_max, test_var);
4762 0 : return -1;
4763 : }
4764 0 : *object->in.action_taken = test_var;
4765 : } else {
4766 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4767 : PyLong_Type.tp_name);
4768 0 : return -1;
4769 : }
4770 : }
4771 : }
4772 0 : return 0;
4773 : }
4774 :
4775 0 : static PyObject *py_winreg_CreateKey_out_get_action_taken(PyObject *obj, void *closure)
4776 : {
4777 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4778 : PyObject *py_action_taken;
4779 0 : if (object->out.action_taken == NULL) {
4780 0 : Py_RETURN_NONE;
4781 : }
4782 0 : if (object->out.action_taken == NULL) {
4783 0 : py_action_taken = Py_None;
4784 0 : Py_INCREF(py_action_taken);
4785 : } else {
4786 0 : py_action_taken = PyLong_FromUnsignedLongLong((uint32_t)*object->out.action_taken);
4787 : }
4788 0 : return py_action_taken;
4789 : }
4790 :
4791 0 : static int py_winreg_CreateKey_out_set_action_taken(PyObject *py_obj, PyObject *value, void *closure)
4792 : {
4793 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4794 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.action_taken));
4795 0 : if (value == NULL) {
4796 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.action_taken");
4797 0 : return -1;
4798 : }
4799 0 : if (value == Py_None) {
4800 0 : object->out.action_taken = NULL;
4801 : } else {
4802 0 : object->out.action_taken = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.action_taken);
4803 0 : if (object->out.action_taken == NULL) {
4804 0 : PyErr_NoMemory();
4805 0 : return -1;
4806 : }
4807 : {
4808 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.action_taken));
4809 0 : if (PyLong_Check(value)) {
4810 : unsigned long long test_var;
4811 0 : test_var = PyLong_AsUnsignedLongLong(value);
4812 0 : if (PyErr_Occurred() != NULL) {
4813 0 : return -1;
4814 : }
4815 0 : if (test_var > uint_max) {
4816 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4817 : PyLong_Type.tp_name, uint_max, test_var);
4818 0 : return -1;
4819 : }
4820 0 : *object->out.action_taken = test_var;
4821 : } else {
4822 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4823 : PyLong_Type.tp_name);
4824 0 : return -1;
4825 : }
4826 : }
4827 : }
4828 0 : return 0;
4829 : }
4830 :
4831 0 : static PyObject *py_winreg_CreateKey_get_result(PyObject *obj, void *closure)
4832 : {
4833 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(obj);
4834 : PyObject *py_result;
4835 0 : py_result = PyErr_FromWERROR(object->out.result);
4836 0 : return py_result;
4837 : }
4838 :
4839 0 : static int py_winreg_CreateKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
4840 : {
4841 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4842 0 : if (value == NULL) {
4843 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
4844 0 : return -1;
4845 : }
4846 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
4847 0 : return 0;
4848 : }
4849 :
4850 : static PyGetSetDef py_winreg_CreateKey_getsetters[] = {
4851 : {
4852 : .name = discard_const_p(char, "in_handle"),
4853 : .get = py_winreg_CreateKey_in_get_handle,
4854 : .set = py_winreg_CreateKey_in_set_handle,
4855 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4856 : },
4857 : {
4858 : .name = discard_const_p(char, "in_name"),
4859 : .get = py_winreg_CreateKey_in_get_name,
4860 : .set = py_winreg_CreateKey_in_set_name,
4861 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
4862 : },
4863 : {
4864 : .name = discard_const_p(char, "in_keyclass"),
4865 : .get = py_winreg_CreateKey_in_get_keyclass,
4866 : .set = py_winreg_CreateKey_in_set_keyclass,
4867 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
4868 : },
4869 : {
4870 : .name = discard_const_p(char, "in_options"),
4871 : .get = py_winreg_CreateKey_in_get_options,
4872 : .set = py_winreg_CreateKey_in_set_options,
4873 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_KeyOptions")
4874 : },
4875 : {
4876 : .name = discard_const_p(char, "in_access_mask"),
4877 : .get = py_winreg_CreateKey_in_get_access_mask,
4878 : .set = py_winreg_CreateKey_in_set_access_mask,
4879 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
4880 : },
4881 : {
4882 : .name = discard_const_p(char, "in_secdesc"),
4883 : .get = py_winreg_CreateKey_in_get_secdesc,
4884 : .set = py_winreg_CreateKey_in_set_secdesc,
4885 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_SecBuf")
4886 : },
4887 : {
4888 : .name = discard_const_p(char, "out_new_handle"),
4889 : .get = py_winreg_CreateKey_out_get_new_handle,
4890 : .set = py_winreg_CreateKey_out_set_new_handle,
4891 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
4892 : },
4893 : {
4894 : .name = discard_const_p(char, "in_action_taken"),
4895 : .get = py_winreg_CreateKey_in_get_action_taken,
4896 : .set = py_winreg_CreateKey_in_set_action_taken,
4897 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_CreateAction")
4898 : },
4899 : {
4900 : .name = discard_const_p(char, "out_action_taken"),
4901 : .get = py_winreg_CreateKey_out_get_action_taken,
4902 : .set = py_winreg_CreateKey_out_set_action_taken,
4903 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_CreateAction")
4904 : },
4905 : {
4906 : .name = discard_const_p(char, "result"),
4907 : .get = py_winreg_CreateKey_get_result,
4908 : .set = py_winreg_CreateKey_set_result,
4909 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
4910 : },
4911 : { .name = NULL }
4912 : };
4913 :
4914 0 : static PyObject *py_winreg_CreateKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4915 : {
4916 0 : PyObject *self = pytalloc_new(struct winreg_CreateKey, type);
4917 0 : struct winreg_CreateKey *_self = (struct winreg_CreateKey *)pytalloc_get_ptr(self);
4918 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
4919 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
4920 0 : _self->out.new_handle = talloc_zero(mem_ctx, struct policy_handle);
4921 0 : return self;
4922 : }
4923 :
4924 0 : static PyObject *py_winreg_CreateKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
4925 : {
4926 :
4927 :
4928 0 : return PyLong_FromLong(6);
4929 : }
4930 :
4931 0 : static PyObject *py_winreg_CreateKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
4932 : {
4933 0 : const struct ndr_interface_call *call = NULL;
4934 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
4935 0 : PyObject *ret = NULL;
4936 0 : struct ndr_push *push = NULL;
4937 : DATA_BLOB blob;
4938 : enum ndr_err_code err;
4939 :
4940 0 : if (ndr_table_winreg.num_calls < 7) {
4941 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CreateKey_ndr_pack");
4942 0 : return NULL;
4943 : }
4944 0 : call = &ndr_table_winreg.calls[6];
4945 :
4946 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
4947 0 : if (push == NULL) {
4948 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4949 0 : return NULL;
4950 : }
4951 :
4952 0 : push->flags |= ndr_push_flags;
4953 :
4954 0 : err = call->ndr_push(push, ndr_inout_flags, object);
4955 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4956 0 : TALLOC_FREE(push);
4957 0 : PyErr_SetNdrError(err);
4958 0 : return NULL;
4959 : }
4960 0 : blob = ndr_push_blob(push);
4961 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4962 0 : TALLOC_FREE(push);
4963 0 : return ret;
4964 : }
4965 :
4966 0 : static PyObject *py_winreg_CreateKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4967 : {
4968 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4969 0 : PyObject *bigendian_obj = NULL;
4970 0 : PyObject *ndr64_obj = NULL;
4971 0 : uint32_t ndr_push_flags = 0;
4972 :
4973 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
4974 : discard_const_p(char *, kwnames),
4975 : &bigendian_obj,
4976 : &ndr64_obj)) {
4977 0 : return NULL;
4978 : }
4979 :
4980 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
4981 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
4982 : }
4983 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
4984 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
4985 : }
4986 :
4987 0 : return py_winreg_CreateKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
4988 : }
4989 :
4990 0 : static PyObject *py_winreg_CreateKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4991 : {
4992 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
4993 0 : PyObject *bigendian_obj = NULL;
4994 0 : PyObject *ndr64_obj = NULL;
4995 0 : uint32_t ndr_push_flags = 0;
4996 :
4997 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
4998 : discard_const_p(char *, kwnames),
4999 : &bigendian_obj,
5000 : &ndr64_obj)) {
5001 0 : return NULL;
5002 : }
5003 :
5004 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5005 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5006 : }
5007 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5008 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5009 : }
5010 :
5011 0 : return py_winreg_CreateKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
5012 : }
5013 :
5014 0 : static PyObject *py_winreg_CreateKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
5015 : {
5016 0 : const struct ndr_interface_call *call = NULL;
5017 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
5018 0 : struct ndr_pull *pull = NULL;
5019 : enum ndr_err_code err;
5020 :
5021 0 : if (ndr_table_winreg.num_calls < 7) {
5022 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CreateKey_ndr_unpack");
5023 0 : return NULL;
5024 : }
5025 0 : call = &ndr_table_winreg.calls[6];
5026 :
5027 0 : pull = ndr_pull_init_blob(blob, object);
5028 0 : if (pull == NULL) {
5029 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5030 0 : return NULL;
5031 : }
5032 :
5033 0 : pull->flags |= ndr_pull_flags;
5034 :
5035 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
5036 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5037 0 : TALLOC_FREE(pull);
5038 0 : PyErr_SetNdrError(err);
5039 0 : return NULL;
5040 : }
5041 0 : if (!allow_remaining) {
5042 : uint32_t highest_ofs;
5043 :
5044 0 : if (pull->offset > pull->relative_highest_offset) {
5045 0 : highest_ofs = pull->offset;
5046 : } else {
5047 0 : highest_ofs = pull->relative_highest_offset;
5048 : }
5049 0 : if (highest_ofs < pull->data_size) {
5050 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
5051 : "not all bytes consumed ofs[%u] size[%u]",
5052 : highest_ofs, pull->data_size);
5053 0 : TALLOC_FREE(pull);
5054 0 : PyErr_SetNdrError(err);
5055 0 : return NULL;
5056 : }
5057 : }
5058 :
5059 0 : TALLOC_FREE(pull);
5060 0 : Py_RETURN_NONE;
5061 : }
5062 :
5063 0 : static PyObject *py_winreg_CreateKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5064 : {
5065 : DATA_BLOB blob;
5066 0 : Py_ssize_t blob_length = 0;
5067 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5068 0 : PyObject *bigendian_obj = NULL;
5069 0 : PyObject *ndr64_obj = NULL;
5070 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5071 0 : PyObject *allow_remaining_obj = NULL;
5072 0 : bool allow_remaining = false;
5073 :
5074 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
5075 : discard_const_p(char *, kwnames),
5076 : &blob.data, &blob_length,
5077 : &bigendian_obj,
5078 : &ndr64_obj,
5079 : &allow_remaining_obj)) {
5080 0 : return NULL;
5081 : }
5082 0 : blob.length = blob_length;
5083 :
5084 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5085 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5086 : }
5087 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5088 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5089 : }
5090 :
5091 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5092 0 : allow_remaining = true;
5093 : }
5094 :
5095 0 : return py_winreg_CreateKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
5096 : }
5097 :
5098 0 : static PyObject *py_winreg_CreateKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5099 : {
5100 : DATA_BLOB blob;
5101 0 : Py_ssize_t blob_length = 0;
5102 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5103 0 : PyObject *bigendian_obj = NULL;
5104 0 : PyObject *ndr64_obj = NULL;
5105 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5106 0 : PyObject *allow_remaining_obj = NULL;
5107 0 : bool allow_remaining = false;
5108 :
5109 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
5110 : discard_const_p(char *, kwnames),
5111 : &blob.data, &blob_length,
5112 : &bigendian_obj,
5113 : &ndr64_obj,
5114 : &allow_remaining_obj)) {
5115 0 : return NULL;
5116 : }
5117 0 : blob.length = blob_length;
5118 :
5119 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5120 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5121 : }
5122 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5123 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5124 : }
5125 :
5126 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5127 0 : allow_remaining = true;
5128 : }
5129 :
5130 0 : return py_winreg_CreateKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
5131 : }
5132 :
5133 0 : static PyObject *py_winreg_CreateKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
5134 : {
5135 0 : const struct ndr_interface_call *call = NULL;
5136 0 : struct winreg_CreateKey *object = (struct winreg_CreateKey *)pytalloc_get_ptr(py_obj);
5137 : PyObject *ret;
5138 : char *retstr;
5139 :
5140 0 : if (ndr_table_winreg.num_calls < 7) {
5141 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_CreateKey_ndr_print");
5142 0 : return NULL;
5143 : }
5144 0 : call = &ndr_table_winreg.calls[6];
5145 :
5146 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
5147 0 : ret = PyUnicode_FromString(retstr);
5148 0 : TALLOC_FREE(retstr);
5149 :
5150 0 : return ret;
5151 : }
5152 :
5153 0 : static PyObject *py_winreg_CreateKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5154 : {
5155 0 : return py_winreg_CreateKey_ndr_print(py_obj, "winreg_CreateKey_in", NDR_IN);
5156 : }
5157 :
5158 0 : static PyObject *py_winreg_CreateKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5159 : {
5160 0 : return py_winreg_CreateKey_ndr_print(py_obj, "winreg_CreateKey_out", NDR_OUT);
5161 : }
5162 :
5163 : static PyMethodDef py_winreg_CreateKey_methods[] = {
5164 : { "opnum", (PyCFunction)py_winreg_CreateKey_ndr_opnum, METH_NOARGS|METH_CLASS,
5165 : "winreg.CreateKey.opnum() -> 6 (0x06) " },
5166 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
5167 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
5168 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
5169 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
5170 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
5171 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
5172 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_CreateKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
5173 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
5174 : { "__ndr_print_in__", (PyCFunction)py_winreg_CreateKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
5175 : { "__ndr_print_out__", (PyCFunction)py_winreg_CreateKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
5176 : { NULL, NULL, 0, NULL }
5177 : };
5178 :
5179 :
5180 : static PyTypeObject winreg_CreateKey_Type = {
5181 : PyVarObject_HEAD_INIT(NULL, 0)
5182 : .tp_name = "winreg.CreateKey",
5183 : .tp_getset = py_winreg_CreateKey_getsetters,
5184 : .tp_methods = py_winreg_CreateKey_methods,
5185 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5186 : .tp_new = py_winreg_CreateKey_new,
5187 : };
5188 :
5189 0 : static bool pack_py_winreg_CreateKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_CreateKey *r)
5190 : {
5191 : PyObject *py_handle;
5192 : PyObject *py_name;
5193 : PyObject *py_keyclass;
5194 : PyObject *py_options;
5195 : PyObject *py_access_mask;
5196 : PyObject *py_secdesc;
5197 : PyObject *py_action_taken;
5198 0 : const char *kwnames[] = {
5199 : "handle", "name", "keyclass", "options", "access_mask", "secdesc", "action_taken", NULL
5200 : };
5201 :
5202 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)) {
5203 0 : return false;
5204 : }
5205 :
5206 0 : if (py_handle == NULL) {
5207 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
5208 0 : return false;
5209 : }
5210 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
5211 0 : if (r->in.handle == NULL) {
5212 0 : PyErr_NoMemory();
5213 0 : return false;
5214 : }
5215 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
5216 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
5217 0 : PyErr_NoMemory();
5218 0 : return false;
5219 : }
5220 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
5221 0 : if (py_name == NULL) {
5222 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.name");
5223 0 : return false;
5224 : }
5225 0 : PY_CHECK_TYPE(&winreg_String_Type, py_name, return false;);
5226 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
5227 0 : PyErr_NoMemory();
5228 0 : return false;
5229 : }
5230 0 : r->in.name = *(struct winreg_String *)pytalloc_get_ptr(py_name);
5231 0 : if (py_keyclass == NULL) {
5232 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.keyclass");
5233 0 : return false;
5234 : }
5235 0 : PY_CHECK_TYPE(&winreg_String_Type, py_keyclass, return false;);
5236 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyclass)) == NULL) {
5237 0 : PyErr_NoMemory();
5238 0 : return false;
5239 : }
5240 0 : r->in.keyclass = *(struct winreg_String *)pytalloc_get_ptr(py_keyclass);
5241 0 : if (py_options == NULL) {
5242 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.options");
5243 0 : return false;
5244 : }
5245 : {
5246 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.options));
5247 0 : if (PyLong_Check(py_options)) {
5248 : unsigned long long test_var;
5249 0 : test_var = PyLong_AsUnsignedLongLong(py_options);
5250 0 : if (PyErr_Occurred() != NULL) {
5251 0 : return false;
5252 : }
5253 0 : if (test_var > uint_max) {
5254 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5255 : PyLong_Type.tp_name, uint_max, test_var);
5256 0 : return false;
5257 : }
5258 0 : r->in.options = test_var;
5259 : } else {
5260 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5261 : PyLong_Type.tp_name);
5262 0 : return false;
5263 : }
5264 : }
5265 0 : if (py_access_mask == NULL) {
5266 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
5267 0 : return false;
5268 : }
5269 : {
5270 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
5271 0 : if (PyLong_Check(py_access_mask)) {
5272 : unsigned long long test_var;
5273 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
5274 0 : if (PyErr_Occurred() != NULL) {
5275 0 : return false;
5276 : }
5277 0 : if (test_var > uint_max) {
5278 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5279 : PyLong_Type.tp_name, uint_max, test_var);
5280 0 : return false;
5281 : }
5282 0 : r->in.access_mask = test_var;
5283 : } else {
5284 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5285 : PyLong_Type.tp_name);
5286 0 : return false;
5287 : }
5288 : }
5289 0 : if (py_secdesc == NULL) {
5290 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.secdesc");
5291 0 : return false;
5292 : }
5293 0 : if (py_secdesc == Py_None) {
5294 0 : r->in.secdesc = NULL;
5295 : } else {
5296 0 : r->in.secdesc = NULL;
5297 0 : PY_CHECK_TYPE(&winreg_SecBuf_Type, py_secdesc, return false;);
5298 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_secdesc)) == NULL) {
5299 0 : PyErr_NoMemory();
5300 0 : return false;
5301 : }
5302 0 : r->in.secdesc = (struct winreg_SecBuf *)pytalloc_get_ptr(py_secdesc);
5303 : }
5304 0 : if (py_action_taken == NULL) {
5305 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.action_taken");
5306 0 : return false;
5307 : }
5308 0 : if (py_action_taken == Py_None) {
5309 0 : r->in.action_taken = NULL;
5310 : } else {
5311 0 : r->in.action_taken = talloc_ptrtype(r, r->in.action_taken);
5312 0 : if (r->in.action_taken == NULL) {
5313 0 : PyErr_NoMemory();
5314 0 : return false;
5315 : }
5316 : {
5317 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.action_taken));
5318 0 : if (PyLong_Check(py_action_taken)) {
5319 : unsigned long long test_var;
5320 0 : test_var = PyLong_AsUnsignedLongLong(py_action_taken);
5321 0 : if (PyErr_Occurred() != NULL) {
5322 0 : return false;
5323 : }
5324 0 : if (test_var > uint_max) {
5325 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5326 : PyLong_Type.tp_name, uint_max, test_var);
5327 0 : return false;
5328 : }
5329 0 : *r->in.action_taken = test_var;
5330 : } else {
5331 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5332 : PyLong_Type.tp_name);
5333 0 : return false;
5334 : }
5335 : }
5336 : }
5337 0 : return true;
5338 : }
5339 :
5340 0 : static PyObject *unpack_py_winreg_CreateKey_args_out(struct winreg_CreateKey *r)
5341 : {
5342 : PyObject *result;
5343 : PyObject *py_new_handle;
5344 : PyObject *py_action_taken;
5345 0 : result = PyTuple_New(2);
5346 0 : py_new_handle = pytalloc_reference_ex(policy_handle_Type, r->out.new_handle, r->out.new_handle);
5347 0 : PyTuple_SetItem(result, 0, py_new_handle);
5348 0 : if (r->out.action_taken == NULL) {
5349 0 : py_action_taken = Py_None;
5350 0 : Py_INCREF(py_action_taken);
5351 : } else {
5352 0 : py_action_taken = PyLong_FromUnsignedLongLong((uint32_t)*r->out.action_taken);
5353 : }
5354 0 : PyTuple_SetItem(result, 1, py_action_taken);
5355 0 : if (!W_ERROR_IS_OK(r->out.result)) {
5356 0 : PyErr_SetWERROR(r->out.result);
5357 0 : return NULL;
5358 : }
5359 :
5360 0 : return result;
5361 : }
5362 :
5363 :
5364 0 : static PyObject *py_winreg_DeleteKey_in_get_handle(PyObject *obj, void *closure)
5365 : {
5366 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(obj);
5367 : PyObject *py_handle;
5368 0 : if (object->in.handle == NULL) {
5369 0 : Py_RETURN_NONE;
5370 : }
5371 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
5372 0 : return py_handle;
5373 : }
5374 :
5375 0 : static int py_winreg_DeleteKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
5376 : {
5377 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(py_obj);
5378 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
5379 0 : if (value == NULL) {
5380 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
5381 0 : return -1;
5382 : }
5383 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
5384 0 : if (object->in.handle == NULL) {
5385 0 : PyErr_NoMemory();
5386 0 : return -1;
5387 : }
5388 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
5389 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5390 0 : PyErr_NoMemory();
5391 0 : return -1;
5392 : }
5393 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
5394 0 : return 0;
5395 : }
5396 :
5397 0 : static PyObject *py_winreg_DeleteKey_in_get_key(PyObject *obj, void *closure)
5398 : {
5399 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(obj);
5400 : PyObject *py_key;
5401 0 : py_key = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.key);
5402 0 : return py_key;
5403 : }
5404 :
5405 0 : static int py_winreg_DeleteKey_in_set_key(PyObject *py_obj, PyObject *value, void *closure)
5406 : {
5407 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(py_obj);
5408 0 : if (value == NULL) {
5409 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.key");
5410 0 : return -1;
5411 : }
5412 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
5413 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5414 0 : PyErr_NoMemory();
5415 0 : return -1;
5416 : }
5417 0 : object->in.key = *(struct winreg_String *)pytalloc_get_ptr(value);
5418 0 : return 0;
5419 : }
5420 :
5421 0 : static PyObject *py_winreg_DeleteKey_get_result(PyObject *obj, void *closure)
5422 : {
5423 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(obj);
5424 : PyObject *py_result;
5425 0 : py_result = PyErr_FromWERROR(object->out.result);
5426 0 : return py_result;
5427 : }
5428 :
5429 0 : static int py_winreg_DeleteKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
5430 : {
5431 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(py_obj);
5432 0 : if (value == NULL) {
5433 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
5434 0 : return -1;
5435 : }
5436 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
5437 0 : return 0;
5438 : }
5439 :
5440 : static PyGetSetDef py_winreg_DeleteKey_getsetters[] = {
5441 : {
5442 : .name = discard_const_p(char, "in_handle"),
5443 : .get = py_winreg_DeleteKey_in_get_handle,
5444 : .set = py_winreg_DeleteKey_in_set_handle,
5445 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
5446 : },
5447 : {
5448 : .name = discard_const_p(char, "in_key"),
5449 : .get = py_winreg_DeleteKey_in_get_key,
5450 : .set = py_winreg_DeleteKey_in_set_key,
5451 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
5452 : },
5453 : {
5454 : .name = discard_const_p(char, "result"),
5455 : .get = py_winreg_DeleteKey_get_result,
5456 : .set = py_winreg_DeleteKey_set_result,
5457 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
5458 : },
5459 : { .name = NULL }
5460 : };
5461 :
5462 0 : static PyObject *py_winreg_DeleteKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5463 : {
5464 0 : PyObject *self = pytalloc_new(struct winreg_DeleteKey, type);
5465 0 : struct winreg_DeleteKey *_self = (struct winreg_DeleteKey *)pytalloc_get_ptr(self);
5466 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
5467 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
5468 0 : return self;
5469 : }
5470 :
5471 0 : static PyObject *py_winreg_DeleteKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
5472 : {
5473 :
5474 :
5475 0 : return PyLong_FromLong(7);
5476 : }
5477 :
5478 0 : static PyObject *py_winreg_DeleteKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
5479 : {
5480 0 : const struct ndr_interface_call *call = NULL;
5481 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(py_obj);
5482 0 : PyObject *ret = NULL;
5483 0 : struct ndr_push *push = NULL;
5484 : DATA_BLOB blob;
5485 : enum ndr_err_code err;
5486 :
5487 0 : if (ndr_table_winreg.num_calls < 8) {
5488 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKey_ndr_pack");
5489 0 : return NULL;
5490 : }
5491 0 : call = &ndr_table_winreg.calls[7];
5492 :
5493 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
5494 0 : if (push == NULL) {
5495 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5496 0 : return NULL;
5497 : }
5498 :
5499 0 : push->flags |= ndr_push_flags;
5500 :
5501 0 : err = call->ndr_push(push, ndr_inout_flags, object);
5502 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5503 0 : TALLOC_FREE(push);
5504 0 : PyErr_SetNdrError(err);
5505 0 : return NULL;
5506 : }
5507 0 : blob = ndr_push_blob(push);
5508 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5509 0 : TALLOC_FREE(push);
5510 0 : return ret;
5511 : }
5512 :
5513 0 : static PyObject *py_winreg_DeleteKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5514 : {
5515 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5516 0 : PyObject *bigendian_obj = NULL;
5517 0 : PyObject *ndr64_obj = NULL;
5518 0 : uint32_t ndr_push_flags = 0;
5519 :
5520 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
5521 : discard_const_p(char *, kwnames),
5522 : &bigendian_obj,
5523 : &ndr64_obj)) {
5524 0 : return NULL;
5525 : }
5526 :
5527 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5528 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5529 : }
5530 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5531 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5532 : }
5533 :
5534 0 : return py_winreg_DeleteKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
5535 : }
5536 :
5537 0 : static PyObject *py_winreg_DeleteKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5538 : {
5539 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5540 0 : PyObject *bigendian_obj = NULL;
5541 0 : PyObject *ndr64_obj = NULL;
5542 0 : uint32_t ndr_push_flags = 0;
5543 :
5544 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
5545 : discard_const_p(char *, kwnames),
5546 : &bigendian_obj,
5547 : &ndr64_obj)) {
5548 0 : return NULL;
5549 : }
5550 :
5551 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5552 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5553 : }
5554 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5555 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5556 : }
5557 :
5558 0 : return py_winreg_DeleteKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
5559 : }
5560 :
5561 0 : static PyObject *py_winreg_DeleteKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
5562 : {
5563 0 : const struct ndr_interface_call *call = NULL;
5564 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(py_obj);
5565 0 : struct ndr_pull *pull = NULL;
5566 : enum ndr_err_code err;
5567 :
5568 0 : if (ndr_table_winreg.num_calls < 8) {
5569 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKey_ndr_unpack");
5570 0 : return NULL;
5571 : }
5572 0 : call = &ndr_table_winreg.calls[7];
5573 :
5574 0 : pull = ndr_pull_init_blob(blob, object);
5575 0 : if (pull == NULL) {
5576 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5577 0 : return NULL;
5578 : }
5579 :
5580 0 : pull->flags |= ndr_pull_flags;
5581 :
5582 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
5583 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5584 0 : TALLOC_FREE(pull);
5585 0 : PyErr_SetNdrError(err);
5586 0 : return NULL;
5587 : }
5588 0 : if (!allow_remaining) {
5589 : uint32_t highest_ofs;
5590 :
5591 0 : if (pull->offset > pull->relative_highest_offset) {
5592 0 : highest_ofs = pull->offset;
5593 : } else {
5594 0 : highest_ofs = pull->relative_highest_offset;
5595 : }
5596 0 : if (highest_ofs < pull->data_size) {
5597 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
5598 : "not all bytes consumed ofs[%u] size[%u]",
5599 : highest_ofs, pull->data_size);
5600 0 : TALLOC_FREE(pull);
5601 0 : PyErr_SetNdrError(err);
5602 0 : return NULL;
5603 : }
5604 : }
5605 :
5606 0 : TALLOC_FREE(pull);
5607 0 : Py_RETURN_NONE;
5608 : }
5609 :
5610 0 : static PyObject *py_winreg_DeleteKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5611 : {
5612 : DATA_BLOB blob;
5613 0 : Py_ssize_t blob_length = 0;
5614 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5615 0 : PyObject *bigendian_obj = NULL;
5616 0 : PyObject *ndr64_obj = NULL;
5617 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5618 0 : PyObject *allow_remaining_obj = NULL;
5619 0 : bool allow_remaining = false;
5620 :
5621 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
5622 : discard_const_p(char *, kwnames),
5623 : &blob.data, &blob_length,
5624 : &bigendian_obj,
5625 : &ndr64_obj,
5626 : &allow_remaining_obj)) {
5627 0 : return NULL;
5628 : }
5629 0 : blob.length = blob_length;
5630 :
5631 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5632 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5633 : }
5634 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5635 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5636 : }
5637 :
5638 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5639 0 : allow_remaining = true;
5640 : }
5641 :
5642 0 : return py_winreg_DeleteKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
5643 : }
5644 :
5645 0 : static PyObject *py_winreg_DeleteKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5646 : {
5647 : DATA_BLOB blob;
5648 0 : Py_ssize_t blob_length = 0;
5649 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
5650 0 : PyObject *bigendian_obj = NULL;
5651 0 : PyObject *ndr64_obj = NULL;
5652 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
5653 0 : PyObject *allow_remaining_obj = NULL;
5654 0 : bool allow_remaining = false;
5655 :
5656 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
5657 : discard_const_p(char *, kwnames),
5658 : &blob.data, &blob_length,
5659 : &bigendian_obj,
5660 : &ndr64_obj,
5661 : &allow_remaining_obj)) {
5662 0 : return NULL;
5663 : }
5664 0 : blob.length = blob_length;
5665 :
5666 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5667 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
5668 : }
5669 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5670 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
5671 : }
5672 :
5673 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5674 0 : allow_remaining = true;
5675 : }
5676 :
5677 0 : return py_winreg_DeleteKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
5678 : }
5679 :
5680 0 : static PyObject *py_winreg_DeleteKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
5681 : {
5682 0 : const struct ndr_interface_call *call = NULL;
5683 0 : struct winreg_DeleteKey *object = (struct winreg_DeleteKey *)pytalloc_get_ptr(py_obj);
5684 : PyObject *ret;
5685 : char *retstr;
5686 :
5687 0 : if (ndr_table_winreg.num_calls < 8) {
5688 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKey_ndr_print");
5689 0 : return NULL;
5690 : }
5691 0 : call = &ndr_table_winreg.calls[7];
5692 :
5693 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
5694 0 : ret = PyUnicode_FromString(retstr);
5695 0 : TALLOC_FREE(retstr);
5696 :
5697 0 : return ret;
5698 : }
5699 :
5700 0 : static PyObject *py_winreg_DeleteKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5701 : {
5702 0 : return py_winreg_DeleteKey_ndr_print(py_obj, "winreg_DeleteKey_in", NDR_IN);
5703 : }
5704 :
5705 0 : static PyObject *py_winreg_DeleteKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5706 : {
5707 0 : return py_winreg_DeleteKey_ndr_print(py_obj, "winreg_DeleteKey_out", NDR_OUT);
5708 : }
5709 :
5710 : static PyMethodDef py_winreg_DeleteKey_methods[] = {
5711 : { "opnum", (PyCFunction)py_winreg_DeleteKey_ndr_opnum, METH_NOARGS|METH_CLASS,
5712 : "winreg.DeleteKey.opnum() -> 7 (0x07) " },
5713 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
5714 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
5715 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
5716 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
5717 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
5718 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
5719 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
5720 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
5721 : { "__ndr_print_in__", (PyCFunction)py_winreg_DeleteKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
5722 : { "__ndr_print_out__", (PyCFunction)py_winreg_DeleteKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
5723 : { NULL, NULL, 0, NULL }
5724 : };
5725 :
5726 :
5727 : static PyTypeObject winreg_DeleteKey_Type = {
5728 : PyVarObject_HEAD_INIT(NULL, 0)
5729 : .tp_name = "winreg.DeleteKey",
5730 : .tp_getset = py_winreg_DeleteKey_getsetters,
5731 : .tp_methods = py_winreg_DeleteKey_methods,
5732 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5733 : .tp_new = py_winreg_DeleteKey_new,
5734 : };
5735 :
5736 0 : static bool pack_py_winreg_DeleteKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteKey *r)
5737 : {
5738 : PyObject *py_handle;
5739 : PyObject *py_key;
5740 0 : const char *kwnames[] = {
5741 : "handle", "key", NULL
5742 : };
5743 :
5744 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_DeleteKey", discard_const_p(char *, kwnames), &py_handle, &py_key)) {
5745 0 : return false;
5746 : }
5747 :
5748 0 : if (py_handle == NULL) {
5749 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
5750 0 : return false;
5751 : }
5752 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
5753 0 : if (r->in.handle == NULL) {
5754 0 : PyErr_NoMemory();
5755 0 : return false;
5756 : }
5757 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
5758 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
5759 0 : PyErr_NoMemory();
5760 0 : return false;
5761 : }
5762 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
5763 0 : if (py_key == NULL) {
5764 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.key");
5765 0 : return false;
5766 : }
5767 0 : PY_CHECK_TYPE(&winreg_String_Type, py_key, return false;);
5768 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key)) == NULL) {
5769 0 : PyErr_NoMemory();
5770 0 : return false;
5771 : }
5772 0 : r->in.key = *(struct winreg_String *)pytalloc_get_ptr(py_key);
5773 0 : return true;
5774 : }
5775 :
5776 0 : static PyObject *unpack_py_winreg_DeleteKey_args_out(struct winreg_DeleteKey *r)
5777 : {
5778 : PyObject *result;
5779 0 : result = Py_None;
5780 0 : Py_INCREF(result);
5781 0 : if (!W_ERROR_IS_OK(r->out.result)) {
5782 0 : PyErr_SetWERROR(r->out.result);
5783 0 : return NULL;
5784 : }
5785 :
5786 0 : return result;
5787 : }
5788 :
5789 :
5790 0 : static PyObject *py_winreg_DeleteValue_in_get_handle(PyObject *obj, void *closure)
5791 : {
5792 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(obj);
5793 : PyObject *py_handle;
5794 0 : if (object->in.handle == NULL) {
5795 0 : Py_RETURN_NONE;
5796 : }
5797 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
5798 0 : return py_handle;
5799 : }
5800 :
5801 0 : static int py_winreg_DeleteValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
5802 : {
5803 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(py_obj);
5804 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
5805 0 : if (value == NULL) {
5806 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
5807 0 : return -1;
5808 : }
5809 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
5810 0 : if (object->in.handle == NULL) {
5811 0 : PyErr_NoMemory();
5812 0 : return -1;
5813 : }
5814 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
5815 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5816 0 : PyErr_NoMemory();
5817 0 : return -1;
5818 : }
5819 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
5820 0 : return 0;
5821 : }
5822 :
5823 0 : static PyObject *py_winreg_DeleteValue_in_get_value(PyObject *obj, void *closure)
5824 : {
5825 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(obj);
5826 : PyObject *py_value;
5827 0 : py_value = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.value);
5828 0 : return py_value;
5829 : }
5830 :
5831 0 : static int py_winreg_DeleteValue_in_set_value(PyObject *py_obj, PyObject *value, void *closure)
5832 : {
5833 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(py_obj);
5834 0 : if (value == NULL) {
5835 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.value");
5836 0 : return -1;
5837 : }
5838 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
5839 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5840 0 : PyErr_NoMemory();
5841 0 : return -1;
5842 : }
5843 0 : object->in.value = *(struct winreg_String *)pytalloc_get_ptr(value);
5844 0 : return 0;
5845 : }
5846 :
5847 0 : static PyObject *py_winreg_DeleteValue_get_result(PyObject *obj, void *closure)
5848 : {
5849 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(obj);
5850 : PyObject *py_result;
5851 0 : py_result = PyErr_FromWERROR(object->out.result);
5852 0 : return py_result;
5853 : }
5854 :
5855 0 : static int py_winreg_DeleteValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
5856 : {
5857 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(py_obj);
5858 0 : if (value == NULL) {
5859 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
5860 0 : return -1;
5861 : }
5862 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
5863 0 : return 0;
5864 : }
5865 :
5866 : static PyGetSetDef py_winreg_DeleteValue_getsetters[] = {
5867 : {
5868 : .name = discard_const_p(char, "in_handle"),
5869 : .get = py_winreg_DeleteValue_in_get_handle,
5870 : .set = py_winreg_DeleteValue_in_set_handle,
5871 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
5872 : },
5873 : {
5874 : .name = discard_const_p(char, "in_value"),
5875 : .get = py_winreg_DeleteValue_in_get_value,
5876 : .set = py_winreg_DeleteValue_in_set_value,
5877 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
5878 : },
5879 : {
5880 : .name = discard_const_p(char, "result"),
5881 : .get = py_winreg_DeleteValue_get_result,
5882 : .set = py_winreg_DeleteValue_set_result,
5883 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
5884 : },
5885 : { .name = NULL }
5886 : };
5887 :
5888 0 : static PyObject *py_winreg_DeleteValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5889 : {
5890 0 : PyObject *self = pytalloc_new(struct winreg_DeleteValue, type);
5891 0 : struct winreg_DeleteValue *_self = (struct winreg_DeleteValue *)pytalloc_get_ptr(self);
5892 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
5893 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
5894 0 : return self;
5895 : }
5896 :
5897 0 : static PyObject *py_winreg_DeleteValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
5898 : {
5899 :
5900 :
5901 0 : return PyLong_FromLong(8);
5902 : }
5903 :
5904 0 : static PyObject *py_winreg_DeleteValue_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
5905 : {
5906 0 : const struct ndr_interface_call *call = NULL;
5907 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(py_obj);
5908 0 : PyObject *ret = NULL;
5909 0 : struct ndr_push *push = NULL;
5910 : DATA_BLOB blob;
5911 : enum ndr_err_code err;
5912 :
5913 0 : if (ndr_table_winreg.num_calls < 9) {
5914 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteValue_ndr_pack");
5915 0 : return NULL;
5916 : }
5917 0 : call = &ndr_table_winreg.calls[8];
5918 :
5919 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
5920 0 : if (push == NULL) {
5921 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5922 0 : return NULL;
5923 : }
5924 :
5925 0 : push->flags |= ndr_push_flags;
5926 :
5927 0 : err = call->ndr_push(push, ndr_inout_flags, object);
5928 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5929 0 : TALLOC_FREE(push);
5930 0 : PyErr_SetNdrError(err);
5931 0 : return NULL;
5932 : }
5933 0 : blob = ndr_push_blob(push);
5934 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5935 0 : TALLOC_FREE(push);
5936 0 : return ret;
5937 : }
5938 :
5939 0 : static PyObject *py_winreg_DeleteValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5940 : {
5941 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5942 0 : PyObject *bigendian_obj = NULL;
5943 0 : PyObject *ndr64_obj = NULL;
5944 0 : uint32_t ndr_push_flags = 0;
5945 :
5946 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
5947 : discard_const_p(char *, kwnames),
5948 : &bigendian_obj,
5949 : &ndr64_obj)) {
5950 0 : return NULL;
5951 : }
5952 :
5953 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5954 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5955 : }
5956 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5957 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5958 : }
5959 :
5960 0 : return py_winreg_DeleteValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
5961 : }
5962 :
5963 0 : static PyObject *py_winreg_DeleteValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5964 : {
5965 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
5966 0 : PyObject *bigendian_obj = NULL;
5967 0 : PyObject *ndr64_obj = NULL;
5968 0 : uint32_t ndr_push_flags = 0;
5969 :
5970 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
5971 : discard_const_p(char *, kwnames),
5972 : &bigendian_obj,
5973 : &ndr64_obj)) {
5974 0 : return NULL;
5975 : }
5976 :
5977 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
5978 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
5979 : }
5980 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
5981 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
5982 : }
5983 :
5984 0 : return py_winreg_DeleteValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
5985 : }
5986 :
5987 0 : static PyObject *py_winreg_DeleteValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
5988 : {
5989 0 : const struct ndr_interface_call *call = NULL;
5990 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(py_obj);
5991 0 : struct ndr_pull *pull = NULL;
5992 : enum ndr_err_code err;
5993 :
5994 0 : if (ndr_table_winreg.num_calls < 9) {
5995 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteValue_ndr_unpack");
5996 0 : return NULL;
5997 : }
5998 0 : call = &ndr_table_winreg.calls[8];
5999 :
6000 0 : pull = ndr_pull_init_blob(blob, object);
6001 0 : if (pull == NULL) {
6002 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
6003 0 : return NULL;
6004 : }
6005 :
6006 0 : pull->flags |= ndr_pull_flags;
6007 :
6008 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
6009 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6010 0 : TALLOC_FREE(pull);
6011 0 : PyErr_SetNdrError(err);
6012 0 : return NULL;
6013 : }
6014 0 : if (!allow_remaining) {
6015 : uint32_t highest_ofs;
6016 :
6017 0 : if (pull->offset > pull->relative_highest_offset) {
6018 0 : highest_ofs = pull->offset;
6019 : } else {
6020 0 : highest_ofs = pull->relative_highest_offset;
6021 : }
6022 0 : if (highest_ofs < pull->data_size) {
6023 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
6024 : "not all bytes consumed ofs[%u] size[%u]",
6025 : highest_ofs, pull->data_size);
6026 0 : TALLOC_FREE(pull);
6027 0 : PyErr_SetNdrError(err);
6028 0 : return NULL;
6029 : }
6030 : }
6031 :
6032 0 : TALLOC_FREE(pull);
6033 0 : Py_RETURN_NONE;
6034 : }
6035 :
6036 0 : static PyObject *py_winreg_DeleteValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6037 : {
6038 : DATA_BLOB blob;
6039 0 : Py_ssize_t blob_length = 0;
6040 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6041 0 : PyObject *bigendian_obj = NULL;
6042 0 : PyObject *ndr64_obj = NULL;
6043 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6044 0 : PyObject *allow_remaining_obj = NULL;
6045 0 : bool allow_remaining = false;
6046 :
6047 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
6048 : discard_const_p(char *, kwnames),
6049 : &blob.data, &blob_length,
6050 : &bigendian_obj,
6051 : &ndr64_obj,
6052 : &allow_remaining_obj)) {
6053 0 : return NULL;
6054 : }
6055 0 : blob.length = blob_length;
6056 :
6057 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6058 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6059 : }
6060 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6061 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6062 : }
6063 :
6064 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6065 0 : allow_remaining = true;
6066 : }
6067 :
6068 0 : return py_winreg_DeleteValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
6069 : }
6070 :
6071 0 : static PyObject *py_winreg_DeleteValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6072 : {
6073 : DATA_BLOB blob;
6074 0 : Py_ssize_t blob_length = 0;
6075 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6076 0 : PyObject *bigendian_obj = NULL;
6077 0 : PyObject *ndr64_obj = NULL;
6078 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6079 0 : PyObject *allow_remaining_obj = NULL;
6080 0 : bool allow_remaining = false;
6081 :
6082 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
6083 : discard_const_p(char *, kwnames),
6084 : &blob.data, &blob_length,
6085 : &bigendian_obj,
6086 : &ndr64_obj,
6087 : &allow_remaining_obj)) {
6088 0 : return NULL;
6089 : }
6090 0 : blob.length = blob_length;
6091 :
6092 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6093 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6094 : }
6095 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6096 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6097 : }
6098 :
6099 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6100 0 : allow_remaining = true;
6101 : }
6102 :
6103 0 : return py_winreg_DeleteValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
6104 : }
6105 :
6106 0 : static PyObject *py_winreg_DeleteValue_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
6107 : {
6108 0 : const struct ndr_interface_call *call = NULL;
6109 0 : struct winreg_DeleteValue *object = (struct winreg_DeleteValue *)pytalloc_get_ptr(py_obj);
6110 : PyObject *ret;
6111 : char *retstr;
6112 :
6113 0 : if (ndr_table_winreg.num_calls < 9) {
6114 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteValue_ndr_print");
6115 0 : return NULL;
6116 : }
6117 0 : call = &ndr_table_winreg.calls[8];
6118 :
6119 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
6120 0 : ret = PyUnicode_FromString(retstr);
6121 0 : TALLOC_FREE(retstr);
6122 :
6123 0 : return ret;
6124 : }
6125 :
6126 0 : static PyObject *py_winreg_DeleteValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6127 : {
6128 0 : return py_winreg_DeleteValue_ndr_print(py_obj, "winreg_DeleteValue_in", NDR_IN);
6129 : }
6130 :
6131 0 : static PyObject *py_winreg_DeleteValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6132 : {
6133 0 : return py_winreg_DeleteValue_ndr_print(py_obj, "winreg_DeleteValue_out", NDR_OUT);
6134 : }
6135 :
6136 : static PyMethodDef py_winreg_DeleteValue_methods[] = {
6137 : { "opnum", (PyCFunction)py_winreg_DeleteValue_ndr_opnum, METH_NOARGS|METH_CLASS,
6138 : "winreg.DeleteValue.opnum() -> 8 (0x08) " },
6139 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
6140 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
6141 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
6142 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
6143 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
6144 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
6145 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
6146 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
6147 : { "__ndr_print_in__", (PyCFunction)py_winreg_DeleteValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
6148 : { "__ndr_print_out__", (PyCFunction)py_winreg_DeleteValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
6149 : { NULL, NULL, 0, NULL }
6150 : };
6151 :
6152 :
6153 : static PyTypeObject winreg_DeleteValue_Type = {
6154 : PyVarObject_HEAD_INIT(NULL, 0)
6155 : .tp_name = "winreg.DeleteValue",
6156 : .tp_getset = py_winreg_DeleteValue_getsetters,
6157 : .tp_methods = py_winreg_DeleteValue_methods,
6158 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6159 : .tp_new = py_winreg_DeleteValue_new,
6160 : };
6161 :
6162 0 : static bool pack_py_winreg_DeleteValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteValue *r)
6163 : {
6164 : PyObject *py_handle;
6165 : PyObject *py_value;
6166 0 : const char *kwnames[] = {
6167 : "handle", "value", NULL
6168 : };
6169 :
6170 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_DeleteValue", discard_const_p(char *, kwnames), &py_handle, &py_value)) {
6171 0 : return false;
6172 : }
6173 :
6174 0 : if (py_handle == NULL) {
6175 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
6176 0 : return false;
6177 : }
6178 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
6179 0 : if (r->in.handle == NULL) {
6180 0 : PyErr_NoMemory();
6181 0 : return false;
6182 : }
6183 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
6184 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
6185 0 : PyErr_NoMemory();
6186 0 : return false;
6187 : }
6188 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
6189 0 : if (py_value == NULL) {
6190 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.value");
6191 0 : return false;
6192 : }
6193 0 : PY_CHECK_TYPE(&winreg_String_Type, py_value, return false;);
6194 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_value)) == NULL) {
6195 0 : PyErr_NoMemory();
6196 0 : return false;
6197 : }
6198 0 : r->in.value = *(struct winreg_String *)pytalloc_get_ptr(py_value);
6199 0 : return true;
6200 : }
6201 :
6202 0 : static PyObject *unpack_py_winreg_DeleteValue_args_out(struct winreg_DeleteValue *r)
6203 : {
6204 : PyObject *result;
6205 0 : result = Py_None;
6206 0 : Py_INCREF(result);
6207 0 : if (!W_ERROR_IS_OK(r->out.result)) {
6208 0 : PyErr_SetWERROR(r->out.result);
6209 0 : return NULL;
6210 : }
6211 :
6212 0 : return result;
6213 : }
6214 :
6215 :
6216 0 : static PyObject *py_winreg_EnumKey_in_get_handle(PyObject *obj, void *closure)
6217 : {
6218 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6219 : PyObject *py_handle;
6220 0 : if (object->in.handle == NULL) {
6221 0 : Py_RETURN_NONE;
6222 : }
6223 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
6224 0 : return py_handle;
6225 : }
6226 :
6227 0 : static int py_winreg_EnumKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
6228 : {
6229 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6230 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
6231 0 : if (value == NULL) {
6232 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
6233 0 : return -1;
6234 : }
6235 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
6236 0 : if (object->in.handle == NULL) {
6237 0 : PyErr_NoMemory();
6238 0 : return -1;
6239 : }
6240 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
6241 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6242 0 : PyErr_NoMemory();
6243 0 : return -1;
6244 : }
6245 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
6246 0 : return 0;
6247 : }
6248 :
6249 0 : static PyObject *py_winreg_EnumKey_in_get_enum_index(PyObject *obj, void *closure)
6250 : {
6251 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6252 : PyObject *py_enum_index;
6253 0 : py_enum_index = PyLong_FromUnsignedLongLong((uint32_t)object->in.enum_index);
6254 0 : return py_enum_index;
6255 : }
6256 :
6257 0 : static int py_winreg_EnumKey_in_set_enum_index(PyObject *py_obj, PyObject *value, void *closure)
6258 : {
6259 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6260 0 : if (value == NULL) {
6261 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.enum_index");
6262 0 : return -1;
6263 : }
6264 : {
6265 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.enum_index));
6266 0 : if (PyLong_Check(value)) {
6267 : unsigned long long test_var;
6268 0 : test_var = PyLong_AsUnsignedLongLong(value);
6269 0 : if (PyErr_Occurred() != NULL) {
6270 0 : return -1;
6271 : }
6272 0 : if (test_var > uint_max) {
6273 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6274 : PyLong_Type.tp_name, uint_max, test_var);
6275 0 : return -1;
6276 : }
6277 0 : object->in.enum_index = test_var;
6278 : } else {
6279 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6280 : PyLong_Type.tp_name);
6281 0 : return -1;
6282 : }
6283 : }
6284 0 : return 0;
6285 : }
6286 :
6287 0 : static PyObject *py_winreg_EnumKey_in_get_name(PyObject *obj, void *closure)
6288 : {
6289 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6290 : PyObject *py_name;
6291 0 : if (object->in.name == NULL) {
6292 0 : Py_RETURN_NONE;
6293 : }
6294 0 : py_name = pytalloc_reference_ex(&winreg_StringBuf_Type, object->in.name, object->in.name);
6295 0 : return py_name;
6296 : }
6297 :
6298 0 : static int py_winreg_EnumKey_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
6299 : {
6300 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6301 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.name));
6302 0 : if (value == NULL) {
6303 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.name");
6304 0 : return -1;
6305 : }
6306 0 : object->in.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.name);
6307 0 : if (object->in.name == NULL) {
6308 0 : PyErr_NoMemory();
6309 0 : return -1;
6310 : }
6311 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6312 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6313 0 : PyErr_NoMemory();
6314 0 : return -1;
6315 : }
6316 0 : object->in.name = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6317 0 : return 0;
6318 : }
6319 :
6320 0 : static PyObject *py_winreg_EnumKey_out_get_name(PyObject *obj, void *closure)
6321 : {
6322 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6323 : PyObject *py_name;
6324 0 : if (object->out.name == NULL) {
6325 0 : Py_RETURN_NONE;
6326 : }
6327 0 : py_name = pytalloc_reference_ex(&winreg_StringBuf_Type, object->out.name, object->out.name);
6328 0 : return py_name;
6329 : }
6330 :
6331 0 : static int py_winreg_EnumKey_out_set_name(PyObject *py_obj, PyObject *value, void *closure)
6332 : {
6333 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6334 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.name));
6335 0 : if (value == NULL) {
6336 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.name");
6337 0 : return -1;
6338 : }
6339 0 : object->out.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.name);
6340 0 : if (object->out.name == NULL) {
6341 0 : PyErr_NoMemory();
6342 0 : return -1;
6343 : }
6344 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6345 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6346 0 : PyErr_NoMemory();
6347 0 : return -1;
6348 : }
6349 0 : object->out.name = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6350 0 : return 0;
6351 : }
6352 :
6353 0 : static PyObject *py_winreg_EnumKey_in_get_keyclass(PyObject *obj, void *closure)
6354 : {
6355 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6356 : PyObject *py_keyclass;
6357 0 : if (object->in.keyclass == NULL) {
6358 0 : Py_RETURN_NONE;
6359 : }
6360 0 : if (object->in.keyclass == NULL) {
6361 0 : py_keyclass = Py_None;
6362 0 : Py_INCREF(py_keyclass);
6363 : } else {
6364 0 : py_keyclass = pytalloc_reference_ex(&winreg_StringBuf_Type, object->in.keyclass, object->in.keyclass);
6365 : }
6366 0 : return py_keyclass;
6367 : }
6368 :
6369 0 : static int py_winreg_EnumKey_in_set_keyclass(PyObject *py_obj, PyObject *value, void *closure)
6370 : {
6371 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6372 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.keyclass));
6373 0 : if (value == NULL) {
6374 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.keyclass");
6375 0 : return -1;
6376 : }
6377 0 : if (value == Py_None) {
6378 0 : object->in.keyclass = NULL;
6379 : } else {
6380 0 : object->in.keyclass = NULL;
6381 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6382 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6383 0 : PyErr_NoMemory();
6384 0 : return -1;
6385 : }
6386 0 : object->in.keyclass = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6387 : }
6388 0 : return 0;
6389 : }
6390 :
6391 0 : static PyObject *py_winreg_EnumKey_out_get_keyclass(PyObject *obj, void *closure)
6392 : {
6393 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6394 : PyObject *py_keyclass;
6395 0 : if (object->out.keyclass == NULL) {
6396 0 : Py_RETURN_NONE;
6397 : }
6398 0 : if (object->out.keyclass == NULL) {
6399 0 : py_keyclass = Py_None;
6400 0 : Py_INCREF(py_keyclass);
6401 : } else {
6402 0 : py_keyclass = pytalloc_reference_ex(&winreg_StringBuf_Type, object->out.keyclass, object->out.keyclass);
6403 : }
6404 0 : return py_keyclass;
6405 : }
6406 :
6407 0 : static int py_winreg_EnumKey_out_set_keyclass(PyObject *py_obj, PyObject *value, void *closure)
6408 : {
6409 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6410 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.keyclass));
6411 0 : if (value == NULL) {
6412 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.keyclass");
6413 0 : return -1;
6414 : }
6415 0 : if (value == Py_None) {
6416 0 : object->out.keyclass = NULL;
6417 : } else {
6418 0 : object->out.keyclass = NULL;
6419 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, value, return -1;);
6420 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
6421 0 : PyErr_NoMemory();
6422 0 : return -1;
6423 : }
6424 0 : object->out.keyclass = (struct winreg_StringBuf *)pytalloc_get_ptr(value);
6425 : }
6426 0 : return 0;
6427 : }
6428 :
6429 0 : static PyObject *py_winreg_EnumKey_in_get_last_changed_time(PyObject *obj, void *closure)
6430 : {
6431 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6432 : PyObject *py_last_changed_time;
6433 0 : if (object->in.last_changed_time == NULL) {
6434 0 : Py_RETURN_NONE;
6435 : }
6436 0 : if (object->in.last_changed_time == NULL) {
6437 0 : py_last_changed_time = Py_None;
6438 0 : Py_INCREF(py_last_changed_time);
6439 : } else {
6440 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*object->in.last_changed_time);
6441 : }
6442 0 : return py_last_changed_time;
6443 : }
6444 :
6445 0 : static int py_winreg_EnumKey_in_set_last_changed_time(PyObject *py_obj, PyObject *value, void *closure)
6446 : {
6447 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6448 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.last_changed_time));
6449 0 : if (value == NULL) {
6450 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.last_changed_time");
6451 0 : return -1;
6452 : }
6453 0 : if (value == Py_None) {
6454 0 : object->in.last_changed_time = NULL;
6455 : } else {
6456 0 : object->in.last_changed_time = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.last_changed_time);
6457 0 : if (object->in.last_changed_time == NULL) {
6458 0 : PyErr_NoMemory();
6459 0 : return -1;
6460 : }
6461 : {
6462 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.last_changed_time));
6463 0 : if (PyLong_Check(value)) {
6464 : unsigned long long test_var;
6465 0 : test_var = PyLong_AsUnsignedLongLong(value);
6466 0 : if (PyErr_Occurred() != NULL) {
6467 0 : return -1;
6468 : }
6469 0 : if (test_var > uint_max) {
6470 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6471 : PyLong_Type.tp_name, uint_max, test_var);
6472 0 : return -1;
6473 : }
6474 0 : *object->in.last_changed_time = test_var;
6475 : } else {
6476 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6477 : PyLong_Type.tp_name);
6478 0 : return -1;
6479 : }
6480 : }
6481 : }
6482 0 : return 0;
6483 : }
6484 :
6485 0 : static PyObject *py_winreg_EnumKey_out_get_last_changed_time(PyObject *obj, void *closure)
6486 : {
6487 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6488 : PyObject *py_last_changed_time;
6489 0 : if (object->out.last_changed_time == NULL) {
6490 0 : Py_RETURN_NONE;
6491 : }
6492 0 : if (object->out.last_changed_time == NULL) {
6493 0 : py_last_changed_time = Py_None;
6494 0 : Py_INCREF(py_last_changed_time);
6495 : } else {
6496 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*object->out.last_changed_time);
6497 : }
6498 0 : return py_last_changed_time;
6499 : }
6500 :
6501 0 : static int py_winreg_EnumKey_out_set_last_changed_time(PyObject *py_obj, PyObject *value, void *closure)
6502 : {
6503 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6504 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.last_changed_time));
6505 0 : if (value == NULL) {
6506 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.last_changed_time");
6507 0 : return -1;
6508 : }
6509 0 : if (value == Py_None) {
6510 0 : object->out.last_changed_time = NULL;
6511 : } else {
6512 0 : object->out.last_changed_time = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.last_changed_time);
6513 0 : if (object->out.last_changed_time == NULL) {
6514 0 : PyErr_NoMemory();
6515 0 : return -1;
6516 : }
6517 : {
6518 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.last_changed_time));
6519 0 : if (PyLong_Check(value)) {
6520 : unsigned long long test_var;
6521 0 : test_var = PyLong_AsUnsignedLongLong(value);
6522 0 : if (PyErr_Occurred() != NULL) {
6523 0 : return -1;
6524 : }
6525 0 : if (test_var > uint_max) {
6526 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6527 : PyLong_Type.tp_name, uint_max, test_var);
6528 0 : return -1;
6529 : }
6530 0 : *object->out.last_changed_time = test_var;
6531 : } else {
6532 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6533 : PyLong_Type.tp_name);
6534 0 : return -1;
6535 : }
6536 : }
6537 : }
6538 0 : return 0;
6539 : }
6540 :
6541 0 : static PyObject *py_winreg_EnumKey_get_result(PyObject *obj, void *closure)
6542 : {
6543 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(obj);
6544 : PyObject *py_result;
6545 0 : py_result = PyErr_FromWERROR(object->out.result);
6546 0 : return py_result;
6547 : }
6548 :
6549 0 : static int py_winreg_EnumKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
6550 : {
6551 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6552 0 : if (value == NULL) {
6553 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
6554 0 : return -1;
6555 : }
6556 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
6557 0 : return 0;
6558 : }
6559 :
6560 : static PyGetSetDef py_winreg_EnumKey_getsetters[] = {
6561 : {
6562 : .name = discard_const_p(char, "in_handle"),
6563 : .get = py_winreg_EnumKey_in_get_handle,
6564 : .set = py_winreg_EnumKey_in_set_handle,
6565 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
6566 : },
6567 : {
6568 : .name = discard_const_p(char, "in_enum_index"),
6569 : .get = py_winreg_EnumKey_in_get_enum_index,
6570 : .set = py_winreg_EnumKey_in_set_enum_index,
6571 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
6572 : },
6573 : {
6574 : .name = discard_const_p(char, "in_name"),
6575 : .get = py_winreg_EnumKey_in_get_name,
6576 : .set = py_winreg_EnumKey_in_set_name,
6577 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6578 : },
6579 : {
6580 : .name = discard_const_p(char, "out_name"),
6581 : .get = py_winreg_EnumKey_out_get_name,
6582 : .set = py_winreg_EnumKey_out_set_name,
6583 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6584 : },
6585 : {
6586 : .name = discard_const_p(char, "in_keyclass"),
6587 : .get = py_winreg_EnumKey_in_get_keyclass,
6588 : .set = py_winreg_EnumKey_in_set_keyclass,
6589 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6590 : },
6591 : {
6592 : .name = discard_const_p(char, "out_keyclass"),
6593 : .get = py_winreg_EnumKey_out_get_keyclass,
6594 : .set = py_winreg_EnumKey_out_set_keyclass,
6595 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_StringBuf")
6596 : },
6597 : {
6598 : .name = discard_const_p(char, "in_last_changed_time"),
6599 : .get = py_winreg_EnumKey_in_get_last_changed_time,
6600 : .set = py_winreg_EnumKey_in_set_last_changed_time,
6601 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
6602 : },
6603 : {
6604 : .name = discard_const_p(char, "out_last_changed_time"),
6605 : .get = py_winreg_EnumKey_out_get_last_changed_time,
6606 : .set = py_winreg_EnumKey_out_set_last_changed_time,
6607 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
6608 : },
6609 : {
6610 : .name = discard_const_p(char, "result"),
6611 : .get = py_winreg_EnumKey_get_result,
6612 : .set = py_winreg_EnumKey_set_result,
6613 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
6614 : },
6615 : { .name = NULL }
6616 : };
6617 :
6618 0 : static PyObject *py_winreg_EnumKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
6619 : {
6620 0 : PyObject *self = pytalloc_new(struct winreg_EnumKey, type);
6621 0 : struct winreg_EnumKey *_self = (struct winreg_EnumKey *)pytalloc_get_ptr(self);
6622 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
6623 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
6624 0 : _self->in.name = talloc_zero(mem_ctx, struct winreg_StringBuf);
6625 0 : _self->out.name = talloc_zero(mem_ctx, struct winreg_StringBuf);
6626 0 : return self;
6627 : }
6628 :
6629 0 : static PyObject *py_winreg_EnumKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
6630 : {
6631 :
6632 :
6633 0 : return PyLong_FromLong(9);
6634 : }
6635 :
6636 0 : static PyObject *py_winreg_EnumKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
6637 : {
6638 0 : const struct ndr_interface_call *call = NULL;
6639 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6640 0 : PyObject *ret = NULL;
6641 0 : struct ndr_push *push = NULL;
6642 : DATA_BLOB blob;
6643 : enum ndr_err_code err;
6644 :
6645 0 : if (ndr_table_winreg.num_calls < 10) {
6646 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumKey_ndr_pack");
6647 0 : return NULL;
6648 : }
6649 0 : call = &ndr_table_winreg.calls[9];
6650 :
6651 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
6652 0 : if (push == NULL) {
6653 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
6654 0 : return NULL;
6655 : }
6656 :
6657 0 : push->flags |= ndr_push_flags;
6658 :
6659 0 : err = call->ndr_push(push, ndr_inout_flags, object);
6660 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6661 0 : TALLOC_FREE(push);
6662 0 : PyErr_SetNdrError(err);
6663 0 : return NULL;
6664 : }
6665 0 : blob = ndr_push_blob(push);
6666 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
6667 0 : TALLOC_FREE(push);
6668 0 : return ret;
6669 : }
6670 :
6671 0 : static PyObject *py_winreg_EnumKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6672 : {
6673 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
6674 0 : PyObject *bigendian_obj = NULL;
6675 0 : PyObject *ndr64_obj = NULL;
6676 0 : uint32_t ndr_push_flags = 0;
6677 :
6678 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
6679 : discard_const_p(char *, kwnames),
6680 : &bigendian_obj,
6681 : &ndr64_obj)) {
6682 0 : return NULL;
6683 : }
6684 :
6685 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6686 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
6687 : }
6688 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6689 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
6690 : }
6691 :
6692 0 : return py_winreg_EnumKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
6693 : }
6694 :
6695 0 : static PyObject *py_winreg_EnumKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6696 : {
6697 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
6698 0 : PyObject *bigendian_obj = NULL;
6699 0 : PyObject *ndr64_obj = NULL;
6700 0 : uint32_t ndr_push_flags = 0;
6701 :
6702 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
6703 : discard_const_p(char *, kwnames),
6704 : &bigendian_obj,
6705 : &ndr64_obj)) {
6706 0 : return NULL;
6707 : }
6708 :
6709 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6710 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
6711 : }
6712 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6713 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
6714 : }
6715 :
6716 0 : return py_winreg_EnumKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
6717 : }
6718 :
6719 0 : static PyObject *py_winreg_EnumKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
6720 : {
6721 0 : const struct ndr_interface_call *call = NULL;
6722 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6723 0 : struct ndr_pull *pull = NULL;
6724 : enum ndr_err_code err;
6725 :
6726 0 : if (ndr_table_winreg.num_calls < 10) {
6727 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumKey_ndr_unpack");
6728 0 : return NULL;
6729 : }
6730 0 : call = &ndr_table_winreg.calls[9];
6731 :
6732 0 : pull = ndr_pull_init_blob(blob, object);
6733 0 : if (pull == NULL) {
6734 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
6735 0 : return NULL;
6736 : }
6737 :
6738 0 : pull->flags |= ndr_pull_flags;
6739 :
6740 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
6741 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6742 0 : TALLOC_FREE(pull);
6743 0 : PyErr_SetNdrError(err);
6744 0 : return NULL;
6745 : }
6746 0 : if (!allow_remaining) {
6747 : uint32_t highest_ofs;
6748 :
6749 0 : if (pull->offset > pull->relative_highest_offset) {
6750 0 : highest_ofs = pull->offset;
6751 : } else {
6752 0 : highest_ofs = pull->relative_highest_offset;
6753 : }
6754 0 : if (highest_ofs < pull->data_size) {
6755 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
6756 : "not all bytes consumed ofs[%u] size[%u]",
6757 : highest_ofs, pull->data_size);
6758 0 : TALLOC_FREE(pull);
6759 0 : PyErr_SetNdrError(err);
6760 0 : return NULL;
6761 : }
6762 : }
6763 :
6764 0 : TALLOC_FREE(pull);
6765 0 : Py_RETURN_NONE;
6766 : }
6767 :
6768 0 : static PyObject *py_winreg_EnumKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6769 : {
6770 : DATA_BLOB blob;
6771 0 : Py_ssize_t blob_length = 0;
6772 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6773 0 : PyObject *bigendian_obj = NULL;
6774 0 : PyObject *ndr64_obj = NULL;
6775 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6776 0 : PyObject *allow_remaining_obj = NULL;
6777 0 : bool allow_remaining = false;
6778 :
6779 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
6780 : discard_const_p(char *, kwnames),
6781 : &blob.data, &blob_length,
6782 : &bigendian_obj,
6783 : &ndr64_obj,
6784 : &allow_remaining_obj)) {
6785 0 : return NULL;
6786 : }
6787 0 : blob.length = blob_length;
6788 :
6789 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6790 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6791 : }
6792 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6793 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6794 : }
6795 :
6796 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6797 0 : allow_remaining = true;
6798 : }
6799 :
6800 0 : return py_winreg_EnumKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
6801 : }
6802 :
6803 0 : static PyObject *py_winreg_EnumKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6804 : {
6805 : DATA_BLOB blob;
6806 0 : Py_ssize_t blob_length = 0;
6807 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
6808 0 : PyObject *bigendian_obj = NULL;
6809 0 : PyObject *ndr64_obj = NULL;
6810 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
6811 0 : PyObject *allow_remaining_obj = NULL;
6812 0 : bool allow_remaining = false;
6813 :
6814 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
6815 : discard_const_p(char *, kwnames),
6816 : &blob.data, &blob_length,
6817 : &bigendian_obj,
6818 : &ndr64_obj,
6819 : &allow_remaining_obj)) {
6820 0 : return NULL;
6821 : }
6822 0 : blob.length = blob_length;
6823 :
6824 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
6825 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
6826 : }
6827 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
6828 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
6829 : }
6830 :
6831 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6832 0 : allow_remaining = true;
6833 : }
6834 :
6835 0 : return py_winreg_EnumKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
6836 : }
6837 :
6838 0 : static PyObject *py_winreg_EnumKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
6839 : {
6840 0 : const struct ndr_interface_call *call = NULL;
6841 0 : struct winreg_EnumKey *object = (struct winreg_EnumKey *)pytalloc_get_ptr(py_obj);
6842 : PyObject *ret;
6843 : char *retstr;
6844 :
6845 0 : if (ndr_table_winreg.num_calls < 10) {
6846 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumKey_ndr_print");
6847 0 : return NULL;
6848 : }
6849 0 : call = &ndr_table_winreg.calls[9];
6850 :
6851 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
6852 0 : ret = PyUnicode_FromString(retstr);
6853 0 : TALLOC_FREE(retstr);
6854 :
6855 0 : return ret;
6856 : }
6857 :
6858 0 : static PyObject *py_winreg_EnumKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6859 : {
6860 0 : return py_winreg_EnumKey_ndr_print(py_obj, "winreg_EnumKey_in", NDR_IN);
6861 : }
6862 :
6863 0 : static PyObject *py_winreg_EnumKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6864 : {
6865 0 : return py_winreg_EnumKey_ndr_print(py_obj, "winreg_EnumKey_out", NDR_OUT);
6866 : }
6867 :
6868 : static PyMethodDef py_winreg_EnumKey_methods[] = {
6869 : { "opnum", (PyCFunction)py_winreg_EnumKey_ndr_opnum, METH_NOARGS|METH_CLASS,
6870 : "winreg.EnumKey.opnum() -> 9 (0x09) " },
6871 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
6872 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
6873 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
6874 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
6875 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
6876 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
6877 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
6878 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
6879 : { "__ndr_print_in__", (PyCFunction)py_winreg_EnumKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
6880 : { "__ndr_print_out__", (PyCFunction)py_winreg_EnumKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
6881 : { NULL, NULL, 0, NULL }
6882 : };
6883 :
6884 :
6885 : static PyTypeObject winreg_EnumKey_Type = {
6886 : PyVarObject_HEAD_INIT(NULL, 0)
6887 : .tp_name = "winreg.EnumKey",
6888 : .tp_getset = py_winreg_EnumKey_getsetters,
6889 : .tp_methods = py_winreg_EnumKey_methods,
6890 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6891 : .tp_new = py_winreg_EnumKey_new,
6892 : };
6893 :
6894 0 : static bool pack_py_winreg_EnumKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_EnumKey *r)
6895 : {
6896 : PyObject *py_handle;
6897 : PyObject *py_enum_index;
6898 : PyObject *py_name;
6899 : PyObject *py_keyclass;
6900 : PyObject *py_last_changed_time;
6901 0 : const char *kwnames[] = {
6902 : "handle", "enum_index", "name", "keyclass", "last_changed_time", NULL
6903 : };
6904 :
6905 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)) {
6906 0 : return false;
6907 : }
6908 :
6909 0 : if (py_handle == NULL) {
6910 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
6911 0 : return false;
6912 : }
6913 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
6914 0 : if (r->in.handle == NULL) {
6915 0 : PyErr_NoMemory();
6916 0 : return false;
6917 : }
6918 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
6919 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
6920 0 : PyErr_NoMemory();
6921 0 : return false;
6922 : }
6923 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
6924 0 : if (py_enum_index == NULL) {
6925 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.enum_index");
6926 0 : return false;
6927 : }
6928 : {
6929 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.enum_index));
6930 0 : if (PyLong_Check(py_enum_index)) {
6931 : unsigned long long test_var;
6932 0 : test_var = PyLong_AsUnsignedLongLong(py_enum_index);
6933 0 : if (PyErr_Occurred() != NULL) {
6934 0 : return false;
6935 : }
6936 0 : if (test_var > uint_max) {
6937 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
6938 : PyLong_Type.tp_name, uint_max, test_var);
6939 0 : return false;
6940 : }
6941 0 : r->in.enum_index = test_var;
6942 : } else {
6943 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
6944 : PyLong_Type.tp_name);
6945 0 : return false;
6946 : }
6947 : }
6948 0 : if (py_name == NULL) {
6949 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.name");
6950 0 : return false;
6951 : }
6952 0 : r->in.name = talloc_ptrtype(r, r->in.name);
6953 0 : if (r->in.name == NULL) {
6954 0 : PyErr_NoMemory();
6955 0 : return false;
6956 : }
6957 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, py_name, return false;);
6958 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
6959 0 : PyErr_NoMemory();
6960 0 : return false;
6961 : }
6962 0 : r->in.name = (struct winreg_StringBuf *)pytalloc_get_ptr(py_name);
6963 0 : if (py_keyclass == NULL) {
6964 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.keyclass");
6965 0 : return false;
6966 : }
6967 0 : if (py_keyclass == Py_None) {
6968 0 : r->in.keyclass = NULL;
6969 : } else {
6970 0 : r->in.keyclass = NULL;
6971 0 : PY_CHECK_TYPE(&winreg_StringBuf_Type, py_keyclass, return false;);
6972 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyclass)) == NULL) {
6973 0 : PyErr_NoMemory();
6974 0 : return false;
6975 : }
6976 0 : r->in.keyclass = (struct winreg_StringBuf *)pytalloc_get_ptr(py_keyclass);
6977 : }
6978 0 : if (py_last_changed_time == NULL) {
6979 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.last_changed_time");
6980 0 : return false;
6981 : }
6982 0 : if (py_last_changed_time == Py_None) {
6983 0 : r->in.last_changed_time = NULL;
6984 : } else {
6985 0 : r->in.last_changed_time = talloc_ptrtype(r, r->in.last_changed_time);
6986 0 : if (r->in.last_changed_time == NULL) {
6987 0 : PyErr_NoMemory();
6988 0 : return false;
6989 : }
6990 : {
6991 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.last_changed_time));
6992 0 : if (PyLong_Check(py_last_changed_time)) {
6993 : unsigned long long test_var;
6994 0 : test_var = PyLong_AsUnsignedLongLong(py_last_changed_time);
6995 0 : if (PyErr_Occurred() != NULL) {
6996 0 : return false;
6997 : }
6998 0 : if (test_var > uint_max) {
6999 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7000 : PyLong_Type.tp_name, uint_max, test_var);
7001 0 : return false;
7002 : }
7003 0 : *r->in.last_changed_time = test_var;
7004 : } else {
7005 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7006 : PyLong_Type.tp_name);
7007 0 : return false;
7008 : }
7009 : }
7010 : }
7011 0 : return true;
7012 : }
7013 :
7014 0 : static PyObject *unpack_py_winreg_EnumKey_args_out(struct winreg_EnumKey *r)
7015 : {
7016 : PyObject *result;
7017 : PyObject *py_name;
7018 : PyObject *py_keyclass;
7019 : PyObject *py_last_changed_time;
7020 0 : result = PyTuple_New(3);
7021 0 : py_name = pytalloc_reference_ex(&winreg_StringBuf_Type, r->out.name, r->out.name);
7022 0 : PyTuple_SetItem(result, 0, py_name);
7023 0 : if (r->out.keyclass == NULL) {
7024 0 : py_keyclass = Py_None;
7025 0 : Py_INCREF(py_keyclass);
7026 : } else {
7027 0 : py_keyclass = pytalloc_reference_ex(&winreg_StringBuf_Type, r->out.keyclass, r->out.keyclass);
7028 : }
7029 0 : PyTuple_SetItem(result, 1, py_keyclass);
7030 0 : if (r->out.last_changed_time == NULL) {
7031 0 : py_last_changed_time = Py_None;
7032 0 : Py_INCREF(py_last_changed_time);
7033 : } else {
7034 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*r->out.last_changed_time);
7035 : }
7036 0 : PyTuple_SetItem(result, 2, py_last_changed_time);
7037 0 : if (!W_ERROR_IS_OK(r->out.result)) {
7038 0 : PyErr_SetWERROR(r->out.result);
7039 0 : return NULL;
7040 : }
7041 :
7042 0 : return result;
7043 : }
7044 :
7045 :
7046 0 : static PyObject *py_winreg_EnumValue_in_get_handle(PyObject *obj, void *closure)
7047 : {
7048 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7049 : PyObject *py_handle;
7050 0 : if (object->in.handle == NULL) {
7051 0 : Py_RETURN_NONE;
7052 : }
7053 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
7054 0 : return py_handle;
7055 : }
7056 :
7057 0 : static int py_winreg_EnumValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
7058 : {
7059 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7060 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
7061 0 : if (value == NULL) {
7062 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
7063 0 : return -1;
7064 : }
7065 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
7066 0 : if (object->in.handle == NULL) {
7067 0 : PyErr_NoMemory();
7068 0 : return -1;
7069 : }
7070 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
7071 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
7072 0 : PyErr_NoMemory();
7073 0 : return -1;
7074 : }
7075 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
7076 0 : return 0;
7077 : }
7078 :
7079 0 : static PyObject *py_winreg_EnumValue_in_get_enum_index(PyObject *obj, void *closure)
7080 : {
7081 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7082 : PyObject *py_enum_index;
7083 0 : py_enum_index = PyLong_FromUnsignedLongLong((uint32_t)object->in.enum_index);
7084 0 : return py_enum_index;
7085 : }
7086 :
7087 0 : static int py_winreg_EnumValue_in_set_enum_index(PyObject *py_obj, PyObject *value, void *closure)
7088 : {
7089 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7090 0 : if (value == NULL) {
7091 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.enum_index");
7092 0 : return -1;
7093 : }
7094 : {
7095 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.enum_index));
7096 0 : if (PyLong_Check(value)) {
7097 : unsigned long long test_var;
7098 0 : test_var = PyLong_AsUnsignedLongLong(value);
7099 0 : if (PyErr_Occurred() != NULL) {
7100 0 : return -1;
7101 : }
7102 0 : if (test_var > uint_max) {
7103 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7104 : PyLong_Type.tp_name, uint_max, test_var);
7105 0 : return -1;
7106 : }
7107 0 : object->in.enum_index = test_var;
7108 : } else {
7109 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7110 : PyLong_Type.tp_name);
7111 0 : return -1;
7112 : }
7113 : }
7114 0 : return 0;
7115 : }
7116 :
7117 0 : static PyObject *py_winreg_EnumValue_in_get_name(PyObject *obj, void *closure)
7118 : {
7119 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7120 : PyObject *py_name;
7121 0 : if (object->in.name == NULL) {
7122 0 : Py_RETURN_NONE;
7123 : }
7124 0 : py_name = pytalloc_reference_ex(&winreg_ValNameBuf_Type, object->in.name, object->in.name);
7125 0 : return py_name;
7126 : }
7127 :
7128 0 : static int py_winreg_EnumValue_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
7129 : {
7130 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7131 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.name));
7132 0 : if (value == NULL) {
7133 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.name");
7134 0 : return -1;
7135 : }
7136 0 : object->in.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.name);
7137 0 : if (object->in.name == NULL) {
7138 0 : PyErr_NoMemory();
7139 0 : return -1;
7140 : }
7141 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, value, return -1;);
7142 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
7143 0 : PyErr_NoMemory();
7144 0 : return -1;
7145 : }
7146 0 : object->in.name = (struct winreg_ValNameBuf *)pytalloc_get_ptr(value);
7147 0 : return 0;
7148 : }
7149 :
7150 0 : static PyObject *py_winreg_EnumValue_out_get_name(PyObject *obj, void *closure)
7151 : {
7152 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7153 : PyObject *py_name;
7154 0 : if (object->out.name == NULL) {
7155 0 : Py_RETURN_NONE;
7156 : }
7157 0 : py_name = pytalloc_reference_ex(&winreg_ValNameBuf_Type, object->out.name, object->out.name);
7158 0 : return py_name;
7159 : }
7160 :
7161 0 : static int py_winreg_EnumValue_out_set_name(PyObject *py_obj, PyObject *value, void *closure)
7162 : {
7163 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7164 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.name));
7165 0 : if (value == NULL) {
7166 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.name");
7167 0 : return -1;
7168 : }
7169 0 : object->out.name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.name);
7170 0 : if (object->out.name == NULL) {
7171 0 : PyErr_NoMemory();
7172 0 : return -1;
7173 : }
7174 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, value, return -1;);
7175 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
7176 0 : PyErr_NoMemory();
7177 0 : return -1;
7178 : }
7179 0 : object->out.name = (struct winreg_ValNameBuf *)pytalloc_get_ptr(value);
7180 0 : return 0;
7181 : }
7182 :
7183 0 : static PyObject *py_winreg_EnumValue_in_get_type(PyObject *obj, void *closure)
7184 : {
7185 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7186 : PyObject *py_type;
7187 0 : if (object->in.type == NULL) {
7188 0 : Py_RETURN_NONE;
7189 : }
7190 0 : if (object->in.type == NULL) {
7191 0 : py_type = Py_None;
7192 0 : Py_INCREF(py_type);
7193 : } else {
7194 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)*object->in.type);
7195 : }
7196 0 : return py_type;
7197 : }
7198 :
7199 0 : static int py_winreg_EnumValue_in_set_type(PyObject *py_obj, PyObject *value, void *closure)
7200 : {
7201 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7202 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.type));
7203 0 : if (value == NULL) {
7204 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.type");
7205 0 : return -1;
7206 : }
7207 0 : if (value == Py_None) {
7208 0 : object->in.type = NULL;
7209 : } else {
7210 0 : object->in.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.type);
7211 0 : if (object->in.type == NULL) {
7212 0 : PyErr_NoMemory();
7213 0 : return -1;
7214 : }
7215 : {
7216 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.type));
7217 0 : if (PyLong_Check(value)) {
7218 : unsigned long long test_var;
7219 0 : test_var = PyLong_AsUnsignedLongLong(value);
7220 0 : if (PyErr_Occurred() != NULL) {
7221 0 : return -1;
7222 : }
7223 0 : if (test_var > uint_max) {
7224 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7225 : PyLong_Type.tp_name, uint_max, test_var);
7226 0 : return -1;
7227 : }
7228 0 : *object->in.type = test_var;
7229 : } else {
7230 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7231 : PyLong_Type.tp_name);
7232 0 : return -1;
7233 : }
7234 : }
7235 : }
7236 0 : return 0;
7237 : }
7238 :
7239 0 : static PyObject *py_winreg_EnumValue_out_get_type(PyObject *obj, void *closure)
7240 : {
7241 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7242 : PyObject *py_type;
7243 0 : if (object->out.type == NULL) {
7244 0 : Py_RETURN_NONE;
7245 : }
7246 0 : if (object->out.type == NULL) {
7247 0 : py_type = Py_None;
7248 0 : Py_INCREF(py_type);
7249 : } else {
7250 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)*object->out.type);
7251 : }
7252 0 : return py_type;
7253 : }
7254 :
7255 0 : static int py_winreg_EnumValue_out_set_type(PyObject *py_obj, PyObject *value, void *closure)
7256 : {
7257 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7258 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.type));
7259 0 : if (value == NULL) {
7260 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.type");
7261 0 : return -1;
7262 : }
7263 0 : if (value == Py_None) {
7264 0 : object->out.type = NULL;
7265 : } else {
7266 0 : object->out.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.type);
7267 0 : if (object->out.type == NULL) {
7268 0 : PyErr_NoMemory();
7269 0 : return -1;
7270 : }
7271 : {
7272 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.type));
7273 0 : if (PyLong_Check(value)) {
7274 : unsigned long long test_var;
7275 0 : test_var = PyLong_AsUnsignedLongLong(value);
7276 0 : if (PyErr_Occurred() != NULL) {
7277 0 : return -1;
7278 : }
7279 0 : if (test_var > uint_max) {
7280 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7281 : PyLong_Type.tp_name, uint_max, test_var);
7282 0 : return -1;
7283 : }
7284 0 : *object->out.type = test_var;
7285 : } else {
7286 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7287 : PyLong_Type.tp_name);
7288 0 : return -1;
7289 : }
7290 : }
7291 : }
7292 0 : return 0;
7293 : }
7294 :
7295 0 : static PyObject *py_winreg_EnumValue_in_get_value(PyObject *obj, void *closure)
7296 : {
7297 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7298 : PyObject *py_value;
7299 0 : if (object->in.value == NULL) {
7300 0 : Py_RETURN_NONE;
7301 : }
7302 0 : if (object->in.value == NULL) {
7303 0 : py_value = Py_None;
7304 0 : Py_INCREF(py_value);
7305 : } else {
7306 0 : py_value = PyList_New(object->in.length?*object->in.length:0);
7307 0 : if (py_value == NULL) {
7308 0 : return NULL;
7309 : }
7310 : {
7311 : int value_cntr_1;
7312 0 : for (value_cntr_1 = 0; value_cntr_1 < (object->in.length?*object->in.length:0); value_cntr_1++) {
7313 : PyObject *py_value_1;
7314 0 : py_value_1 = PyLong_FromLong((uint16_t)object->in.value[value_cntr_1]);
7315 0 : PyList_SetItem(py_value, value_cntr_1, py_value_1);
7316 : }
7317 : }
7318 : }
7319 0 : return py_value;
7320 : }
7321 :
7322 0 : static int py_winreg_EnumValue_in_set_value(PyObject *py_obj, PyObject *value, void *closure)
7323 : {
7324 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7325 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.value));
7326 0 : if (value == NULL) {
7327 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.value");
7328 0 : return -1;
7329 : }
7330 0 : if (value == Py_None) {
7331 0 : object->in.value = NULL;
7332 : } else {
7333 0 : object->in.value = NULL;
7334 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
7335 : {
7336 : int value_cntr_1;
7337 0 : object->in.value = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.value, PyList_GET_SIZE(value));
7338 0 : if (!object->in.value) { return -1;; }
7339 0 : talloc_set_name_const(object->in.value, "ARRAY: object->in.value");
7340 0 : for (value_cntr_1 = 0; value_cntr_1 < PyList_GET_SIZE(value); value_cntr_1++) {
7341 0 : if (PyList_GET_ITEM(value, value_cntr_1) == NULL) {
7342 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.value[value_cntr_1]");
7343 0 : return -1;
7344 : }
7345 : {
7346 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.value[value_cntr_1]));
7347 0 : if (PyLong_Check(PyList_GET_ITEM(value, value_cntr_1))) {
7348 : unsigned long long test_var;
7349 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, value_cntr_1));
7350 0 : if (PyErr_Occurred() != NULL) {
7351 0 : return -1;
7352 : }
7353 0 : if (test_var > uint_max) {
7354 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7355 : PyLong_Type.tp_name, uint_max, test_var);
7356 0 : return -1;
7357 : }
7358 0 : object->in.value[value_cntr_1] = test_var;
7359 : } else {
7360 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7361 : PyLong_Type.tp_name);
7362 0 : return -1;
7363 : }
7364 : }
7365 : }
7366 : }
7367 : }
7368 0 : return 0;
7369 : }
7370 :
7371 0 : static PyObject *py_winreg_EnumValue_out_get_value(PyObject *obj, void *closure)
7372 : {
7373 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7374 : PyObject *py_value;
7375 0 : if (object->out.value == NULL) {
7376 0 : Py_RETURN_NONE;
7377 : }
7378 0 : if (object->out.value == NULL) {
7379 0 : py_value = Py_None;
7380 0 : Py_INCREF(py_value);
7381 : } else {
7382 0 : py_value = PyList_New(object->out.length?*object->out.length:0);
7383 0 : if (py_value == NULL) {
7384 0 : return NULL;
7385 : }
7386 : {
7387 : int value_cntr_1;
7388 0 : for (value_cntr_1 = 0; value_cntr_1 < (object->out.length?*object->out.length:0); value_cntr_1++) {
7389 : PyObject *py_value_1;
7390 0 : py_value_1 = PyLong_FromLong((uint16_t)object->out.value[value_cntr_1]);
7391 0 : PyList_SetItem(py_value, value_cntr_1, py_value_1);
7392 : }
7393 : }
7394 : }
7395 0 : return py_value;
7396 : }
7397 :
7398 0 : static int py_winreg_EnumValue_out_set_value(PyObject *py_obj, PyObject *value, void *closure)
7399 : {
7400 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7401 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.value));
7402 0 : if (value == NULL) {
7403 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.value");
7404 0 : return -1;
7405 : }
7406 0 : if (value == Py_None) {
7407 0 : object->out.value = NULL;
7408 : } else {
7409 0 : object->out.value = NULL;
7410 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
7411 : {
7412 : int value_cntr_1;
7413 0 : object->out.value = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.value, PyList_GET_SIZE(value));
7414 0 : if (!object->out.value) { return -1;; }
7415 0 : talloc_set_name_const(object->out.value, "ARRAY: object->out.value");
7416 0 : for (value_cntr_1 = 0; value_cntr_1 < PyList_GET_SIZE(value); value_cntr_1++) {
7417 0 : if (PyList_GET_ITEM(value, value_cntr_1) == NULL) {
7418 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.value[value_cntr_1]");
7419 0 : return -1;
7420 : }
7421 : {
7422 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.value[value_cntr_1]));
7423 0 : if (PyLong_Check(PyList_GET_ITEM(value, value_cntr_1))) {
7424 : unsigned long long test_var;
7425 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, value_cntr_1));
7426 0 : if (PyErr_Occurred() != NULL) {
7427 0 : return -1;
7428 : }
7429 0 : if (test_var > uint_max) {
7430 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7431 : PyLong_Type.tp_name, uint_max, test_var);
7432 0 : return -1;
7433 : }
7434 0 : object->out.value[value_cntr_1] = test_var;
7435 : } else {
7436 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7437 : PyLong_Type.tp_name);
7438 0 : return -1;
7439 : }
7440 : }
7441 : }
7442 : }
7443 : }
7444 0 : return 0;
7445 : }
7446 :
7447 0 : static PyObject *py_winreg_EnumValue_in_get_size(PyObject *obj, void *closure)
7448 : {
7449 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7450 : PyObject *py_size;
7451 0 : if (object->in.size == NULL) {
7452 0 : Py_RETURN_NONE;
7453 : }
7454 0 : if (object->in.size == NULL) {
7455 0 : py_size = Py_None;
7456 0 : Py_INCREF(py_size);
7457 : } else {
7458 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)*object->in.size);
7459 : }
7460 0 : return py_size;
7461 : }
7462 :
7463 0 : static int py_winreg_EnumValue_in_set_size(PyObject *py_obj, PyObject *value, void *closure)
7464 : {
7465 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7466 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.size));
7467 0 : if (value == NULL) {
7468 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.size");
7469 0 : return -1;
7470 : }
7471 0 : if (value == Py_None) {
7472 0 : object->in.size = NULL;
7473 : } else {
7474 0 : object->in.size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.size);
7475 0 : if (object->in.size == NULL) {
7476 0 : PyErr_NoMemory();
7477 0 : return -1;
7478 : }
7479 : {
7480 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.size));
7481 0 : if (PyLong_Check(value)) {
7482 : unsigned long long test_var;
7483 0 : test_var = PyLong_AsUnsignedLongLong(value);
7484 0 : if (PyErr_Occurred() != NULL) {
7485 0 : return -1;
7486 : }
7487 0 : if (test_var > uint_max) {
7488 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7489 : PyLong_Type.tp_name, uint_max, test_var);
7490 0 : return -1;
7491 : }
7492 0 : *object->in.size = test_var;
7493 : } else {
7494 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7495 : PyLong_Type.tp_name);
7496 0 : return -1;
7497 : }
7498 : }
7499 : }
7500 0 : return 0;
7501 : }
7502 :
7503 0 : static PyObject *py_winreg_EnumValue_out_get_size(PyObject *obj, void *closure)
7504 : {
7505 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7506 : PyObject *py_size;
7507 0 : if (object->out.size == NULL) {
7508 0 : Py_RETURN_NONE;
7509 : }
7510 0 : if (object->out.size == NULL) {
7511 0 : py_size = Py_None;
7512 0 : Py_INCREF(py_size);
7513 : } else {
7514 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)*object->out.size);
7515 : }
7516 0 : return py_size;
7517 : }
7518 :
7519 0 : static int py_winreg_EnumValue_out_set_size(PyObject *py_obj, PyObject *value, void *closure)
7520 : {
7521 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7522 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.size));
7523 0 : if (value == NULL) {
7524 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.size");
7525 0 : return -1;
7526 : }
7527 0 : if (value == Py_None) {
7528 0 : object->out.size = NULL;
7529 : } else {
7530 0 : object->out.size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.size);
7531 0 : if (object->out.size == NULL) {
7532 0 : PyErr_NoMemory();
7533 0 : return -1;
7534 : }
7535 : {
7536 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.size));
7537 0 : if (PyLong_Check(value)) {
7538 : unsigned long long test_var;
7539 0 : test_var = PyLong_AsUnsignedLongLong(value);
7540 0 : if (PyErr_Occurred() != NULL) {
7541 0 : return -1;
7542 : }
7543 0 : if (test_var > uint_max) {
7544 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7545 : PyLong_Type.tp_name, uint_max, test_var);
7546 0 : return -1;
7547 : }
7548 0 : *object->out.size = test_var;
7549 : } else {
7550 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7551 : PyLong_Type.tp_name);
7552 0 : return -1;
7553 : }
7554 : }
7555 : }
7556 0 : return 0;
7557 : }
7558 :
7559 0 : static PyObject *py_winreg_EnumValue_in_get_length(PyObject *obj, void *closure)
7560 : {
7561 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7562 : PyObject *py_length;
7563 0 : if (object->in.length == NULL) {
7564 0 : Py_RETURN_NONE;
7565 : }
7566 0 : if (object->in.length == NULL) {
7567 0 : py_length = Py_None;
7568 0 : Py_INCREF(py_length);
7569 : } else {
7570 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)*object->in.length);
7571 : }
7572 0 : return py_length;
7573 : }
7574 :
7575 0 : static int py_winreg_EnumValue_in_set_length(PyObject *py_obj, PyObject *value, void *closure)
7576 : {
7577 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7578 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.length));
7579 0 : if (value == NULL) {
7580 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.length");
7581 0 : return -1;
7582 : }
7583 0 : if (value == Py_None) {
7584 0 : object->in.length = NULL;
7585 : } else {
7586 0 : object->in.length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.length);
7587 0 : if (object->in.length == NULL) {
7588 0 : PyErr_NoMemory();
7589 0 : return -1;
7590 : }
7591 : {
7592 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.length));
7593 0 : if (PyLong_Check(value)) {
7594 : unsigned long long test_var;
7595 0 : test_var = PyLong_AsUnsignedLongLong(value);
7596 0 : if (PyErr_Occurred() != NULL) {
7597 0 : return -1;
7598 : }
7599 0 : if (test_var > uint_max) {
7600 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7601 : PyLong_Type.tp_name, uint_max, test_var);
7602 0 : return -1;
7603 : }
7604 0 : *object->in.length = test_var;
7605 : } else {
7606 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7607 : PyLong_Type.tp_name);
7608 0 : return -1;
7609 : }
7610 : }
7611 : }
7612 0 : return 0;
7613 : }
7614 :
7615 0 : static PyObject *py_winreg_EnumValue_out_get_length(PyObject *obj, void *closure)
7616 : {
7617 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7618 : PyObject *py_length;
7619 0 : if (object->out.length == NULL) {
7620 0 : Py_RETURN_NONE;
7621 : }
7622 0 : if (object->out.length == NULL) {
7623 0 : py_length = Py_None;
7624 0 : Py_INCREF(py_length);
7625 : } else {
7626 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)*object->out.length);
7627 : }
7628 0 : return py_length;
7629 : }
7630 :
7631 0 : static int py_winreg_EnumValue_out_set_length(PyObject *py_obj, PyObject *value, void *closure)
7632 : {
7633 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7634 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.length));
7635 0 : if (value == NULL) {
7636 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.length");
7637 0 : return -1;
7638 : }
7639 0 : if (value == Py_None) {
7640 0 : object->out.length = NULL;
7641 : } else {
7642 0 : object->out.length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.length);
7643 0 : if (object->out.length == NULL) {
7644 0 : PyErr_NoMemory();
7645 0 : return -1;
7646 : }
7647 : {
7648 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.length));
7649 0 : if (PyLong_Check(value)) {
7650 : unsigned long long test_var;
7651 0 : test_var = PyLong_AsUnsignedLongLong(value);
7652 0 : if (PyErr_Occurred() != NULL) {
7653 0 : return -1;
7654 : }
7655 0 : if (test_var > uint_max) {
7656 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
7657 : PyLong_Type.tp_name, uint_max, test_var);
7658 0 : return -1;
7659 : }
7660 0 : *object->out.length = test_var;
7661 : } else {
7662 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
7663 : PyLong_Type.tp_name);
7664 0 : return -1;
7665 : }
7666 : }
7667 : }
7668 0 : return 0;
7669 : }
7670 :
7671 0 : static PyObject *py_winreg_EnumValue_get_result(PyObject *obj, void *closure)
7672 : {
7673 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(obj);
7674 : PyObject *py_result;
7675 0 : py_result = PyErr_FromWERROR(object->out.result);
7676 0 : return py_result;
7677 : }
7678 :
7679 0 : static int py_winreg_EnumValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
7680 : {
7681 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7682 0 : if (value == NULL) {
7683 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
7684 0 : return -1;
7685 : }
7686 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
7687 0 : return 0;
7688 : }
7689 :
7690 : static PyGetSetDef py_winreg_EnumValue_getsetters[] = {
7691 : {
7692 : .name = discard_const_p(char, "in_handle"),
7693 : .get = py_winreg_EnumValue_in_get_handle,
7694 : .set = py_winreg_EnumValue_in_set_handle,
7695 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
7696 : },
7697 : {
7698 : .name = discard_const_p(char, "in_enum_index"),
7699 : .get = py_winreg_EnumValue_in_get_enum_index,
7700 : .set = py_winreg_EnumValue_in_set_enum_index,
7701 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7702 : },
7703 : {
7704 : .name = discard_const_p(char, "in_name"),
7705 : .get = py_winreg_EnumValue_in_get_name,
7706 : .set = py_winreg_EnumValue_in_set_name,
7707 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_ValNameBuf")
7708 : },
7709 : {
7710 : .name = discard_const_p(char, "out_name"),
7711 : .get = py_winreg_EnumValue_out_get_name,
7712 : .set = py_winreg_EnumValue_out_set_name,
7713 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_ValNameBuf")
7714 : },
7715 : {
7716 : .name = discard_const_p(char, "in_type"),
7717 : .get = py_winreg_EnumValue_in_get_type,
7718 : .set = py_winreg_EnumValue_in_set_type,
7719 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
7720 : },
7721 : {
7722 : .name = discard_const_p(char, "out_type"),
7723 : .get = py_winreg_EnumValue_out_get_type,
7724 : .set = py_winreg_EnumValue_out_set_type,
7725 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
7726 : },
7727 : {
7728 : .name = discard_const_p(char, "in_value"),
7729 : .get = py_winreg_EnumValue_in_get_value,
7730 : .set = py_winreg_EnumValue_in_set_value,
7731 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
7732 : },
7733 : {
7734 : .name = discard_const_p(char, "out_value"),
7735 : .get = py_winreg_EnumValue_out_get_value,
7736 : .set = py_winreg_EnumValue_out_set_value,
7737 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
7738 : },
7739 : {
7740 : .name = discard_const_p(char, "in_size"),
7741 : .get = py_winreg_EnumValue_in_get_size,
7742 : .set = py_winreg_EnumValue_in_set_size,
7743 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7744 : },
7745 : {
7746 : .name = discard_const_p(char, "out_size"),
7747 : .get = py_winreg_EnumValue_out_get_size,
7748 : .set = py_winreg_EnumValue_out_set_size,
7749 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7750 : },
7751 : {
7752 : .name = discard_const_p(char, "in_length"),
7753 : .get = py_winreg_EnumValue_in_get_length,
7754 : .set = py_winreg_EnumValue_in_set_length,
7755 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7756 : },
7757 : {
7758 : .name = discard_const_p(char, "out_length"),
7759 : .get = py_winreg_EnumValue_out_get_length,
7760 : .set = py_winreg_EnumValue_out_set_length,
7761 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
7762 : },
7763 : {
7764 : .name = discard_const_p(char, "result"),
7765 : .get = py_winreg_EnumValue_get_result,
7766 : .set = py_winreg_EnumValue_set_result,
7767 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
7768 : },
7769 : { .name = NULL }
7770 : };
7771 :
7772 0 : static PyObject *py_winreg_EnumValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
7773 : {
7774 0 : PyObject *self = pytalloc_new(struct winreg_EnumValue, type);
7775 0 : struct winreg_EnumValue *_self = (struct winreg_EnumValue *)pytalloc_get_ptr(self);
7776 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
7777 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
7778 0 : _self->in.name = talloc_zero(mem_ctx, struct winreg_ValNameBuf);
7779 0 : _self->out.name = talloc_zero(mem_ctx, struct winreg_ValNameBuf);
7780 0 : return self;
7781 : }
7782 :
7783 0 : static PyObject *py_winreg_EnumValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
7784 : {
7785 :
7786 :
7787 0 : return PyLong_FromLong(10);
7788 : }
7789 :
7790 0 : static PyObject *py_winreg_EnumValue_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
7791 : {
7792 0 : const struct ndr_interface_call *call = NULL;
7793 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7794 0 : PyObject *ret = NULL;
7795 0 : struct ndr_push *push = NULL;
7796 : DATA_BLOB blob;
7797 : enum ndr_err_code err;
7798 :
7799 0 : if (ndr_table_winreg.num_calls < 11) {
7800 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumValue_ndr_pack");
7801 0 : return NULL;
7802 : }
7803 0 : call = &ndr_table_winreg.calls[10];
7804 :
7805 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
7806 0 : if (push == NULL) {
7807 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
7808 0 : return NULL;
7809 : }
7810 :
7811 0 : push->flags |= ndr_push_flags;
7812 :
7813 0 : err = call->ndr_push(push, ndr_inout_flags, object);
7814 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
7815 0 : TALLOC_FREE(push);
7816 0 : PyErr_SetNdrError(err);
7817 0 : return NULL;
7818 : }
7819 0 : blob = ndr_push_blob(push);
7820 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
7821 0 : TALLOC_FREE(push);
7822 0 : return ret;
7823 : }
7824 :
7825 0 : static PyObject *py_winreg_EnumValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7826 : {
7827 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
7828 0 : PyObject *bigendian_obj = NULL;
7829 0 : PyObject *ndr64_obj = NULL;
7830 0 : uint32_t ndr_push_flags = 0;
7831 :
7832 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
7833 : discard_const_p(char *, kwnames),
7834 : &bigendian_obj,
7835 : &ndr64_obj)) {
7836 0 : return NULL;
7837 : }
7838 :
7839 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7840 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
7841 : }
7842 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7843 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
7844 : }
7845 :
7846 0 : return py_winreg_EnumValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
7847 : }
7848 :
7849 0 : static PyObject *py_winreg_EnumValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7850 : {
7851 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
7852 0 : PyObject *bigendian_obj = NULL;
7853 0 : PyObject *ndr64_obj = NULL;
7854 0 : uint32_t ndr_push_flags = 0;
7855 :
7856 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
7857 : discard_const_p(char *, kwnames),
7858 : &bigendian_obj,
7859 : &ndr64_obj)) {
7860 0 : return NULL;
7861 : }
7862 :
7863 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7864 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
7865 : }
7866 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7867 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
7868 : }
7869 :
7870 0 : return py_winreg_EnumValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
7871 : }
7872 :
7873 0 : static PyObject *py_winreg_EnumValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
7874 : {
7875 0 : const struct ndr_interface_call *call = NULL;
7876 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7877 0 : struct ndr_pull *pull = NULL;
7878 : enum ndr_err_code err;
7879 :
7880 0 : if (ndr_table_winreg.num_calls < 11) {
7881 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumValue_ndr_unpack");
7882 0 : return NULL;
7883 : }
7884 0 : call = &ndr_table_winreg.calls[10];
7885 :
7886 0 : pull = ndr_pull_init_blob(blob, object);
7887 0 : if (pull == NULL) {
7888 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
7889 0 : return NULL;
7890 : }
7891 :
7892 0 : pull->flags |= ndr_pull_flags;
7893 :
7894 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
7895 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
7896 0 : TALLOC_FREE(pull);
7897 0 : PyErr_SetNdrError(err);
7898 0 : return NULL;
7899 : }
7900 0 : if (!allow_remaining) {
7901 : uint32_t highest_ofs;
7902 :
7903 0 : if (pull->offset > pull->relative_highest_offset) {
7904 0 : highest_ofs = pull->offset;
7905 : } else {
7906 0 : highest_ofs = pull->relative_highest_offset;
7907 : }
7908 0 : if (highest_ofs < pull->data_size) {
7909 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
7910 : "not all bytes consumed ofs[%u] size[%u]",
7911 : highest_ofs, pull->data_size);
7912 0 : TALLOC_FREE(pull);
7913 0 : PyErr_SetNdrError(err);
7914 0 : return NULL;
7915 : }
7916 : }
7917 :
7918 0 : TALLOC_FREE(pull);
7919 0 : Py_RETURN_NONE;
7920 : }
7921 :
7922 0 : static PyObject *py_winreg_EnumValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7923 : {
7924 : DATA_BLOB blob;
7925 0 : Py_ssize_t blob_length = 0;
7926 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
7927 0 : PyObject *bigendian_obj = NULL;
7928 0 : PyObject *ndr64_obj = NULL;
7929 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
7930 0 : PyObject *allow_remaining_obj = NULL;
7931 0 : bool allow_remaining = false;
7932 :
7933 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
7934 : discard_const_p(char *, kwnames),
7935 : &blob.data, &blob_length,
7936 : &bigendian_obj,
7937 : &ndr64_obj,
7938 : &allow_remaining_obj)) {
7939 0 : return NULL;
7940 : }
7941 0 : blob.length = blob_length;
7942 :
7943 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7944 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
7945 : }
7946 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7947 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
7948 : }
7949 :
7950 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
7951 0 : allow_remaining = true;
7952 : }
7953 :
7954 0 : return py_winreg_EnumValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
7955 : }
7956 :
7957 0 : static PyObject *py_winreg_EnumValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
7958 : {
7959 : DATA_BLOB blob;
7960 0 : Py_ssize_t blob_length = 0;
7961 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
7962 0 : PyObject *bigendian_obj = NULL;
7963 0 : PyObject *ndr64_obj = NULL;
7964 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
7965 0 : PyObject *allow_remaining_obj = NULL;
7966 0 : bool allow_remaining = false;
7967 :
7968 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
7969 : discard_const_p(char *, kwnames),
7970 : &blob.data, &blob_length,
7971 : &bigendian_obj,
7972 : &ndr64_obj,
7973 : &allow_remaining_obj)) {
7974 0 : return NULL;
7975 : }
7976 0 : blob.length = blob_length;
7977 :
7978 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
7979 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
7980 : }
7981 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
7982 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
7983 : }
7984 :
7985 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
7986 0 : allow_remaining = true;
7987 : }
7988 :
7989 0 : return py_winreg_EnumValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
7990 : }
7991 :
7992 0 : static PyObject *py_winreg_EnumValue_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
7993 : {
7994 0 : const struct ndr_interface_call *call = NULL;
7995 0 : struct winreg_EnumValue *object = (struct winreg_EnumValue *)pytalloc_get_ptr(py_obj);
7996 : PyObject *ret;
7997 : char *retstr;
7998 :
7999 0 : if (ndr_table_winreg.num_calls < 11) {
8000 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_EnumValue_ndr_print");
8001 0 : return NULL;
8002 : }
8003 0 : call = &ndr_table_winreg.calls[10];
8004 :
8005 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
8006 0 : ret = PyUnicode_FromString(retstr);
8007 0 : TALLOC_FREE(retstr);
8008 :
8009 0 : return ret;
8010 : }
8011 :
8012 0 : static PyObject *py_winreg_EnumValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8013 : {
8014 0 : return py_winreg_EnumValue_ndr_print(py_obj, "winreg_EnumValue_in", NDR_IN);
8015 : }
8016 :
8017 0 : static PyObject *py_winreg_EnumValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8018 : {
8019 0 : return py_winreg_EnumValue_ndr_print(py_obj, "winreg_EnumValue_out", NDR_OUT);
8020 : }
8021 :
8022 : static PyMethodDef py_winreg_EnumValue_methods[] = {
8023 : { "opnum", (PyCFunction)py_winreg_EnumValue_ndr_opnum, METH_NOARGS|METH_CLASS,
8024 : "winreg.EnumValue.opnum() -> 10 (0x0a) " },
8025 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
8026 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
8027 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
8028 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
8029 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
8030 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
8031 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_EnumValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
8032 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
8033 : { "__ndr_print_in__", (PyCFunction)py_winreg_EnumValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
8034 : { "__ndr_print_out__", (PyCFunction)py_winreg_EnumValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
8035 : { NULL, NULL, 0, NULL }
8036 : };
8037 :
8038 :
8039 : static PyTypeObject winreg_EnumValue_Type = {
8040 : PyVarObject_HEAD_INIT(NULL, 0)
8041 : .tp_name = "winreg.EnumValue",
8042 : .tp_getset = py_winreg_EnumValue_getsetters,
8043 : .tp_methods = py_winreg_EnumValue_methods,
8044 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
8045 : .tp_new = py_winreg_EnumValue_new,
8046 : };
8047 :
8048 0 : static bool pack_py_winreg_EnumValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_EnumValue *r)
8049 : {
8050 : PyObject *py_handle;
8051 : PyObject *py_enum_index;
8052 : PyObject *py_name;
8053 : PyObject *py_type;
8054 : PyObject *py_value;
8055 : PyObject *py_size;
8056 : PyObject *py_length;
8057 0 : const char *kwnames[] = {
8058 : "handle", "enum_index", "name", "type", "value", "size", "length", NULL
8059 : };
8060 :
8061 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)) {
8062 0 : return false;
8063 : }
8064 :
8065 0 : if (py_handle == NULL) {
8066 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
8067 0 : return false;
8068 : }
8069 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
8070 0 : if (r->in.handle == NULL) {
8071 0 : PyErr_NoMemory();
8072 0 : return false;
8073 : }
8074 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
8075 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
8076 0 : PyErr_NoMemory();
8077 0 : return false;
8078 : }
8079 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
8080 0 : if (py_enum_index == NULL) {
8081 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.enum_index");
8082 0 : return false;
8083 : }
8084 : {
8085 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.enum_index));
8086 0 : if (PyLong_Check(py_enum_index)) {
8087 : unsigned long long test_var;
8088 0 : test_var = PyLong_AsUnsignedLongLong(py_enum_index);
8089 0 : if (PyErr_Occurred() != NULL) {
8090 0 : return false;
8091 : }
8092 0 : if (test_var > uint_max) {
8093 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8094 : PyLong_Type.tp_name, uint_max, test_var);
8095 0 : return false;
8096 : }
8097 0 : r->in.enum_index = test_var;
8098 : } else {
8099 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8100 : PyLong_Type.tp_name);
8101 0 : return false;
8102 : }
8103 : }
8104 0 : if (py_name == NULL) {
8105 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.name");
8106 0 : return false;
8107 : }
8108 0 : r->in.name = talloc_ptrtype(r, r->in.name);
8109 0 : if (r->in.name == NULL) {
8110 0 : PyErr_NoMemory();
8111 0 : return false;
8112 : }
8113 0 : PY_CHECK_TYPE(&winreg_ValNameBuf_Type, py_name, return false;);
8114 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
8115 0 : PyErr_NoMemory();
8116 0 : return false;
8117 : }
8118 0 : r->in.name = (struct winreg_ValNameBuf *)pytalloc_get_ptr(py_name);
8119 0 : if (py_type == NULL) {
8120 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.type");
8121 0 : return false;
8122 : }
8123 0 : if (py_type == Py_None) {
8124 0 : r->in.type = NULL;
8125 : } else {
8126 0 : r->in.type = talloc_ptrtype(r, r->in.type);
8127 0 : if (r->in.type == NULL) {
8128 0 : PyErr_NoMemory();
8129 0 : return false;
8130 : }
8131 : {
8132 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.type));
8133 0 : if (PyLong_Check(py_type)) {
8134 : unsigned long long test_var;
8135 0 : test_var = PyLong_AsUnsignedLongLong(py_type);
8136 0 : if (PyErr_Occurred() != NULL) {
8137 0 : return false;
8138 : }
8139 0 : if (test_var > uint_max) {
8140 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8141 : PyLong_Type.tp_name, uint_max, test_var);
8142 0 : return false;
8143 : }
8144 0 : *r->in.type = test_var;
8145 : } else {
8146 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8147 : PyLong_Type.tp_name);
8148 0 : return false;
8149 : }
8150 : }
8151 : }
8152 0 : if (py_value == NULL) {
8153 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.value");
8154 0 : return false;
8155 : }
8156 0 : if (py_value == Py_None) {
8157 0 : r->in.value = NULL;
8158 : } else {
8159 0 : r->in.value = NULL;
8160 0 : PY_CHECK_TYPE(&PyList_Type, py_value, return false;);
8161 : {
8162 : int value_cntr_1;
8163 0 : r->in.value = talloc_array_ptrtype(r, r->in.value, PyList_GET_SIZE(py_value));
8164 0 : if (!r->in.value) { return false;; }
8165 0 : talloc_set_name_const(r->in.value, "ARRAY: r->in.value");
8166 0 : for (value_cntr_1 = 0; value_cntr_1 < PyList_GET_SIZE(py_value); value_cntr_1++) {
8167 0 : if (PyList_GET_ITEM(py_value, value_cntr_1) == NULL) {
8168 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.value[value_cntr_1]");
8169 0 : return false;
8170 : }
8171 : {
8172 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.value[value_cntr_1]));
8173 0 : if (PyLong_Check(PyList_GET_ITEM(py_value, value_cntr_1))) {
8174 : unsigned long long test_var;
8175 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_value, value_cntr_1));
8176 0 : if (PyErr_Occurred() != NULL) {
8177 0 : return false;
8178 : }
8179 0 : if (test_var > uint_max) {
8180 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8181 : PyLong_Type.tp_name, uint_max, test_var);
8182 0 : return false;
8183 : }
8184 0 : r->in.value[value_cntr_1] = test_var;
8185 : } else {
8186 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8187 : PyLong_Type.tp_name);
8188 0 : return false;
8189 : }
8190 : }
8191 : }
8192 : }
8193 : }
8194 0 : if (py_size == NULL) {
8195 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.size");
8196 0 : return false;
8197 : }
8198 0 : if (py_size == Py_None) {
8199 0 : r->in.size = NULL;
8200 : } else {
8201 0 : r->in.size = talloc_ptrtype(r, r->in.size);
8202 0 : if (r->in.size == NULL) {
8203 0 : PyErr_NoMemory();
8204 0 : return false;
8205 : }
8206 : {
8207 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.size));
8208 0 : if (PyLong_Check(py_size)) {
8209 : unsigned long long test_var;
8210 0 : test_var = PyLong_AsUnsignedLongLong(py_size);
8211 0 : if (PyErr_Occurred() != NULL) {
8212 0 : return false;
8213 : }
8214 0 : if (test_var > uint_max) {
8215 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8216 : PyLong_Type.tp_name, uint_max, test_var);
8217 0 : return false;
8218 : }
8219 0 : *r->in.size = test_var;
8220 : } else {
8221 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8222 : PyLong_Type.tp_name);
8223 0 : return false;
8224 : }
8225 : }
8226 : }
8227 0 : if (py_length == NULL) {
8228 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.length");
8229 0 : return false;
8230 : }
8231 0 : if (py_length == Py_None) {
8232 0 : r->in.length = NULL;
8233 : } else {
8234 0 : r->in.length = talloc_ptrtype(r, r->in.length);
8235 0 : if (r->in.length == NULL) {
8236 0 : PyErr_NoMemory();
8237 0 : return false;
8238 : }
8239 : {
8240 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.length));
8241 0 : if (PyLong_Check(py_length)) {
8242 : unsigned long long test_var;
8243 0 : test_var = PyLong_AsUnsignedLongLong(py_length);
8244 0 : if (PyErr_Occurred() != NULL) {
8245 0 : return false;
8246 : }
8247 0 : if (test_var > uint_max) {
8248 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8249 : PyLong_Type.tp_name, uint_max, test_var);
8250 0 : return false;
8251 : }
8252 0 : *r->in.length = test_var;
8253 : } else {
8254 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8255 : PyLong_Type.tp_name);
8256 0 : return false;
8257 : }
8258 : }
8259 : }
8260 0 : return true;
8261 : }
8262 :
8263 0 : static PyObject *unpack_py_winreg_EnumValue_args_out(struct winreg_EnumValue *r)
8264 : {
8265 : PyObject *result;
8266 : PyObject *py_name;
8267 : PyObject *py_type;
8268 : PyObject *py_value;
8269 : PyObject *py_size;
8270 : PyObject *py_length;
8271 0 : result = PyTuple_New(5);
8272 0 : py_name = pytalloc_reference_ex(&winreg_ValNameBuf_Type, r->out.name, r->out.name);
8273 0 : PyTuple_SetItem(result, 0, py_name);
8274 0 : if (r->out.type == NULL) {
8275 0 : py_type = Py_None;
8276 0 : Py_INCREF(py_type);
8277 : } else {
8278 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)*r->out.type);
8279 : }
8280 0 : PyTuple_SetItem(result, 1, py_type);
8281 0 : if (r->out.value == NULL) {
8282 0 : py_value = Py_None;
8283 0 : Py_INCREF(py_value);
8284 : } else {
8285 0 : py_value = PyList_New(r->out.length?*r->out.length:0);
8286 0 : if (py_value == NULL) {
8287 0 : return NULL;
8288 : }
8289 : {
8290 : int value_cntr_1;
8291 0 : for (value_cntr_1 = 0; value_cntr_1 < (r->out.length?*r->out.length:0); value_cntr_1++) {
8292 : PyObject *py_value_1;
8293 0 : py_value_1 = PyLong_FromLong((uint16_t)r->out.value[value_cntr_1]);
8294 0 : PyList_SetItem(py_value, value_cntr_1, py_value_1);
8295 : }
8296 : }
8297 : }
8298 0 : PyTuple_SetItem(result, 2, py_value);
8299 0 : if (r->out.size == NULL) {
8300 0 : py_size = Py_None;
8301 0 : Py_INCREF(py_size);
8302 : } else {
8303 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)*r->out.size);
8304 : }
8305 0 : PyTuple_SetItem(result, 3, py_size);
8306 0 : if (r->out.length == NULL) {
8307 0 : py_length = Py_None;
8308 0 : Py_INCREF(py_length);
8309 : } else {
8310 0 : py_length = PyLong_FromUnsignedLongLong((uint32_t)*r->out.length);
8311 : }
8312 0 : PyTuple_SetItem(result, 4, py_length);
8313 0 : if (!W_ERROR_IS_OK(r->out.result)) {
8314 0 : PyErr_SetWERROR(r->out.result);
8315 0 : return NULL;
8316 : }
8317 :
8318 0 : return result;
8319 : }
8320 :
8321 :
8322 0 : static PyObject *py_winreg_FlushKey_in_get_handle(PyObject *obj, void *closure)
8323 : {
8324 0 : struct winreg_FlushKey *object = (struct winreg_FlushKey *)pytalloc_get_ptr(obj);
8325 : PyObject *py_handle;
8326 0 : if (object->in.handle == NULL) {
8327 0 : Py_RETURN_NONE;
8328 : }
8329 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
8330 0 : return py_handle;
8331 : }
8332 :
8333 0 : static int py_winreg_FlushKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
8334 : {
8335 0 : struct winreg_FlushKey *object = (struct winreg_FlushKey *)pytalloc_get_ptr(py_obj);
8336 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
8337 0 : if (value == NULL) {
8338 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
8339 0 : return -1;
8340 : }
8341 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
8342 0 : if (object->in.handle == NULL) {
8343 0 : PyErr_NoMemory();
8344 0 : return -1;
8345 : }
8346 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
8347 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8348 0 : PyErr_NoMemory();
8349 0 : return -1;
8350 : }
8351 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
8352 0 : return 0;
8353 : }
8354 :
8355 0 : static PyObject *py_winreg_FlushKey_get_result(PyObject *obj, void *closure)
8356 : {
8357 0 : struct winreg_FlushKey *object = (struct winreg_FlushKey *)pytalloc_get_ptr(obj);
8358 : PyObject *py_result;
8359 0 : py_result = PyErr_FromWERROR(object->out.result);
8360 0 : return py_result;
8361 : }
8362 :
8363 0 : static int py_winreg_FlushKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
8364 : {
8365 0 : struct winreg_FlushKey *object = (struct winreg_FlushKey *)pytalloc_get_ptr(py_obj);
8366 0 : if (value == NULL) {
8367 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
8368 0 : return -1;
8369 : }
8370 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
8371 0 : return 0;
8372 : }
8373 :
8374 : static PyGetSetDef py_winreg_FlushKey_getsetters[] = {
8375 : {
8376 : .name = discard_const_p(char, "in_handle"),
8377 : .get = py_winreg_FlushKey_in_get_handle,
8378 : .set = py_winreg_FlushKey_in_set_handle,
8379 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
8380 : },
8381 : {
8382 : .name = discard_const_p(char, "result"),
8383 : .get = py_winreg_FlushKey_get_result,
8384 : .set = py_winreg_FlushKey_set_result,
8385 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
8386 : },
8387 : { .name = NULL }
8388 : };
8389 :
8390 0 : static PyObject *py_winreg_FlushKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
8391 : {
8392 0 : PyObject *self = pytalloc_new(struct winreg_FlushKey, type);
8393 0 : struct winreg_FlushKey *_self = (struct winreg_FlushKey *)pytalloc_get_ptr(self);
8394 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
8395 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
8396 0 : return self;
8397 : }
8398 :
8399 0 : static PyObject *py_winreg_FlushKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
8400 : {
8401 :
8402 :
8403 0 : return PyLong_FromLong(11);
8404 : }
8405 :
8406 0 : static PyObject *py_winreg_FlushKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
8407 : {
8408 0 : const struct ndr_interface_call *call = NULL;
8409 0 : struct winreg_FlushKey *object = (struct winreg_FlushKey *)pytalloc_get_ptr(py_obj);
8410 0 : PyObject *ret = NULL;
8411 0 : struct ndr_push *push = NULL;
8412 : DATA_BLOB blob;
8413 : enum ndr_err_code err;
8414 :
8415 0 : if (ndr_table_winreg.num_calls < 12) {
8416 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_FlushKey_ndr_pack");
8417 0 : return NULL;
8418 : }
8419 0 : call = &ndr_table_winreg.calls[11];
8420 :
8421 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
8422 0 : if (push == NULL) {
8423 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
8424 0 : return NULL;
8425 : }
8426 :
8427 0 : push->flags |= ndr_push_flags;
8428 :
8429 0 : err = call->ndr_push(push, ndr_inout_flags, object);
8430 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
8431 0 : TALLOC_FREE(push);
8432 0 : PyErr_SetNdrError(err);
8433 0 : return NULL;
8434 : }
8435 0 : blob = ndr_push_blob(push);
8436 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
8437 0 : TALLOC_FREE(push);
8438 0 : return ret;
8439 : }
8440 :
8441 0 : static PyObject *py_winreg_FlushKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8442 : {
8443 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8444 0 : PyObject *bigendian_obj = NULL;
8445 0 : PyObject *ndr64_obj = NULL;
8446 0 : uint32_t ndr_push_flags = 0;
8447 :
8448 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
8449 : discard_const_p(char *, kwnames),
8450 : &bigendian_obj,
8451 : &ndr64_obj)) {
8452 0 : return NULL;
8453 : }
8454 :
8455 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8456 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8457 : }
8458 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8459 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8460 : }
8461 :
8462 0 : return py_winreg_FlushKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
8463 : }
8464 :
8465 0 : static PyObject *py_winreg_FlushKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8466 : {
8467 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8468 0 : PyObject *bigendian_obj = NULL;
8469 0 : PyObject *ndr64_obj = NULL;
8470 0 : uint32_t ndr_push_flags = 0;
8471 :
8472 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
8473 : discard_const_p(char *, kwnames),
8474 : &bigendian_obj,
8475 : &ndr64_obj)) {
8476 0 : return NULL;
8477 : }
8478 :
8479 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8480 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8481 : }
8482 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8483 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8484 : }
8485 :
8486 0 : return py_winreg_FlushKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
8487 : }
8488 :
8489 0 : static PyObject *py_winreg_FlushKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
8490 : {
8491 0 : const struct ndr_interface_call *call = NULL;
8492 0 : struct winreg_FlushKey *object = (struct winreg_FlushKey *)pytalloc_get_ptr(py_obj);
8493 0 : struct ndr_pull *pull = NULL;
8494 : enum ndr_err_code err;
8495 :
8496 0 : if (ndr_table_winreg.num_calls < 12) {
8497 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_FlushKey_ndr_unpack");
8498 0 : return NULL;
8499 : }
8500 0 : call = &ndr_table_winreg.calls[11];
8501 :
8502 0 : pull = ndr_pull_init_blob(blob, object);
8503 0 : if (pull == NULL) {
8504 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
8505 0 : return NULL;
8506 : }
8507 :
8508 0 : pull->flags |= ndr_pull_flags;
8509 :
8510 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
8511 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
8512 0 : TALLOC_FREE(pull);
8513 0 : PyErr_SetNdrError(err);
8514 0 : return NULL;
8515 : }
8516 0 : if (!allow_remaining) {
8517 : uint32_t highest_ofs;
8518 :
8519 0 : if (pull->offset > pull->relative_highest_offset) {
8520 0 : highest_ofs = pull->offset;
8521 : } else {
8522 0 : highest_ofs = pull->relative_highest_offset;
8523 : }
8524 0 : if (highest_ofs < pull->data_size) {
8525 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
8526 : "not all bytes consumed ofs[%u] size[%u]",
8527 : highest_ofs, pull->data_size);
8528 0 : TALLOC_FREE(pull);
8529 0 : PyErr_SetNdrError(err);
8530 0 : return NULL;
8531 : }
8532 : }
8533 :
8534 0 : TALLOC_FREE(pull);
8535 0 : Py_RETURN_NONE;
8536 : }
8537 :
8538 0 : static PyObject *py_winreg_FlushKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8539 : {
8540 : DATA_BLOB blob;
8541 0 : Py_ssize_t blob_length = 0;
8542 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
8543 0 : PyObject *bigendian_obj = NULL;
8544 0 : PyObject *ndr64_obj = NULL;
8545 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
8546 0 : PyObject *allow_remaining_obj = NULL;
8547 0 : bool allow_remaining = false;
8548 :
8549 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
8550 : discard_const_p(char *, kwnames),
8551 : &blob.data, &blob_length,
8552 : &bigendian_obj,
8553 : &ndr64_obj,
8554 : &allow_remaining_obj)) {
8555 0 : return NULL;
8556 : }
8557 0 : blob.length = blob_length;
8558 :
8559 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8560 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
8561 : }
8562 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8563 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
8564 : }
8565 :
8566 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
8567 0 : allow_remaining = true;
8568 : }
8569 :
8570 0 : return py_winreg_FlushKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
8571 : }
8572 :
8573 0 : static PyObject *py_winreg_FlushKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8574 : {
8575 : DATA_BLOB blob;
8576 0 : Py_ssize_t blob_length = 0;
8577 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
8578 0 : PyObject *bigendian_obj = NULL;
8579 0 : PyObject *ndr64_obj = NULL;
8580 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
8581 0 : PyObject *allow_remaining_obj = NULL;
8582 0 : bool allow_remaining = false;
8583 :
8584 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
8585 : discard_const_p(char *, kwnames),
8586 : &blob.data, &blob_length,
8587 : &bigendian_obj,
8588 : &ndr64_obj,
8589 : &allow_remaining_obj)) {
8590 0 : return NULL;
8591 : }
8592 0 : blob.length = blob_length;
8593 :
8594 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8595 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
8596 : }
8597 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8598 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
8599 : }
8600 :
8601 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
8602 0 : allow_remaining = true;
8603 : }
8604 :
8605 0 : return py_winreg_FlushKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
8606 : }
8607 :
8608 0 : static PyObject *py_winreg_FlushKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
8609 : {
8610 0 : const struct ndr_interface_call *call = NULL;
8611 0 : struct winreg_FlushKey *object = (struct winreg_FlushKey *)pytalloc_get_ptr(py_obj);
8612 : PyObject *ret;
8613 : char *retstr;
8614 :
8615 0 : if (ndr_table_winreg.num_calls < 12) {
8616 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_FlushKey_ndr_print");
8617 0 : return NULL;
8618 : }
8619 0 : call = &ndr_table_winreg.calls[11];
8620 :
8621 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
8622 0 : ret = PyUnicode_FromString(retstr);
8623 0 : TALLOC_FREE(retstr);
8624 :
8625 0 : return ret;
8626 : }
8627 :
8628 0 : static PyObject *py_winreg_FlushKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8629 : {
8630 0 : return py_winreg_FlushKey_ndr_print(py_obj, "winreg_FlushKey_in", NDR_IN);
8631 : }
8632 :
8633 0 : static PyObject *py_winreg_FlushKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
8634 : {
8635 0 : return py_winreg_FlushKey_ndr_print(py_obj, "winreg_FlushKey_out", NDR_OUT);
8636 : }
8637 :
8638 : static PyMethodDef py_winreg_FlushKey_methods[] = {
8639 : { "opnum", (PyCFunction)py_winreg_FlushKey_ndr_opnum, METH_NOARGS|METH_CLASS,
8640 : "winreg.FlushKey.opnum() -> 11 (0x0b) " },
8641 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
8642 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
8643 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
8644 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
8645 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
8646 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
8647 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_FlushKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
8648 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
8649 : { "__ndr_print_in__", (PyCFunction)py_winreg_FlushKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
8650 : { "__ndr_print_out__", (PyCFunction)py_winreg_FlushKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
8651 : { NULL, NULL, 0, NULL }
8652 : };
8653 :
8654 :
8655 : static PyTypeObject winreg_FlushKey_Type = {
8656 : PyVarObject_HEAD_INIT(NULL, 0)
8657 : .tp_name = "winreg.FlushKey",
8658 : .tp_getset = py_winreg_FlushKey_getsetters,
8659 : .tp_methods = py_winreg_FlushKey_methods,
8660 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
8661 : .tp_new = py_winreg_FlushKey_new,
8662 : };
8663 :
8664 0 : static bool pack_py_winreg_FlushKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_FlushKey *r)
8665 : {
8666 : PyObject *py_handle;
8667 0 : const char *kwnames[] = {
8668 : "handle", NULL
8669 : };
8670 :
8671 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_FlushKey", discard_const_p(char *, kwnames), &py_handle)) {
8672 0 : return false;
8673 : }
8674 :
8675 0 : if (py_handle == NULL) {
8676 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
8677 0 : return false;
8678 : }
8679 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
8680 0 : if (r->in.handle == NULL) {
8681 0 : PyErr_NoMemory();
8682 0 : return false;
8683 : }
8684 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
8685 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
8686 0 : PyErr_NoMemory();
8687 0 : return false;
8688 : }
8689 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
8690 0 : return true;
8691 : }
8692 :
8693 0 : static PyObject *unpack_py_winreg_FlushKey_args_out(struct winreg_FlushKey *r)
8694 : {
8695 : PyObject *result;
8696 0 : result = Py_None;
8697 0 : Py_INCREF(result);
8698 0 : if (!W_ERROR_IS_OK(r->out.result)) {
8699 0 : PyErr_SetWERROR(r->out.result);
8700 0 : return NULL;
8701 : }
8702 :
8703 0 : return result;
8704 : }
8705 :
8706 :
8707 0 : static PyObject *py_winreg_GetKeySecurity_in_get_handle(PyObject *obj, void *closure)
8708 : {
8709 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(obj);
8710 : PyObject *py_handle;
8711 0 : if (object->in.handle == NULL) {
8712 0 : Py_RETURN_NONE;
8713 : }
8714 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
8715 0 : return py_handle;
8716 : }
8717 :
8718 0 : static int py_winreg_GetKeySecurity_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
8719 : {
8720 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
8721 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
8722 0 : if (value == NULL) {
8723 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
8724 0 : return -1;
8725 : }
8726 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
8727 0 : if (object->in.handle == NULL) {
8728 0 : PyErr_NoMemory();
8729 0 : return -1;
8730 : }
8731 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
8732 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8733 0 : PyErr_NoMemory();
8734 0 : return -1;
8735 : }
8736 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
8737 0 : return 0;
8738 : }
8739 :
8740 0 : static PyObject *py_winreg_GetKeySecurity_in_get_sec_info(PyObject *obj, void *closure)
8741 : {
8742 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(obj);
8743 : PyObject *py_sec_info;
8744 0 : py_sec_info = PyLong_FromUnsignedLongLong((uint32_t)object->in.sec_info);
8745 0 : return py_sec_info;
8746 : }
8747 :
8748 0 : static int py_winreg_GetKeySecurity_in_set_sec_info(PyObject *py_obj, PyObject *value, void *closure)
8749 : {
8750 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
8751 0 : if (value == NULL) {
8752 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sec_info");
8753 0 : return -1;
8754 : }
8755 : {
8756 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.sec_info));
8757 0 : if (PyLong_Check(value)) {
8758 : unsigned long long test_var;
8759 0 : test_var = PyLong_AsUnsignedLongLong(value);
8760 0 : if (PyErr_Occurred() != NULL) {
8761 0 : return -1;
8762 : }
8763 0 : if (test_var > uint_max) {
8764 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
8765 : PyLong_Type.tp_name, uint_max, test_var);
8766 0 : return -1;
8767 : }
8768 0 : object->in.sec_info = test_var;
8769 : } else {
8770 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
8771 : PyLong_Type.tp_name);
8772 0 : return -1;
8773 : }
8774 : }
8775 0 : return 0;
8776 : }
8777 :
8778 0 : static PyObject *py_winreg_GetKeySecurity_in_get_sd(PyObject *obj, void *closure)
8779 : {
8780 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(obj);
8781 : PyObject *py_sd;
8782 0 : if (object->in.sd == NULL) {
8783 0 : Py_RETURN_NONE;
8784 : }
8785 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, object->in.sd, object->in.sd);
8786 0 : return py_sd;
8787 : }
8788 :
8789 0 : static int py_winreg_GetKeySecurity_in_set_sd(PyObject *py_obj, PyObject *value, void *closure)
8790 : {
8791 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
8792 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sd));
8793 0 : if (value == NULL) {
8794 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sd");
8795 0 : return -1;
8796 : }
8797 0 : object->in.sd = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.sd);
8798 0 : if (object->in.sd == NULL) {
8799 0 : PyErr_NoMemory();
8800 0 : return -1;
8801 : }
8802 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
8803 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8804 0 : PyErr_NoMemory();
8805 0 : return -1;
8806 : }
8807 0 : object->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(value);
8808 0 : return 0;
8809 : }
8810 :
8811 0 : static PyObject *py_winreg_GetKeySecurity_out_get_sd(PyObject *obj, void *closure)
8812 : {
8813 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(obj);
8814 : PyObject *py_sd;
8815 0 : if (object->out.sd == NULL) {
8816 0 : Py_RETURN_NONE;
8817 : }
8818 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, object->out.sd, object->out.sd);
8819 0 : return py_sd;
8820 : }
8821 :
8822 0 : static int py_winreg_GetKeySecurity_out_set_sd(PyObject *py_obj, PyObject *value, void *closure)
8823 : {
8824 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
8825 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.sd));
8826 0 : if (value == NULL) {
8827 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.sd");
8828 0 : return -1;
8829 : }
8830 0 : object->out.sd = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.sd);
8831 0 : if (object->out.sd == NULL) {
8832 0 : PyErr_NoMemory();
8833 0 : return -1;
8834 : }
8835 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
8836 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
8837 0 : PyErr_NoMemory();
8838 0 : return -1;
8839 : }
8840 0 : object->out.sd = (struct KeySecurityData *)pytalloc_get_ptr(value);
8841 0 : return 0;
8842 : }
8843 :
8844 0 : static PyObject *py_winreg_GetKeySecurity_get_result(PyObject *obj, void *closure)
8845 : {
8846 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(obj);
8847 : PyObject *py_result;
8848 0 : py_result = PyErr_FromWERROR(object->out.result);
8849 0 : return py_result;
8850 : }
8851 :
8852 0 : static int py_winreg_GetKeySecurity_set_result(PyObject *py_obj, PyObject *value, void *closure)
8853 : {
8854 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
8855 0 : if (value == NULL) {
8856 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
8857 0 : return -1;
8858 : }
8859 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
8860 0 : return 0;
8861 : }
8862 :
8863 : static PyGetSetDef py_winreg_GetKeySecurity_getsetters[] = {
8864 : {
8865 : .name = discard_const_p(char, "in_handle"),
8866 : .get = py_winreg_GetKeySecurity_in_get_handle,
8867 : .set = py_winreg_GetKeySecurity_in_set_handle,
8868 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
8869 : },
8870 : {
8871 : .name = discard_const_p(char, "in_sec_info"),
8872 : .get = py_winreg_GetKeySecurity_in_get_sec_info,
8873 : .set = py_winreg_GetKeySecurity_in_set_sec_info,
8874 : .doc = discard_const_p(char, "PIDL-generated element of base type security_secinfo")
8875 : },
8876 : {
8877 : .name = discard_const_p(char, "in_sd"),
8878 : .get = py_winreg_GetKeySecurity_in_get_sd,
8879 : .set = py_winreg_GetKeySecurity_in_set_sd,
8880 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
8881 : },
8882 : {
8883 : .name = discard_const_p(char, "out_sd"),
8884 : .get = py_winreg_GetKeySecurity_out_get_sd,
8885 : .set = py_winreg_GetKeySecurity_out_set_sd,
8886 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
8887 : },
8888 : {
8889 : .name = discard_const_p(char, "result"),
8890 : .get = py_winreg_GetKeySecurity_get_result,
8891 : .set = py_winreg_GetKeySecurity_set_result,
8892 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
8893 : },
8894 : { .name = NULL }
8895 : };
8896 :
8897 0 : static PyObject *py_winreg_GetKeySecurity_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
8898 : {
8899 0 : PyObject *self = pytalloc_new(struct winreg_GetKeySecurity, type);
8900 0 : struct winreg_GetKeySecurity *_self = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(self);
8901 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
8902 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
8903 0 : _self->in.sd = talloc_zero(mem_ctx, struct KeySecurityData);
8904 0 : _self->out.sd = talloc_zero(mem_ctx, struct KeySecurityData);
8905 0 : return self;
8906 : }
8907 :
8908 0 : static PyObject *py_winreg_GetKeySecurity_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
8909 : {
8910 :
8911 :
8912 0 : return PyLong_FromLong(12);
8913 : }
8914 :
8915 0 : static PyObject *py_winreg_GetKeySecurity_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
8916 : {
8917 0 : const struct ndr_interface_call *call = NULL;
8918 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
8919 0 : PyObject *ret = NULL;
8920 0 : struct ndr_push *push = NULL;
8921 : DATA_BLOB blob;
8922 : enum ndr_err_code err;
8923 :
8924 0 : if (ndr_table_winreg.num_calls < 13) {
8925 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetKeySecurity_ndr_pack");
8926 0 : return NULL;
8927 : }
8928 0 : call = &ndr_table_winreg.calls[12];
8929 :
8930 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
8931 0 : if (push == NULL) {
8932 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
8933 0 : return NULL;
8934 : }
8935 :
8936 0 : push->flags |= ndr_push_flags;
8937 :
8938 0 : err = call->ndr_push(push, ndr_inout_flags, object);
8939 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
8940 0 : TALLOC_FREE(push);
8941 0 : PyErr_SetNdrError(err);
8942 0 : return NULL;
8943 : }
8944 0 : blob = ndr_push_blob(push);
8945 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
8946 0 : TALLOC_FREE(push);
8947 0 : return ret;
8948 : }
8949 :
8950 0 : static PyObject *py_winreg_GetKeySecurity_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8951 : {
8952 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8953 0 : PyObject *bigendian_obj = NULL;
8954 0 : PyObject *ndr64_obj = NULL;
8955 0 : uint32_t ndr_push_flags = 0;
8956 :
8957 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
8958 : discard_const_p(char *, kwnames),
8959 : &bigendian_obj,
8960 : &ndr64_obj)) {
8961 0 : return NULL;
8962 : }
8963 :
8964 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8965 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8966 : }
8967 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8968 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8969 : }
8970 :
8971 0 : return py_winreg_GetKeySecurity_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
8972 : }
8973 :
8974 0 : static PyObject *py_winreg_GetKeySecurity_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
8975 : {
8976 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
8977 0 : PyObject *bigendian_obj = NULL;
8978 0 : PyObject *ndr64_obj = NULL;
8979 0 : uint32_t ndr_push_flags = 0;
8980 :
8981 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
8982 : discard_const_p(char *, kwnames),
8983 : &bigendian_obj,
8984 : &ndr64_obj)) {
8985 0 : return NULL;
8986 : }
8987 :
8988 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
8989 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
8990 : }
8991 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
8992 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
8993 : }
8994 :
8995 0 : return py_winreg_GetKeySecurity_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
8996 : }
8997 :
8998 0 : static PyObject *py_winreg_GetKeySecurity_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
8999 : {
9000 0 : const struct ndr_interface_call *call = NULL;
9001 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
9002 0 : struct ndr_pull *pull = NULL;
9003 : enum ndr_err_code err;
9004 :
9005 0 : if (ndr_table_winreg.num_calls < 13) {
9006 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetKeySecurity_ndr_unpack");
9007 0 : return NULL;
9008 : }
9009 0 : call = &ndr_table_winreg.calls[12];
9010 :
9011 0 : pull = ndr_pull_init_blob(blob, object);
9012 0 : if (pull == NULL) {
9013 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
9014 0 : return NULL;
9015 : }
9016 :
9017 0 : pull->flags |= ndr_pull_flags;
9018 :
9019 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
9020 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
9021 0 : TALLOC_FREE(pull);
9022 0 : PyErr_SetNdrError(err);
9023 0 : return NULL;
9024 : }
9025 0 : if (!allow_remaining) {
9026 : uint32_t highest_ofs;
9027 :
9028 0 : if (pull->offset > pull->relative_highest_offset) {
9029 0 : highest_ofs = pull->offset;
9030 : } else {
9031 0 : highest_ofs = pull->relative_highest_offset;
9032 : }
9033 0 : if (highest_ofs < pull->data_size) {
9034 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
9035 : "not all bytes consumed ofs[%u] size[%u]",
9036 : highest_ofs, pull->data_size);
9037 0 : TALLOC_FREE(pull);
9038 0 : PyErr_SetNdrError(err);
9039 0 : return NULL;
9040 : }
9041 : }
9042 :
9043 0 : TALLOC_FREE(pull);
9044 0 : Py_RETURN_NONE;
9045 : }
9046 :
9047 0 : static PyObject *py_winreg_GetKeySecurity_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9048 : {
9049 : DATA_BLOB blob;
9050 0 : Py_ssize_t blob_length = 0;
9051 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9052 0 : PyObject *bigendian_obj = NULL;
9053 0 : PyObject *ndr64_obj = NULL;
9054 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9055 0 : PyObject *allow_remaining_obj = NULL;
9056 0 : bool allow_remaining = false;
9057 :
9058 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
9059 : discard_const_p(char *, kwnames),
9060 : &blob.data, &blob_length,
9061 : &bigendian_obj,
9062 : &ndr64_obj,
9063 : &allow_remaining_obj)) {
9064 0 : return NULL;
9065 : }
9066 0 : blob.length = blob_length;
9067 :
9068 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9069 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9070 : }
9071 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9072 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9073 : }
9074 :
9075 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9076 0 : allow_remaining = true;
9077 : }
9078 :
9079 0 : return py_winreg_GetKeySecurity_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
9080 : }
9081 :
9082 0 : static PyObject *py_winreg_GetKeySecurity_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9083 : {
9084 : DATA_BLOB blob;
9085 0 : Py_ssize_t blob_length = 0;
9086 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9087 0 : PyObject *bigendian_obj = NULL;
9088 0 : PyObject *ndr64_obj = NULL;
9089 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9090 0 : PyObject *allow_remaining_obj = NULL;
9091 0 : bool allow_remaining = false;
9092 :
9093 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
9094 : discard_const_p(char *, kwnames),
9095 : &blob.data, &blob_length,
9096 : &bigendian_obj,
9097 : &ndr64_obj,
9098 : &allow_remaining_obj)) {
9099 0 : return NULL;
9100 : }
9101 0 : blob.length = blob_length;
9102 :
9103 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9104 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9105 : }
9106 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9107 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9108 : }
9109 :
9110 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9111 0 : allow_remaining = true;
9112 : }
9113 :
9114 0 : return py_winreg_GetKeySecurity_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
9115 : }
9116 :
9117 0 : static PyObject *py_winreg_GetKeySecurity_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
9118 : {
9119 0 : const struct ndr_interface_call *call = NULL;
9120 0 : struct winreg_GetKeySecurity *object = (struct winreg_GetKeySecurity *)pytalloc_get_ptr(py_obj);
9121 : PyObject *ret;
9122 : char *retstr;
9123 :
9124 0 : if (ndr_table_winreg.num_calls < 13) {
9125 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetKeySecurity_ndr_print");
9126 0 : return NULL;
9127 : }
9128 0 : call = &ndr_table_winreg.calls[12];
9129 :
9130 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
9131 0 : ret = PyUnicode_FromString(retstr);
9132 0 : TALLOC_FREE(retstr);
9133 :
9134 0 : return ret;
9135 : }
9136 :
9137 0 : static PyObject *py_winreg_GetKeySecurity_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9138 : {
9139 0 : return py_winreg_GetKeySecurity_ndr_print(py_obj, "winreg_GetKeySecurity_in", NDR_IN);
9140 : }
9141 :
9142 0 : static PyObject *py_winreg_GetKeySecurity_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9143 : {
9144 0 : return py_winreg_GetKeySecurity_ndr_print(py_obj, "winreg_GetKeySecurity_out", NDR_OUT);
9145 : }
9146 :
9147 : static PyMethodDef py_winreg_GetKeySecurity_methods[] = {
9148 : { "opnum", (PyCFunction)py_winreg_GetKeySecurity_ndr_opnum, METH_NOARGS|METH_CLASS,
9149 : "winreg.GetKeySecurity.opnum() -> 12 (0x0c) " },
9150 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
9151 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
9152 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
9153 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
9154 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
9155 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
9156 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetKeySecurity_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
9157 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
9158 : { "__ndr_print_in__", (PyCFunction)py_winreg_GetKeySecurity_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
9159 : { "__ndr_print_out__", (PyCFunction)py_winreg_GetKeySecurity_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
9160 : { NULL, NULL, 0, NULL }
9161 : };
9162 :
9163 :
9164 : static PyTypeObject winreg_GetKeySecurity_Type = {
9165 : PyVarObject_HEAD_INIT(NULL, 0)
9166 : .tp_name = "winreg.GetKeySecurity",
9167 : .tp_getset = py_winreg_GetKeySecurity_getsetters,
9168 : .tp_methods = py_winreg_GetKeySecurity_methods,
9169 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
9170 : .tp_new = py_winreg_GetKeySecurity_new,
9171 : };
9172 :
9173 0 : static bool pack_py_winreg_GetKeySecurity_args_in(PyObject *args, PyObject *kwargs, struct winreg_GetKeySecurity *r)
9174 : {
9175 : PyObject *py_handle;
9176 : PyObject *py_sec_info;
9177 : PyObject *py_sd;
9178 0 : const char *kwnames[] = {
9179 : "handle", "sec_info", "sd", NULL
9180 : };
9181 :
9182 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_GetKeySecurity", discard_const_p(char *, kwnames), &py_handle, &py_sec_info, &py_sd)) {
9183 0 : return false;
9184 : }
9185 :
9186 0 : if (py_handle == NULL) {
9187 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
9188 0 : return false;
9189 : }
9190 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
9191 0 : if (r->in.handle == NULL) {
9192 0 : PyErr_NoMemory();
9193 0 : return false;
9194 : }
9195 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
9196 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
9197 0 : PyErr_NoMemory();
9198 0 : return false;
9199 : }
9200 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
9201 0 : if (py_sec_info == NULL) {
9202 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sec_info");
9203 0 : return false;
9204 : }
9205 : {
9206 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.sec_info));
9207 0 : if (PyLong_Check(py_sec_info)) {
9208 : unsigned long long test_var;
9209 0 : test_var = PyLong_AsUnsignedLongLong(py_sec_info);
9210 0 : if (PyErr_Occurred() != NULL) {
9211 0 : return false;
9212 : }
9213 0 : if (test_var > uint_max) {
9214 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9215 : PyLong_Type.tp_name, uint_max, test_var);
9216 0 : return false;
9217 : }
9218 0 : r->in.sec_info = test_var;
9219 : } else {
9220 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9221 : PyLong_Type.tp_name);
9222 0 : return false;
9223 : }
9224 : }
9225 0 : if (py_sd == NULL) {
9226 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sd");
9227 0 : return false;
9228 : }
9229 0 : r->in.sd = talloc_ptrtype(r, r->in.sd);
9230 0 : if (r->in.sd == NULL) {
9231 0 : PyErr_NoMemory();
9232 0 : return false;
9233 : }
9234 0 : PY_CHECK_TYPE(&KeySecurityData_Type, py_sd, return false;);
9235 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sd)) == NULL) {
9236 0 : PyErr_NoMemory();
9237 0 : return false;
9238 : }
9239 0 : r->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(py_sd);
9240 0 : return true;
9241 : }
9242 :
9243 0 : static PyObject *unpack_py_winreg_GetKeySecurity_args_out(struct winreg_GetKeySecurity *r)
9244 : {
9245 : PyObject *result;
9246 : PyObject *py_sd;
9247 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, r->out.sd, r->out.sd);
9248 0 : result = py_sd;
9249 0 : if (!W_ERROR_IS_OK(r->out.result)) {
9250 0 : PyErr_SetWERROR(r->out.result);
9251 0 : return NULL;
9252 : }
9253 :
9254 0 : return result;
9255 : }
9256 :
9257 :
9258 0 : static PyObject *py_winreg_LoadKey_in_get_handle(PyObject *obj, void *closure)
9259 : {
9260 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(obj);
9261 : PyObject *py_handle;
9262 0 : if (object->in.handle == NULL) {
9263 0 : Py_RETURN_NONE;
9264 : }
9265 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
9266 0 : return py_handle;
9267 : }
9268 :
9269 0 : static int py_winreg_LoadKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
9270 : {
9271 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(py_obj);
9272 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
9273 0 : if (value == NULL) {
9274 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
9275 0 : return -1;
9276 : }
9277 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
9278 0 : if (object->in.handle == NULL) {
9279 0 : PyErr_NoMemory();
9280 0 : return -1;
9281 : }
9282 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
9283 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9284 0 : PyErr_NoMemory();
9285 0 : return -1;
9286 : }
9287 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
9288 0 : return 0;
9289 : }
9290 :
9291 0 : static PyObject *py_winreg_LoadKey_in_get_keyname(PyObject *obj, void *closure)
9292 : {
9293 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(obj);
9294 : PyObject *py_keyname;
9295 0 : if (object->in.keyname == NULL) {
9296 0 : Py_RETURN_NONE;
9297 : }
9298 0 : if (object->in.keyname == NULL) {
9299 0 : py_keyname = Py_None;
9300 0 : Py_INCREF(py_keyname);
9301 : } else {
9302 0 : py_keyname = pytalloc_reference_ex(&winreg_String_Type, object->in.keyname, object->in.keyname);
9303 : }
9304 0 : return py_keyname;
9305 : }
9306 :
9307 0 : static int py_winreg_LoadKey_in_set_keyname(PyObject *py_obj, PyObject *value, void *closure)
9308 : {
9309 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(py_obj);
9310 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.keyname));
9311 0 : if (value == NULL) {
9312 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.keyname");
9313 0 : return -1;
9314 : }
9315 0 : if (value == Py_None) {
9316 0 : object->in.keyname = NULL;
9317 : } else {
9318 0 : object->in.keyname = NULL;
9319 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9320 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9321 0 : PyErr_NoMemory();
9322 0 : return -1;
9323 : }
9324 0 : object->in.keyname = (struct winreg_String *)pytalloc_get_ptr(value);
9325 : }
9326 0 : return 0;
9327 : }
9328 :
9329 0 : static PyObject *py_winreg_LoadKey_in_get_filename(PyObject *obj, void *closure)
9330 : {
9331 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(obj);
9332 : PyObject *py_filename;
9333 0 : if (object->in.filename == NULL) {
9334 0 : Py_RETURN_NONE;
9335 : }
9336 0 : if (object->in.filename == NULL) {
9337 0 : py_filename = Py_None;
9338 0 : Py_INCREF(py_filename);
9339 : } else {
9340 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
9341 : }
9342 0 : return py_filename;
9343 : }
9344 :
9345 0 : static int py_winreg_LoadKey_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
9346 : {
9347 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(py_obj);
9348 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
9349 0 : if (value == NULL) {
9350 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.filename");
9351 0 : return -1;
9352 : }
9353 0 : if (value == Py_None) {
9354 0 : object->in.filename = NULL;
9355 : } else {
9356 0 : object->in.filename = NULL;
9357 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9358 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9359 0 : PyErr_NoMemory();
9360 0 : return -1;
9361 : }
9362 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
9363 : }
9364 0 : return 0;
9365 : }
9366 :
9367 0 : static PyObject *py_winreg_LoadKey_get_result(PyObject *obj, void *closure)
9368 : {
9369 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(obj);
9370 : PyObject *py_result;
9371 0 : py_result = PyErr_FromWERROR(object->out.result);
9372 0 : return py_result;
9373 : }
9374 :
9375 0 : static int py_winreg_LoadKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
9376 : {
9377 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(py_obj);
9378 0 : if (value == NULL) {
9379 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
9380 0 : return -1;
9381 : }
9382 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
9383 0 : return 0;
9384 : }
9385 :
9386 : static PyGetSetDef py_winreg_LoadKey_getsetters[] = {
9387 : {
9388 : .name = discard_const_p(char, "in_handle"),
9389 : .get = py_winreg_LoadKey_in_get_handle,
9390 : .set = py_winreg_LoadKey_in_set_handle,
9391 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
9392 : },
9393 : {
9394 : .name = discard_const_p(char, "in_keyname"),
9395 : .get = py_winreg_LoadKey_in_get_keyname,
9396 : .set = py_winreg_LoadKey_in_set_keyname,
9397 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
9398 : },
9399 : {
9400 : .name = discard_const_p(char, "in_filename"),
9401 : .get = py_winreg_LoadKey_in_get_filename,
9402 : .set = py_winreg_LoadKey_in_set_filename,
9403 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
9404 : },
9405 : {
9406 : .name = discard_const_p(char, "result"),
9407 : .get = py_winreg_LoadKey_get_result,
9408 : .set = py_winreg_LoadKey_set_result,
9409 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
9410 : },
9411 : { .name = NULL }
9412 : };
9413 :
9414 0 : static PyObject *py_winreg_LoadKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
9415 : {
9416 0 : PyObject *self = pytalloc_new(struct winreg_LoadKey, type);
9417 0 : struct winreg_LoadKey *_self = (struct winreg_LoadKey *)pytalloc_get_ptr(self);
9418 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
9419 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
9420 0 : return self;
9421 : }
9422 :
9423 0 : static PyObject *py_winreg_LoadKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
9424 : {
9425 :
9426 :
9427 0 : return PyLong_FromLong(13);
9428 : }
9429 :
9430 0 : static PyObject *py_winreg_LoadKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
9431 : {
9432 0 : const struct ndr_interface_call *call = NULL;
9433 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(py_obj);
9434 0 : PyObject *ret = NULL;
9435 0 : struct ndr_push *push = NULL;
9436 : DATA_BLOB blob;
9437 : enum ndr_err_code err;
9438 :
9439 0 : if (ndr_table_winreg.num_calls < 14) {
9440 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_LoadKey_ndr_pack");
9441 0 : return NULL;
9442 : }
9443 0 : call = &ndr_table_winreg.calls[13];
9444 :
9445 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
9446 0 : if (push == NULL) {
9447 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
9448 0 : return NULL;
9449 : }
9450 :
9451 0 : push->flags |= ndr_push_flags;
9452 :
9453 0 : err = call->ndr_push(push, ndr_inout_flags, object);
9454 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
9455 0 : TALLOC_FREE(push);
9456 0 : PyErr_SetNdrError(err);
9457 0 : return NULL;
9458 : }
9459 0 : blob = ndr_push_blob(push);
9460 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
9461 0 : TALLOC_FREE(push);
9462 0 : return ret;
9463 : }
9464 :
9465 0 : static PyObject *py_winreg_LoadKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9466 : {
9467 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
9468 0 : PyObject *bigendian_obj = NULL;
9469 0 : PyObject *ndr64_obj = NULL;
9470 0 : uint32_t ndr_push_flags = 0;
9471 :
9472 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
9473 : discard_const_p(char *, kwnames),
9474 : &bigendian_obj,
9475 : &ndr64_obj)) {
9476 0 : return NULL;
9477 : }
9478 :
9479 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9480 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
9481 : }
9482 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9483 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
9484 : }
9485 :
9486 0 : return py_winreg_LoadKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
9487 : }
9488 :
9489 0 : static PyObject *py_winreg_LoadKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9490 : {
9491 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
9492 0 : PyObject *bigendian_obj = NULL;
9493 0 : PyObject *ndr64_obj = NULL;
9494 0 : uint32_t ndr_push_flags = 0;
9495 :
9496 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
9497 : discard_const_p(char *, kwnames),
9498 : &bigendian_obj,
9499 : &ndr64_obj)) {
9500 0 : return NULL;
9501 : }
9502 :
9503 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9504 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
9505 : }
9506 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9507 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
9508 : }
9509 :
9510 0 : return py_winreg_LoadKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
9511 : }
9512 :
9513 0 : static PyObject *py_winreg_LoadKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
9514 : {
9515 0 : const struct ndr_interface_call *call = NULL;
9516 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(py_obj);
9517 0 : struct ndr_pull *pull = NULL;
9518 : enum ndr_err_code err;
9519 :
9520 0 : if (ndr_table_winreg.num_calls < 14) {
9521 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_LoadKey_ndr_unpack");
9522 0 : return NULL;
9523 : }
9524 0 : call = &ndr_table_winreg.calls[13];
9525 :
9526 0 : pull = ndr_pull_init_blob(blob, object);
9527 0 : if (pull == NULL) {
9528 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
9529 0 : return NULL;
9530 : }
9531 :
9532 0 : pull->flags |= ndr_pull_flags;
9533 :
9534 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
9535 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
9536 0 : TALLOC_FREE(pull);
9537 0 : PyErr_SetNdrError(err);
9538 0 : return NULL;
9539 : }
9540 0 : if (!allow_remaining) {
9541 : uint32_t highest_ofs;
9542 :
9543 0 : if (pull->offset > pull->relative_highest_offset) {
9544 0 : highest_ofs = pull->offset;
9545 : } else {
9546 0 : highest_ofs = pull->relative_highest_offset;
9547 : }
9548 0 : if (highest_ofs < pull->data_size) {
9549 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
9550 : "not all bytes consumed ofs[%u] size[%u]",
9551 : highest_ofs, pull->data_size);
9552 0 : TALLOC_FREE(pull);
9553 0 : PyErr_SetNdrError(err);
9554 0 : return NULL;
9555 : }
9556 : }
9557 :
9558 0 : TALLOC_FREE(pull);
9559 0 : Py_RETURN_NONE;
9560 : }
9561 :
9562 0 : static PyObject *py_winreg_LoadKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9563 : {
9564 : DATA_BLOB blob;
9565 0 : Py_ssize_t blob_length = 0;
9566 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9567 0 : PyObject *bigendian_obj = NULL;
9568 0 : PyObject *ndr64_obj = NULL;
9569 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9570 0 : PyObject *allow_remaining_obj = NULL;
9571 0 : bool allow_remaining = false;
9572 :
9573 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
9574 : discard_const_p(char *, kwnames),
9575 : &blob.data, &blob_length,
9576 : &bigendian_obj,
9577 : &ndr64_obj,
9578 : &allow_remaining_obj)) {
9579 0 : return NULL;
9580 : }
9581 0 : blob.length = blob_length;
9582 :
9583 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9584 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9585 : }
9586 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9587 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9588 : }
9589 :
9590 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9591 0 : allow_remaining = true;
9592 : }
9593 :
9594 0 : return py_winreg_LoadKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
9595 : }
9596 :
9597 0 : static PyObject *py_winreg_LoadKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
9598 : {
9599 : DATA_BLOB blob;
9600 0 : Py_ssize_t blob_length = 0;
9601 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
9602 0 : PyObject *bigendian_obj = NULL;
9603 0 : PyObject *ndr64_obj = NULL;
9604 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
9605 0 : PyObject *allow_remaining_obj = NULL;
9606 0 : bool allow_remaining = false;
9607 :
9608 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
9609 : discard_const_p(char *, kwnames),
9610 : &blob.data, &blob_length,
9611 : &bigendian_obj,
9612 : &ndr64_obj,
9613 : &allow_remaining_obj)) {
9614 0 : return NULL;
9615 : }
9616 0 : blob.length = blob_length;
9617 :
9618 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
9619 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
9620 : }
9621 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
9622 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
9623 : }
9624 :
9625 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
9626 0 : allow_remaining = true;
9627 : }
9628 :
9629 0 : return py_winreg_LoadKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
9630 : }
9631 :
9632 0 : static PyObject *py_winreg_LoadKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
9633 : {
9634 0 : const struct ndr_interface_call *call = NULL;
9635 0 : struct winreg_LoadKey *object = (struct winreg_LoadKey *)pytalloc_get_ptr(py_obj);
9636 : PyObject *ret;
9637 : char *retstr;
9638 :
9639 0 : if (ndr_table_winreg.num_calls < 14) {
9640 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_LoadKey_ndr_print");
9641 0 : return NULL;
9642 : }
9643 0 : call = &ndr_table_winreg.calls[13];
9644 :
9645 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
9646 0 : ret = PyUnicode_FromString(retstr);
9647 0 : TALLOC_FREE(retstr);
9648 :
9649 0 : return ret;
9650 : }
9651 :
9652 0 : static PyObject *py_winreg_LoadKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9653 : {
9654 0 : return py_winreg_LoadKey_ndr_print(py_obj, "winreg_LoadKey_in", NDR_IN);
9655 : }
9656 :
9657 0 : static PyObject *py_winreg_LoadKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
9658 : {
9659 0 : return py_winreg_LoadKey_ndr_print(py_obj, "winreg_LoadKey_out", NDR_OUT);
9660 : }
9661 :
9662 : static PyMethodDef py_winreg_LoadKey_methods[] = {
9663 : { "opnum", (PyCFunction)py_winreg_LoadKey_ndr_opnum, METH_NOARGS|METH_CLASS,
9664 : "winreg.LoadKey.opnum() -> 13 (0x0d) " },
9665 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
9666 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
9667 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
9668 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
9669 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
9670 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
9671 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_LoadKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
9672 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
9673 : { "__ndr_print_in__", (PyCFunction)py_winreg_LoadKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
9674 : { "__ndr_print_out__", (PyCFunction)py_winreg_LoadKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
9675 : { NULL, NULL, 0, NULL }
9676 : };
9677 :
9678 :
9679 : static PyTypeObject winreg_LoadKey_Type = {
9680 : PyVarObject_HEAD_INIT(NULL, 0)
9681 : .tp_name = "winreg.LoadKey",
9682 : .tp_getset = py_winreg_LoadKey_getsetters,
9683 : .tp_methods = py_winreg_LoadKey_methods,
9684 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
9685 : .tp_new = py_winreg_LoadKey_new,
9686 : };
9687 :
9688 0 : static bool pack_py_winreg_LoadKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_LoadKey *r)
9689 : {
9690 : PyObject *py_handle;
9691 : PyObject *py_keyname;
9692 : PyObject *py_filename;
9693 0 : const char *kwnames[] = {
9694 : "handle", "keyname", "filename", NULL
9695 : };
9696 :
9697 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_LoadKey", discard_const_p(char *, kwnames), &py_handle, &py_keyname, &py_filename)) {
9698 0 : return false;
9699 : }
9700 :
9701 0 : if (py_handle == NULL) {
9702 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
9703 0 : return false;
9704 : }
9705 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
9706 0 : if (r->in.handle == NULL) {
9707 0 : PyErr_NoMemory();
9708 0 : return false;
9709 : }
9710 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
9711 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
9712 0 : PyErr_NoMemory();
9713 0 : return false;
9714 : }
9715 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
9716 0 : if (py_keyname == NULL) {
9717 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.keyname");
9718 0 : return false;
9719 : }
9720 0 : if (py_keyname == Py_None) {
9721 0 : r->in.keyname = NULL;
9722 : } else {
9723 0 : r->in.keyname = NULL;
9724 0 : PY_CHECK_TYPE(&winreg_String_Type, py_keyname, return false;);
9725 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyname)) == NULL) {
9726 0 : PyErr_NoMemory();
9727 0 : return false;
9728 : }
9729 0 : r->in.keyname = (struct winreg_String *)pytalloc_get_ptr(py_keyname);
9730 : }
9731 0 : if (py_filename == NULL) {
9732 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.filename");
9733 0 : return false;
9734 : }
9735 0 : if (py_filename == Py_None) {
9736 0 : r->in.filename = NULL;
9737 : } else {
9738 0 : r->in.filename = NULL;
9739 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
9740 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
9741 0 : PyErr_NoMemory();
9742 0 : return false;
9743 : }
9744 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
9745 : }
9746 0 : return true;
9747 : }
9748 :
9749 0 : static PyObject *unpack_py_winreg_LoadKey_args_out(struct winreg_LoadKey *r)
9750 : {
9751 : PyObject *result;
9752 0 : result = Py_None;
9753 0 : Py_INCREF(result);
9754 0 : if (!W_ERROR_IS_OK(r->out.result)) {
9755 0 : PyErr_SetWERROR(r->out.result);
9756 0 : return NULL;
9757 : }
9758 :
9759 0 : return result;
9760 : }
9761 :
9762 :
9763 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_handle(PyObject *obj, void *closure)
9764 : {
9765 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9766 : PyObject *py_handle;
9767 0 : if (object->in.handle == NULL) {
9768 0 : Py_RETURN_NONE;
9769 : }
9770 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
9771 0 : return py_handle;
9772 : }
9773 :
9774 0 : static int py_winreg_NotifyChangeKeyValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
9775 : {
9776 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
9777 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
9778 0 : if (value == NULL) {
9779 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
9780 0 : return -1;
9781 : }
9782 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
9783 0 : if (object->in.handle == NULL) {
9784 0 : PyErr_NoMemory();
9785 0 : return -1;
9786 : }
9787 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
9788 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9789 0 : PyErr_NoMemory();
9790 0 : return -1;
9791 : }
9792 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
9793 0 : return 0;
9794 : }
9795 :
9796 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_watch_subtree(PyObject *obj, void *closure)
9797 : {
9798 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9799 : PyObject *py_watch_subtree;
9800 0 : py_watch_subtree = PyLong_FromLong((uint16_t)object->in.watch_subtree);
9801 0 : return py_watch_subtree;
9802 : }
9803 :
9804 0 : static int py_winreg_NotifyChangeKeyValue_in_set_watch_subtree(PyObject *py_obj, PyObject *value, void *closure)
9805 : {
9806 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
9807 0 : if (value == NULL) {
9808 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.watch_subtree");
9809 0 : return -1;
9810 : }
9811 : {
9812 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.watch_subtree));
9813 0 : if (PyLong_Check(value)) {
9814 : unsigned long long test_var;
9815 0 : test_var = PyLong_AsUnsignedLongLong(value);
9816 0 : if (PyErr_Occurred() != NULL) {
9817 0 : return -1;
9818 : }
9819 0 : if (test_var > uint_max) {
9820 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9821 : PyLong_Type.tp_name, uint_max, test_var);
9822 0 : return -1;
9823 : }
9824 0 : object->in.watch_subtree = test_var;
9825 : } else {
9826 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9827 : PyLong_Type.tp_name);
9828 0 : return -1;
9829 : }
9830 : }
9831 0 : return 0;
9832 : }
9833 :
9834 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_notify_filter(PyObject *obj, void *closure)
9835 : {
9836 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9837 : PyObject *py_notify_filter;
9838 0 : py_notify_filter = PyLong_FromUnsignedLongLong((uint32_t)object->in.notify_filter);
9839 0 : return py_notify_filter;
9840 : }
9841 :
9842 0 : static int py_winreg_NotifyChangeKeyValue_in_set_notify_filter(PyObject *py_obj, PyObject *value, void *closure)
9843 : {
9844 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
9845 0 : if (value == NULL) {
9846 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.notify_filter");
9847 0 : return -1;
9848 : }
9849 : {
9850 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.notify_filter));
9851 0 : if (PyLong_Check(value)) {
9852 : unsigned long long test_var;
9853 0 : test_var = PyLong_AsUnsignedLongLong(value);
9854 0 : if (PyErr_Occurred() != NULL) {
9855 0 : return -1;
9856 : }
9857 0 : if (test_var > uint_max) {
9858 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9859 : PyLong_Type.tp_name, uint_max, test_var);
9860 0 : return -1;
9861 : }
9862 0 : object->in.notify_filter = test_var;
9863 : } else {
9864 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9865 : PyLong_Type.tp_name);
9866 0 : return -1;
9867 : }
9868 : }
9869 0 : return 0;
9870 : }
9871 :
9872 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_unknown(PyObject *obj, void *closure)
9873 : {
9874 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9875 : PyObject *py_unknown;
9876 0 : py_unknown = PyLong_FromUnsignedLongLong((uint32_t)object->in.unknown);
9877 0 : return py_unknown;
9878 : }
9879 :
9880 0 : static int py_winreg_NotifyChangeKeyValue_in_set_unknown(PyObject *py_obj, PyObject *value, void *closure)
9881 : {
9882 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
9883 0 : if (value == NULL) {
9884 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.unknown");
9885 0 : return -1;
9886 : }
9887 : {
9888 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.unknown));
9889 0 : if (PyLong_Check(value)) {
9890 : unsigned long long test_var;
9891 0 : test_var = PyLong_AsUnsignedLongLong(value);
9892 0 : if (PyErr_Occurred() != NULL) {
9893 0 : return -1;
9894 : }
9895 0 : if (test_var > uint_max) {
9896 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9897 : PyLong_Type.tp_name, uint_max, test_var);
9898 0 : return -1;
9899 : }
9900 0 : object->in.unknown = test_var;
9901 : } else {
9902 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9903 : PyLong_Type.tp_name);
9904 0 : return -1;
9905 : }
9906 : }
9907 0 : return 0;
9908 : }
9909 :
9910 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_string1(PyObject *obj, void *closure)
9911 : {
9912 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9913 : PyObject *py_string1;
9914 0 : py_string1 = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.string1);
9915 0 : return py_string1;
9916 : }
9917 :
9918 0 : static int py_winreg_NotifyChangeKeyValue_in_set_string1(PyObject *py_obj, PyObject *value, void *closure)
9919 : {
9920 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
9921 0 : if (value == NULL) {
9922 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.string1");
9923 0 : return -1;
9924 : }
9925 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9926 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9927 0 : PyErr_NoMemory();
9928 0 : return -1;
9929 : }
9930 0 : object->in.string1 = *(struct winreg_String *)pytalloc_get_ptr(value);
9931 0 : return 0;
9932 : }
9933 :
9934 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_string2(PyObject *obj, void *closure)
9935 : {
9936 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9937 : PyObject *py_string2;
9938 0 : py_string2 = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.string2);
9939 0 : return py_string2;
9940 : }
9941 :
9942 0 : static int py_winreg_NotifyChangeKeyValue_in_set_string2(PyObject *py_obj, PyObject *value, void *closure)
9943 : {
9944 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
9945 0 : if (value == NULL) {
9946 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.string2");
9947 0 : return -1;
9948 : }
9949 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
9950 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
9951 0 : PyErr_NoMemory();
9952 0 : return -1;
9953 : }
9954 0 : object->in.string2 = *(struct winreg_String *)pytalloc_get_ptr(value);
9955 0 : return 0;
9956 : }
9957 :
9958 0 : static PyObject *py_winreg_NotifyChangeKeyValue_in_get_unknown2(PyObject *obj, void *closure)
9959 : {
9960 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9961 : PyObject *py_unknown2;
9962 0 : py_unknown2 = PyLong_FromUnsignedLongLong((uint32_t)object->in.unknown2);
9963 0 : return py_unknown2;
9964 : }
9965 :
9966 0 : static int py_winreg_NotifyChangeKeyValue_in_set_unknown2(PyObject *py_obj, PyObject *value, void *closure)
9967 : {
9968 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
9969 0 : if (value == NULL) {
9970 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.unknown2");
9971 0 : return -1;
9972 : }
9973 : {
9974 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.unknown2));
9975 0 : if (PyLong_Check(value)) {
9976 : unsigned long long test_var;
9977 0 : test_var = PyLong_AsUnsignedLongLong(value);
9978 0 : if (PyErr_Occurred() != NULL) {
9979 0 : return -1;
9980 : }
9981 0 : if (test_var > uint_max) {
9982 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
9983 : PyLong_Type.tp_name, uint_max, test_var);
9984 0 : return -1;
9985 : }
9986 0 : object->in.unknown2 = test_var;
9987 : } else {
9988 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
9989 : PyLong_Type.tp_name);
9990 0 : return -1;
9991 : }
9992 : }
9993 0 : return 0;
9994 : }
9995 :
9996 0 : static PyObject *py_winreg_NotifyChangeKeyValue_get_result(PyObject *obj, void *closure)
9997 : {
9998 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(obj);
9999 : PyObject *py_result;
10000 0 : py_result = PyErr_FromWERROR(object->out.result);
10001 0 : return py_result;
10002 : }
10003 :
10004 0 : static int py_winreg_NotifyChangeKeyValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
10005 : {
10006 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
10007 0 : if (value == NULL) {
10008 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
10009 0 : return -1;
10010 : }
10011 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
10012 0 : return 0;
10013 : }
10014 :
10015 : static PyGetSetDef py_winreg_NotifyChangeKeyValue_getsetters[] = {
10016 : {
10017 : .name = discard_const_p(char, "in_handle"),
10018 : .get = py_winreg_NotifyChangeKeyValue_in_get_handle,
10019 : .set = py_winreg_NotifyChangeKeyValue_in_set_handle,
10020 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
10021 : },
10022 : {
10023 : .name = discard_const_p(char, "in_watch_subtree"),
10024 : .get = py_winreg_NotifyChangeKeyValue_in_get_watch_subtree,
10025 : .set = py_winreg_NotifyChangeKeyValue_in_set_watch_subtree,
10026 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
10027 : },
10028 : {
10029 : .name = discard_const_p(char, "in_notify_filter"),
10030 : .get = py_winreg_NotifyChangeKeyValue_in_get_notify_filter,
10031 : .set = py_winreg_NotifyChangeKeyValue_in_set_notify_filter,
10032 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_NotifyChangeType")
10033 : },
10034 : {
10035 : .name = discard_const_p(char, "in_unknown"),
10036 : .get = py_winreg_NotifyChangeKeyValue_in_get_unknown,
10037 : .set = py_winreg_NotifyChangeKeyValue_in_set_unknown,
10038 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
10039 : },
10040 : {
10041 : .name = discard_const_p(char, "in_string1"),
10042 : .get = py_winreg_NotifyChangeKeyValue_in_get_string1,
10043 : .set = py_winreg_NotifyChangeKeyValue_in_set_string1,
10044 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
10045 : },
10046 : {
10047 : .name = discard_const_p(char, "in_string2"),
10048 : .get = py_winreg_NotifyChangeKeyValue_in_get_string2,
10049 : .set = py_winreg_NotifyChangeKeyValue_in_set_string2,
10050 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
10051 : },
10052 : {
10053 : .name = discard_const_p(char, "in_unknown2"),
10054 : .get = py_winreg_NotifyChangeKeyValue_in_get_unknown2,
10055 : .set = py_winreg_NotifyChangeKeyValue_in_set_unknown2,
10056 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
10057 : },
10058 : {
10059 : .name = discard_const_p(char, "result"),
10060 : .get = py_winreg_NotifyChangeKeyValue_get_result,
10061 : .set = py_winreg_NotifyChangeKeyValue_set_result,
10062 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
10063 : },
10064 : { .name = NULL }
10065 : };
10066 :
10067 0 : static PyObject *py_winreg_NotifyChangeKeyValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
10068 : {
10069 0 : PyObject *self = pytalloc_new(struct winreg_NotifyChangeKeyValue, type);
10070 0 : struct winreg_NotifyChangeKeyValue *_self = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(self);
10071 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
10072 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
10073 0 : return self;
10074 : }
10075 :
10076 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
10077 : {
10078 :
10079 :
10080 0 : return PyLong_FromLong(14);
10081 : }
10082 :
10083 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
10084 : {
10085 0 : const struct ndr_interface_call *call = NULL;
10086 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
10087 0 : PyObject *ret = NULL;
10088 0 : struct ndr_push *push = NULL;
10089 : DATA_BLOB blob;
10090 : enum ndr_err_code err;
10091 :
10092 0 : if (ndr_table_winreg.num_calls < 15) {
10093 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_NotifyChangeKeyValue_ndr_pack");
10094 0 : return NULL;
10095 : }
10096 0 : call = &ndr_table_winreg.calls[14];
10097 :
10098 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
10099 0 : if (push == NULL) {
10100 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10101 0 : return NULL;
10102 : }
10103 :
10104 0 : push->flags |= ndr_push_flags;
10105 :
10106 0 : err = call->ndr_push(push, ndr_inout_flags, object);
10107 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10108 0 : TALLOC_FREE(push);
10109 0 : PyErr_SetNdrError(err);
10110 0 : return NULL;
10111 : }
10112 0 : blob = ndr_push_blob(push);
10113 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
10114 0 : TALLOC_FREE(push);
10115 0 : return ret;
10116 : }
10117 :
10118 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10119 : {
10120 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10121 0 : PyObject *bigendian_obj = NULL;
10122 0 : PyObject *ndr64_obj = NULL;
10123 0 : uint32_t ndr_push_flags = 0;
10124 :
10125 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
10126 : discard_const_p(char *, kwnames),
10127 : &bigendian_obj,
10128 : &ndr64_obj)) {
10129 0 : return NULL;
10130 : }
10131 :
10132 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10133 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10134 : }
10135 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10136 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10137 : }
10138 :
10139 0 : return py_winreg_NotifyChangeKeyValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
10140 : }
10141 :
10142 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10143 : {
10144 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10145 0 : PyObject *bigendian_obj = NULL;
10146 0 : PyObject *ndr64_obj = NULL;
10147 0 : uint32_t ndr_push_flags = 0;
10148 :
10149 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
10150 : discard_const_p(char *, kwnames),
10151 : &bigendian_obj,
10152 : &ndr64_obj)) {
10153 0 : return NULL;
10154 : }
10155 :
10156 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10157 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10158 : }
10159 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10160 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10161 : }
10162 :
10163 0 : return py_winreg_NotifyChangeKeyValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
10164 : }
10165 :
10166 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
10167 : {
10168 0 : const struct ndr_interface_call *call = NULL;
10169 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
10170 0 : struct ndr_pull *pull = NULL;
10171 : enum ndr_err_code err;
10172 :
10173 0 : if (ndr_table_winreg.num_calls < 15) {
10174 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_NotifyChangeKeyValue_ndr_unpack");
10175 0 : return NULL;
10176 : }
10177 0 : call = &ndr_table_winreg.calls[14];
10178 :
10179 0 : pull = ndr_pull_init_blob(blob, object);
10180 0 : if (pull == NULL) {
10181 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10182 0 : return NULL;
10183 : }
10184 :
10185 0 : pull->flags |= ndr_pull_flags;
10186 :
10187 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
10188 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10189 0 : TALLOC_FREE(pull);
10190 0 : PyErr_SetNdrError(err);
10191 0 : return NULL;
10192 : }
10193 0 : if (!allow_remaining) {
10194 : uint32_t highest_ofs;
10195 :
10196 0 : if (pull->offset > pull->relative_highest_offset) {
10197 0 : highest_ofs = pull->offset;
10198 : } else {
10199 0 : highest_ofs = pull->relative_highest_offset;
10200 : }
10201 0 : if (highest_ofs < pull->data_size) {
10202 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
10203 : "not all bytes consumed ofs[%u] size[%u]",
10204 : highest_ofs, pull->data_size);
10205 0 : TALLOC_FREE(pull);
10206 0 : PyErr_SetNdrError(err);
10207 0 : return NULL;
10208 : }
10209 : }
10210 :
10211 0 : TALLOC_FREE(pull);
10212 0 : Py_RETURN_NONE;
10213 : }
10214 :
10215 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10216 : {
10217 : DATA_BLOB blob;
10218 0 : Py_ssize_t blob_length = 0;
10219 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10220 0 : PyObject *bigendian_obj = NULL;
10221 0 : PyObject *ndr64_obj = NULL;
10222 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10223 0 : PyObject *allow_remaining_obj = NULL;
10224 0 : bool allow_remaining = false;
10225 :
10226 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
10227 : discard_const_p(char *, kwnames),
10228 : &blob.data, &blob_length,
10229 : &bigendian_obj,
10230 : &ndr64_obj,
10231 : &allow_remaining_obj)) {
10232 0 : return NULL;
10233 : }
10234 0 : blob.length = blob_length;
10235 :
10236 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10237 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10238 : }
10239 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10240 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10241 : }
10242 :
10243 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10244 0 : allow_remaining = true;
10245 : }
10246 :
10247 0 : return py_winreg_NotifyChangeKeyValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
10248 : }
10249 :
10250 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10251 : {
10252 : DATA_BLOB blob;
10253 0 : Py_ssize_t blob_length = 0;
10254 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10255 0 : PyObject *bigendian_obj = NULL;
10256 0 : PyObject *ndr64_obj = NULL;
10257 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10258 0 : PyObject *allow_remaining_obj = NULL;
10259 0 : bool allow_remaining = false;
10260 :
10261 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
10262 : discard_const_p(char *, kwnames),
10263 : &blob.data, &blob_length,
10264 : &bigendian_obj,
10265 : &ndr64_obj,
10266 : &allow_remaining_obj)) {
10267 0 : return NULL;
10268 : }
10269 0 : blob.length = blob_length;
10270 :
10271 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10272 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10273 : }
10274 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10275 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10276 : }
10277 :
10278 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10279 0 : allow_remaining = true;
10280 : }
10281 :
10282 0 : return py_winreg_NotifyChangeKeyValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
10283 : }
10284 :
10285 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
10286 : {
10287 0 : const struct ndr_interface_call *call = NULL;
10288 0 : struct winreg_NotifyChangeKeyValue *object = (struct winreg_NotifyChangeKeyValue *)pytalloc_get_ptr(py_obj);
10289 : PyObject *ret;
10290 : char *retstr;
10291 :
10292 0 : if (ndr_table_winreg.num_calls < 15) {
10293 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_NotifyChangeKeyValue_ndr_print");
10294 0 : return NULL;
10295 : }
10296 0 : call = &ndr_table_winreg.calls[14];
10297 :
10298 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
10299 0 : ret = PyUnicode_FromString(retstr);
10300 0 : TALLOC_FREE(retstr);
10301 :
10302 0 : return ret;
10303 : }
10304 :
10305 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10306 : {
10307 0 : return py_winreg_NotifyChangeKeyValue_ndr_print(py_obj, "winreg_NotifyChangeKeyValue_in", NDR_IN);
10308 : }
10309 :
10310 0 : static PyObject *py_winreg_NotifyChangeKeyValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10311 : {
10312 0 : return py_winreg_NotifyChangeKeyValue_ndr_print(py_obj, "winreg_NotifyChangeKeyValue_out", NDR_OUT);
10313 : }
10314 :
10315 : static PyMethodDef py_winreg_NotifyChangeKeyValue_methods[] = {
10316 : { "opnum", (PyCFunction)py_winreg_NotifyChangeKeyValue_ndr_opnum, METH_NOARGS|METH_CLASS,
10317 : "winreg.NotifyChangeKeyValue.opnum() -> 14 (0x0e) " },
10318 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
10319 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
10320 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
10321 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
10322 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
10323 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
10324 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_NotifyChangeKeyValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
10325 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
10326 : { "__ndr_print_in__", (PyCFunction)py_winreg_NotifyChangeKeyValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
10327 : { "__ndr_print_out__", (PyCFunction)py_winreg_NotifyChangeKeyValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
10328 : { NULL, NULL, 0, NULL }
10329 : };
10330 :
10331 :
10332 : static PyTypeObject winreg_NotifyChangeKeyValue_Type = {
10333 : PyVarObject_HEAD_INIT(NULL, 0)
10334 : .tp_name = "winreg.NotifyChangeKeyValue",
10335 : .tp_getset = py_winreg_NotifyChangeKeyValue_getsetters,
10336 : .tp_methods = py_winreg_NotifyChangeKeyValue_methods,
10337 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
10338 : .tp_new = py_winreg_NotifyChangeKeyValue_new,
10339 : };
10340 :
10341 0 : static bool pack_py_winreg_NotifyChangeKeyValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_NotifyChangeKeyValue *r)
10342 : {
10343 : PyObject *py_handle;
10344 : PyObject *py_watch_subtree;
10345 : PyObject *py_notify_filter;
10346 : PyObject *py_unknown;
10347 : PyObject *py_string1;
10348 : PyObject *py_string2;
10349 : PyObject *py_unknown2;
10350 0 : const char *kwnames[] = {
10351 : "handle", "watch_subtree", "notify_filter", "unknown", "string1", "string2", "unknown2", NULL
10352 : };
10353 :
10354 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)) {
10355 0 : return false;
10356 : }
10357 :
10358 0 : if (py_handle == NULL) {
10359 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
10360 0 : return false;
10361 : }
10362 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
10363 0 : if (r->in.handle == NULL) {
10364 0 : PyErr_NoMemory();
10365 0 : return false;
10366 : }
10367 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
10368 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
10369 0 : PyErr_NoMemory();
10370 0 : return false;
10371 : }
10372 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
10373 0 : if (py_watch_subtree == NULL) {
10374 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.watch_subtree");
10375 0 : return false;
10376 : }
10377 : {
10378 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.watch_subtree));
10379 0 : if (PyLong_Check(py_watch_subtree)) {
10380 : unsigned long long test_var;
10381 0 : test_var = PyLong_AsUnsignedLongLong(py_watch_subtree);
10382 0 : if (PyErr_Occurred() != NULL) {
10383 0 : return false;
10384 : }
10385 0 : if (test_var > uint_max) {
10386 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10387 : PyLong_Type.tp_name, uint_max, test_var);
10388 0 : return false;
10389 : }
10390 0 : r->in.watch_subtree = test_var;
10391 : } else {
10392 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10393 : PyLong_Type.tp_name);
10394 0 : return false;
10395 : }
10396 : }
10397 0 : if (py_notify_filter == NULL) {
10398 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.notify_filter");
10399 0 : return false;
10400 : }
10401 : {
10402 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.notify_filter));
10403 0 : if (PyLong_Check(py_notify_filter)) {
10404 : unsigned long long test_var;
10405 0 : test_var = PyLong_AsUnsignedLongLong(py_notify_filter);
10406 0 : if (PyErr_Occurred() != NULL) {
10407 0 : return false;
10408 : }
10409 0 : if (test_var > uint_max) {
10410 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10411 : PyLong_Type.tp_name, uint_max, test_var);
10412 0 : return false;
10413 : }
10414 0 : r->in.notify_filter = test_var;
10415 : } else {
10416 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10417 : PyLong_Type.tp_name);
10418 0 : return false;
10419 : }
10420 : }
10421 0 : if (py_unknown == NULL) {
10422 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.unknown");
10423 0 : return false;
10424 : }
10425 : {
10426 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.unknown));
10427 0 : if (PyLong_Check(py_unknown)) {
10428 : unsigned long long test_var;
10429 0 : test_var = PyLong_AsUnsignedLongLong(py_unknown);
10430 0 : if (PyErr_Occurred() != NULL) {
10431 0 : return false;
10432 : }
10433 0 : if (test_var > uint_max) {
10434 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10435 : PyLong_Type.tp_name, uint_max, test_var);
10436 0 : return false;
10437 : }
10438 0 : r->in.unknown = test_var;
10439 : } else {
10440 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10441 : PyLong_Type.tp_name);
10442 0 : return false;
10443 : }
10444 : }
10445 0 : if (py_string1 == NULL) {
10446 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.string1");
10447 0 : return false;
10448 : }
10449 0 : PY_CHECK_TYPE(&winreg_String_Type, py_string1, return false;);
10450 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_string1)) == NULL) {
10451 0 : PyErr_NoMemory();
10452 0 : return false;
10453 : }
10454 0 : r->in.string1 = *(struct winreg_String *)pytalloc_get_ptr(py_string1);
10455 0 : if (py_string2 == NULL) {
10456 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.string2");
10457 0 : return false;
10458 : }
10459 0 : PY_CHECK_TYPE(&winreg_String_Type, py_string2, return false;);
10460 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_string2)) == NULL) {
10461 0 : PyErr_NoMemory();
10462 0 : return false;
10463 : }
10464 0 : r->in.string2 = *(struct winreg_String *)pytalloc_get_ptr(py_string2);
10465 0 : if (py_unknown2 == NULL) {
10466 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.unknown2");
10467 0 : return false;
10468 : }
10469 : {
10470 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.unknown2));
10471 0 : if (PyLong_Check(py_unknown2)) {
10472 : unsigned long long test_var;
10473 0 : test_var = PyLong_AsUnsignedLongLong(py_unknown2);
10474 0 : if (PyErr_Occurred() != NULL) {
10475 0 : return false;
10476 : }
10477 0 : if (test_var > uint_max) {
10478 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10479 : PyLong_Type.tp_name, uint_max, test_var);
10480 0 : return false;
10481 : }
10482 0 : r->in.unknown2 = test_var;
10483 : } else {
10484 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10485 : PyLong_Type.tp_name);
10486 0 : return false;
10487 : }
10488 : }
10489 0 : return true;
10490 : }
10491 :
10492 0 : static PyObject *unpack_py_winreg_NotifyChangeKeyValue_args_out(struct winreg_NotifyChangeKeyValue *r)
10493 : {
10494 : PyObject *result;
10495 0 : result = Py_None;
10496 0 : Py_INCREF(result);
10497 0 : if (!W_ERROR_IS_OK(r->out.result)) {
10498 0 : PyErr_SetWERROR(r->out.result);
10499 0 : return NULL;
10500 : }
10501 :
10502 0 : return result;
10503 : }
10504 :
10505 :
10506 0 : static PyObject *py_winreg_OpenKey_in_get_parent_handle(PyObject *obj, void *closure)
10507 : {
10508 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(obj);
10509 : PyObject *py_parent_handle;
10510 0 : if (object->in.parent_handle == NULL) {
10511 0 : Py_RETURN_NONE;
10512 : }
10513 0 : py_parent_handle = pytalloc_reference_ex(policy_handle_Type, object->in.parent_handle, object->in.parent_handle);
10514 0 : return py_parent_handle;
10515 : }
10516 :
10517 0 : static int py_winreg_OpenKey_in_set_parent_handle(PyObject *py_obj, PyObject *value, void *closure)
10518 : {
10519 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10520 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.parent_handle));
10521 0 : if (value == NULL) {
10522 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.parent_handle");
10523 0 : return -1;
10524 : }
10525 0 : object->in.parent_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.parent_handle);
10526 0 : if (object->in.parent_handle == NULL) {
10527 0 : PyErr_NoMemory();
10528 0 : return -1;
10529 : }
10530 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
10531 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
10532 0 : PyErr_NoMemory();
10533 0 : return -1;
10534 : }
10535 0 : object->in.parent_handle = (struct policy_handle *)pytalloc_get_ptr(value);
10536 0 : return 0;
10537 : }
10538 :
10539 0 : static PyObject *py_winreg_OpenKey_in_get_keyname(PyObject *obj, void *closure)
10540 : {
10541 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(obj);
10542 : PyObject *py_keyname;
10543 0 : py_keyname = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.keyname);
10544 0 : return py_keyname;
10545 : }
10546 :
10547 0 : static int py_winreg_OpenKey_in_set_keyname(PyObject *py_obj, PyObject *value, void *closure)
10548 : {
10549 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10550 0 : if (value == NULL) {
10551 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.keyname");
10552 0 : return -1;
10553 : }
10554 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
10555 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
10556 0 : PyErr_NoMemory();
10557 0 : return -1;
10558 : }
10559 0 : object->in.keyname = *(struct winreg_String *)pytalloc_get_ptr(value);
10560 0 : return 0;
10561 : }
10562 :
10563 0 : static PyObject *py_winreg_OpenKey_in_get_options(PyObject *obj, void *closure)
10564 : {
10565 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(obj);
10566 : PyObject *py_options;
10567 0 : py_options = PyLong_FromUnsignedLongLong((uint32_t)object->in.options);
10568 0 : return py_options;
10569 : }
10570 :
10571 0 : static int py_winreg_OpenKey_in_set_options(PyObject *py_obj, PyObject *value, void *closure)
10572 : {
10573 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10574 0 : if (value == NULL) {
10575 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.options");
10576 0 : return -1;
10577 : }
10578 : {
10579 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.options));
10580 0 : if (PyLong_Check(value)) {
10581 : unsigned long long test_var;
10582 0 : test_var = PyLong_AsUnsignedLongLong(value);
10583 0 : if (PyErr_Occurred() != NULL) {
10584 0 : return -1;
10585 : }
10586 0 : if (test_var > uint_max) {
10587 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10588 : PyLong_Type.tp_name, uint_max, test_var);
10589 0 : return -1;
10590 : }
10591 0 : object->in.options = test_var;
10592 : } else {
10593 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10594 : PyLong_Type.tp_name);
10595 0 : return -1;
10596 : }
10597 : }
10598 0 : return 0;
10599 : }
10600 :
10601 0 : static PyObject *py_winreg_OpenKey_in_get_access_mask(PyObject *obj, void *closure)
10602 : {
10603 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(obj);
10604 : PyObject *py_access_mask;
10605 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
10606 0 : return py_access_mask;
10607 : }
10608 :
10609 0 : static int py_winreg_OpenKey_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
10610 : {
10611 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10612 0 : if (value == NULL) {
10613 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
10614 0 : return -1;
10615 : }
10616 : {
10617 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
10618 0 : if (PyLong_Check(value)) {
10619 : unsigned long long test_var;
10620 0 : test_var = PyLong_AsUnsignedLongLong(value);
10621 0 : if (PyErr_Occurred() != NULL) {
10622 0 : return -1;
10623 : }
10624 0 : if (test_var > uint_max) {
10625 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
10626 : PyLong_Type.tp_name, uint_max, test_var);
10627 0 : return -1;
10628 : }
10629 0 : object->in.access_mask = test_var;
10630 : } else {
10631 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
10632 : PyLong_Type.tp_name);
10633 0 : return -1;
10634 : }
10635 : }
10636 0 : return 0;
10637 : }
10638 :
10639 0 : static PyObject *py_winreg_OpenKey_out_get_handle(PyObject *obj, void *closure)
10640 : {
10641 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(obj);
10642 : PyObject *py_handle;
10643 0 : if (object->out.handle == NULL) {
10644 0 : Py_RETURN_NONE;
10645 : }
10646 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
10647 0 : return py_handle;
10648 : }
10649 :
10650 0 : static int py_winreg_OpenKey_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
10651 : {
10652 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10653 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
10654 0 : if (value == NULL) {
10655 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
10656 0 : return -1;
10657 : }
10658 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
10659 0 : if (object->out.handle == NULL) {
10660 0 : PyErr_NoMemory();
10661 0 : return -1;
10662 : }
10663 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
10664 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
10665 0 : PyErr_NoMemory();
10666 0 : return -1;
10667 : }
10668 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
10669 0 : return 0;
10670 : }
10671 :
10672 0 : static PyObject *py_winreg_OpenKey_get_result(PyObject *obj, void *closure)
10673 : {
10674 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(obj);
10675 : PyObject *py_result;
10676 0 : py_result = PyErr_FromWERROR(object->out.result);
10677 0 : return py_result;
10678 : }
10679 :
10680 0 : static int py_winreg_OpenKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
10681 : {
10682 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10683 0 : if (value == NULL) {
10684 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
10685 0 : return -1;
10686 : }
10687 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
10688 0 : return 0;
10689 : }
10690 :
10691 : static PyGetSetDef py_winreg_OpenKey_getsetters[] = {
10692 : {
10693 : .name = discard_const_p(char, "in_parent_handle"),
10694 : .get = py_winreg_OpenKey_in_get_parent_handle,
10695 : .set = py_winreg_OpenKey_in_set_parent_handle,
10696 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
10697 : },
10698 : {
10699 : .name = discard_const_p(char, "in_keyname"),
10700 : .get = py_winreg_OpenKey_in_get_keyname,
10701 : .set = py_winreg_OpenKey_in_set_keyname,
10702 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
10703 : },
10704 : {
10705 : .name = discard_const_p(char, "in_options"),
10706 : .get = py_winreg_OpenKey_in_get_options,
10707 : .set = py_winreg_OpenKey_in_set_options,
10708 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_KeyOptions")
10709 : },
10710 : {
10711 : .name = discard_const_p(char, "in_access_mask"),
10712 : .get = py_winreg_OpenKey_in_get_access_mask,
10713 : .set = py_winreg_OpenKey_in_set_access_mask,
10714 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
10715 : },
10716 : {
10717 : .name = discard_const_p(char, "out_handle"),
10718 : .get = py_winreg_OpenKey_out_get_handle,
10719 : .set = py_winreg_OpenKey_out_set_handle,
10720 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
10721 : },
10722 : {
10723 : .name = discard_const_p(char, "result"),
10724 : .get = py_winreg_OpenKey_get_result,
10725 : .set = py_winreg_OpenKey_set_result,
10726 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
10727 : },
10728 : { .name = NULL }
10729 : };
10730 :
10731 0 : static PyObject *py_winreg_OpenKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
10732 : {
10733 0 : PyObject *self = pytalloc_new(struct winreg_OpenKey, type);
10734 0 : struct winreg_OpenKey *_self = (struct winreg_OpenKey *)pytalloc_get_ptr(self);
10735 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
10736 0 : _self->in.parent_handle = talloc_zero(mem_ctx, struct policy_handle);
10737 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
10738 0 : return self;
10739 : }
10740 :
10741 0 : static PyObject *py_winreg_OpenKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
10742 : {
10743 :
10744 :
10745 0 : return PyLong_FromLong(15);
10746 : }
10747 :
10748 0 : static PyObject *py_winreg_OpenKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
10749 : {
10750 0 : const struct ndr_interface_call *call = NULL;
10751 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10752 0 : PyObject *ret = NULL;
10753 0 : struct ndr_push *push = NULL;
10754 : DATA_BLOB blob;
10755 : enum ndr_err_code err;
10756 :
10757 0 : if (ndr_table_winreg.num_calls < 16) {
10758 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenKey_ndr_pack");
10759 0 : return NULL;
10760 : }
10761 0 : call = &ndr_table_winreg.calls[15];
10762 :
10763 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
10764 0 : if (push == NULL) {
10765 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10766 0 : return NULL;
10767 : }
10768 :
10769 0 : push->flags |= ndr_push_flags;
10770 :
10771 0 : err = call->ndr_push(push, ndr_inout_flags, object);
10772 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10773 0 : TALLOC_FREE(push);
10774 0 : PyErr_SetNdrError(err);
10775 0 : return NULL;
10776 : }
10777 0 : blob = ndr_push_blob(push);
10778 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
10779 0 : TALLOC_FREE(push);
10780 0 : return ret;
10781 : }
10782 :
10783 0 : static PyObject *py_winreg_OpenKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10784 : {
10785 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10786 0 : PyObject *bigendian_obj = NULL;
10787 0 : PyObject *ndr64_obj = NULL;
10788 0 : uint32_t ndr_push_flags = 0;
10789 :
10790 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
10791 : discard_const_p(char *, kwnames),
10792 : &bigendian_obj,
10793 : &ndr64_obj)) {
10794 0 : return NULL;
10795 : }
10796 :
10797 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10798 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10799 : }
10800 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10801 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10802 : }
10803 :
10804 0 : return py_winreg_OpenKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
10805 : }
10806 :
10807 0 : static PyObject *py_winreg_OpenKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10808 : {
10809 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
10810 0 : PyObject *bigendian_obj = NULL;
10811 0 : PyObject *ndr64_obj = NULL;
10812 0 : uint32_t ndr_push_flags = 0;
10813 :
10814 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
10815 : discard_const_p(char *, kwnames),
10816 : &bigendian_obj,
10817 : &ndr64_obj)) {
10818 0 : return NULL;
10819 : }
10820 :
10821 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10822 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
10823 : }
10824 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10825 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
10826 : }
10827 :
10828 0 : return py_winreg_OpenKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
10829 : }
10830 :
10831 0 : static PyObject *py_winreg_OpenKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
10832 : {
10833 0 : const struct ndr_interface_call *call = NULL;
10834 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10835 0 : struct ndr_pull *pull = NULL;
10836 : enum ndr_err_code err;
10837 :
10838 0 : if (ndr_table_winreg.num_calls < 16) {
10839 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenKey_ndr_unpack");
10840 0 : return NULL;
10841 : }
10842 0 : call = &ndr_table_winreg.calls[15];
10843 :
10844 0 : pull = ndr_pull_init_blob(blob, object);
10845 0 : if (pull == NULL) {
10846 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
10847 0 : return NULL;
10848 : }
10849 :
10850 0 : pull->flags |= ndr_pull_flags;
10851 :
10852 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
10853 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
10854 0 : TALLOC_FREE(pull);
10855 0 : PyErr_SetNdrError(err);
10856 0 : return NULL;
10857 : }
10858 0 : if (!allow_remaining) {
10859 : uint32_t highest_ofs;
10860 :
10861 0 : if (pull->offset > pull->relative_highest_offset) {
10862 0 : highest_ofs = pull->offset;
10863 : } else {
10864 0 : highest_ofs = pull->relative_highest_offset;
10865 : }
10866 0 : if (highest_ofs < pull->data_size) {
10867 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
10868 : "not all bytes consumed ofs[%u] size[%u]",
10869 : highest_ofs, pull->data_size);
10870 0 : TALLOC_FREE(pull);
10871 0 : PyErr_SetNdrError(err);
10872 0 : return NULL;
10873 : }
10874 : }
10875 :
10876 0 : TALLOC_FREE(pull);
10877 0 : Py_RETURN_NONE;
10878 : }
10879 :
10880 0 : static PyObject *py_winreg_OpenKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10881 : {
10882 : DATA_BLOB blob;
10883 0 : Py_ssize_t blob_length = 0;
10884 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10885 0 : PyObject *bigendian_obj = NULL;
10886 0 : PyObject *ndr64_obj = NULL;
10887 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10888 0 : PyObject *allow_remaining_obj = NULL;
10889 0 : bool allow_remaining = false;
10890 :
10891 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
10892 : discard_const_p(char *, kwnames),
10893 : &blob.data, &blob_length,
10894 : &bigendian_obj,
10895 : &ndr64_obj,
10896 : &allow_remaining_obj)) {
10897 0 : return NULL;
10898 : }
10899 0 : blob.length = blob_length;
10900 :
10901 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10902 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10903 : }
10904 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10905 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10906 : }
10907 :
10908 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10909 0 : allow_remaining = true;
10910 : }
10911 :
10912 0 : return py_winreg_OpenKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
10913 : }
10914 :
10915 0 : static PyObject *py_winreg_OpenKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
10916 : {
10917 : DATA_BLOB blob;
10918 0 : Py_ssize_t blob_length = 0;
10919 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
10920 0 : PyObject *bigendian_obj = NULL;
10921 0 : PyObject *ndr64_obj = NULL;
10922 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
10923 0 : PyObject *allow_remaining_obj = NULL;
10924 0 : bool allow_remaining = false;
10925 :
10926 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
10927 : discard_const_p(char *, kwnames),
10928 : &blob.data, &blob_length,
10929 : &bigendian_obj,
10930 : &ndr64_obj,
10931 : &allow_remaining_obj)) {
10932 0 : return NULL;
10933 : }
10934 0 : blob.length = blob_length;
10935 :
10936 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
10937 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
10938 : }
10939 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
10940 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
10941 : }
10942 :
10943 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
10944 0 : allow_remaining = true;
10945 : }
10946 :
10947 0 : return py_winreg_OpenKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
10948 : }
10949 :
10950 0 : static PyObject *py_winreg_OpenKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
10951 : {
10952 0 : const struct ndr_interface_call *call = NULL;
10953 0 : struct winreg_OpenKey *object = (struct winreg_OpenKey *)pytalloc_get_ptr(py_obj);
10954 : PyObject *ret;
10955 : char *retstr;
10956 :
10957 0 : if (ndr_table_winreg.num_calls < 16) {
10958 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenKey_ndr_print");
10959 0 : return NULL;
10960 : }
10961 0 : call = &ndr_table_winreg.calls[15];
10962 :
10963 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
10964 0 : ret = PyUnicode_FromString(retstr);
10965 0 : TALLOC_FREE(retstr);
10966 :
10967 0 : return ret;
10968 : }
10969 :
10970 0 : static PyObject *py_winreg_OpenKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10971 : {
10972 0 : return py_winreg_OpenKey_ndr_print(py_obj, "winreg_OpenKey_in", NDR_IN);
10973 : }
10974 :
10975 0 : static PyObject *py_winreg_OpenKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
10976 : {
10977 0 : return py_winreg_OpenKey_ndr_print(py_obj, "winreg_OpenKey_out", NDR_OUT);
10978 : }
10979 :
10980 : static PyMethodDef py_winreg_OpenKey_methods[] = {
10981 : { "opnum", (PyCFunction)py_winreg_OpenKey_ndr_opnum, METH_NOARGS|METH_CLASS,
10982 : "winreg.OpenKey.opnum() -> 15 (0x0f) " },
10983 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
10984 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
10985 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
10986 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
10987 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
10988 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
10989 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
10990 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
10991 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
10992 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
10993 : { NULL, NULL, 0, NULL }
10994 : };
10995 :
10996 :
10997 : static PyTypeObject winreg_OpenKey_Type = {
10998 : PyVarObject_HEAD_INIT(NULL, 0)
10999 : .tp_name = "winreg.OpenKey",
11000 : .tp_getset = py_winreg_OpenKey_getsetters,
11001 : .tp_methods = py_winreg_OpenKey_methods,
11002 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
11003 : .tp_new = py_winreg_OpenKey_new,
11004 : };
11005 :
11006 0 : static bool pack_py_winreg_OpenKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenKey *r)
11007 : {
11008 : PyObject *py_parent_handle;
11009 : PyObject *py_keyname;
11010 : PyObject *py_options;
11011 : PyObject *py_access_mask;
11012 0 : const char *kwnames[] = {
11013 : "parent_handle", "keyname", "options", "access_mask", NULL
11014 : };
11015 :
11016 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_OpenKey", discard_const_p(char *, kwnames), &py_parent_handle, &py_keyname, &py_options, &py_access_mask)) {
11017 0 : return false;
11018 : }
11019 :
11020 0 : if (py_parent_handle == NULL) {
11021 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.parent_handle");
11022 0 : return false;
11023 : }
11024 0 : r->in.parent_handle = talloc_ptrtype(r, r->in.parent_handle);
11025 0 : if (r->in.parent_handle == NULL) {
11026 0 : PyErr_NoMemory();
11027 0 : return false;
11028 : }
11029 0 : PY_CHECK_TYPE(policy_handle_Type, py_parent_handle, return false;);
11030 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_parent_handle)) == NULL) {
11031 0 : PyErr_NoMemory();
11032 0 : return false;
11033 : }
11034 0 : r->in.parent_handle = (struct policy_handle *)pytalloc_get_ptr(py_parent_handle);
11035 0 : if (py_keyname == NULL) {
11036 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.keyname");
11037 0 : return false;
11038 : }
11039 0 : PY_CHECK_TYPE(&winreg_String_Type, py_keyname, return false;);
11040 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_keyname)) == NULL) {
11041 0 : PyErr_NoMemory();
11042 0 : return false;
11043 : }
11044 0 : r->in.keyname = *(struct winreg_String *)pytalloc_get_ptr(py_keyname);
11045 0 : if (py_options == NULL) {
11046 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.options");
11047 0 : return false;
11048 : }
11049 : {
11050 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.options));
11051 0 : if (PyLong_Check(py_options)) {
11052 : unsigned long long test_var;
11053 0 : test_var = PyLong_AsUnsignedLongLong(py_options);
11054 0 : if (PyErr_Occurred() != NULL) {
11055 0 : return false;
11056 : }
11057 0 : if (test_var > uint_max) {
11058 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11059 : PyLong_Type.tp_name, uint_max, test_var);
11060 0 : return false;
11061 : }
11062 0 : r->in.options = test_var;
11063 : } else {
11064 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11065 : PyLong_Type.tp_name);
11066 0 : return false;
11067 : }
11068 : }
11069 0 : if (py_access_mask == NULL) {
11070 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
11071 0 : return false;
11072 : }
11073 : {
11074 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
11075 0 : if (PyLong_Check(py_access_mask)) {
11076 : unsigned long long test_var;
11077 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
11078 0 : if (PyErr_Occurred() != NULL) {
11079 0 : return false;
11080 : }
11081 0 : if (test_var > uint_max) {
11082 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11083 : PyLong_Type.tp_name, uint_max, test_var);
11084 0 : return false;
11085 : }
11086 0 : r->in.access_mask = test_var;
11087 : } else {
11088 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11089 : PyLong_Type.tp_name);
11090 0 : return false;
11091 : }
11092 : }
11093 0 : return true;
11094 : }
11095 :
11096 0 : static PyObject *unpack_py_winreg_OpenKey_args_out(struct winreg_OpenKey *r)
11097 : {
11098 : PyObject *result;
11099 : PyObject *py_handle;
11100 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
11101 0 : result = py_handle;
11102 0 : if (!W_ERROR_IS_OK(r->out.result)) {
11103 0 : PyErr_SetWERROR(r->out.result);
11104 0 : return NULL;
11105 : }
11106 :
11107 0 : return result;
11108 : }
11109 :
11110 :
11111 0 : static PyObject *py_winreg_QueryInfoKey_in_get_handle(PyObject *obj, void *closure)
11112 : {
11113 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11114 : PyObject *py_handle;
11115 0 : if (object->in.handle == NULL) {
11116 0 : Py_RETURN_NONE;
11117 : }
11118 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
11119 0 : return py_handle;
11120 : }
11121 :
11122 0 : static int py_winreg_QueryInfoKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
11123 : {
11124 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11125 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
11126 0 : if (value == NULL) {
11127 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
11128 0 : return -1;
11129 : }
11130 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
11131 0 : if (object->in.handle == NULL) {
11132 0 : PyErr_NoMemory();
11133 0 : return -1;
11134 : }
11135 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
11136 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
11137 0 : PyErr_NoMemory();
11138 0 : return -1;
11139 : }
11140 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
11141 0 : return 0;
11142 : }
11143 :
11144 0 : static PyObject *py_winreg_QueryInfoKey_in_get_classname(PyObject *obj, void *closure)
11145 : {
11146 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11147 : PyObject *py_classname;
11148 0 : if (object->in.classname == NULL) {
11149 0 : Py_RETURN_NONE;
11150 : }
11151 0 : py_classname = pytalloc_reference_ex(&winreg_String_Type, object->in.classname, object->in.classname);
11152 0 : return py_classname;
11153 : }
11154 :
11155 0 : static int py_winreg_QueryInfoKey_in_set_classname(PyObject *py_obj, PyObject *value, void *closure)
11156 : {
11157 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11158 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.classname));
11159 0 : if (value == NULL) {
11160 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.classname");
11161 0 : return -1;
11162 : }
11163 0 : object->in.classname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.classname);
11164 0 : if (object->in.classname == NULL) {
11165 0 : PyErr_NoMemory();
11166 0 : return -1;
11167 : }
11168 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
11169 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
11170 0 : PyErr_NoMemory();
11171 0 : return -1;
11172 : }
11173 0 : object->in.classname = (struct winreg_String *)pytalloc_get_ptr(value);
11174 0 : return 0;
11175 : }
11176 :
11177 0 : static PyObject *py_winreg_QueryInfoKey_out_get_classname(PyObject *obj, void *closure)
11178 : {
11179 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11180 : PyObject *py_classname;
11181 0 : if (object->out.classname == NULL) {
11182 0 : Py_RETURN_NONE;
11183 : }
11184 0 : py_classname = pytalloc_reference_ex(&winreg_String_Type, object->out.classname, object->out.classname);
11185 0 : return py_classname;
11186 : }
11187 :
11188 0 : static int py_winreg_QueryInfoKey_out_set_classname(PyObject *py_obj, PyObject *value, void *closure)
11189 : {
11190 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11191 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.classname));
11192 0 : if (value == NULL) {
11193 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.classname");
11194 0 : return -1;
11195 : }
11196 0 : object->out.classname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.classname);
11197 0 : if (object->out.classname == NULL) {
11198 0 : PyErr_NoMemory();
11199 0 : return -1;
11200 : }
11201 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
11202 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
11203 0 : PyErr_NoMemory();
11204 0 : return -1;
11205 : }
11206 0 : object->out.classname = (struct winreg_String *)pytalloc_get_ptr(value);
11207 0 : return 0;
11208 : }
11209 :
11210 0 : static PyObject *py_winreg_QueryInfoKey_out_get_num_subkeys(PyObject *obj, void *closure)
11211 : {
11212 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11213 : PyObject *py_num_subkeys;
11214 0 : if (object->out.num_subkeys == NULL) {
11215 0 : Py_RETURN_NONE;
11216 : }
11217 0 : py_num_subkeys = PyLong_FromUnsignedLongLong((uint32_t)*object->out.num_subkeys);
11218 0 : return py_num_subkeys;
11219 : }
11220 :
11221 0 : static int py_winreg_QueryInfoKey_out_set_num_subkeys(PyObject *py_obj, PyObject *value, void *closure)
11222 : {
11223 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11224 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.num_subkeys));
11225 0 : if (value == NULL) {
11226 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.num_subkeys");
11227 0 : return -1;
11228 : }
11229 0 : object->out.num_subkeys = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.num_subkeys);
11230 0 : if (object->out.num_subkeys == NULL) {
11231 0 : PyErr_NoMemory();
11232 0 : return -1;
11233 : }
11234 : {
11235 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.num_subkeys));
11236 0 : if (PyLong_Check(value)) {
11237 : unsigned long long test_var;
11238 0 : test_var = PyLong_AsUnsignedLongLong(value);
11239 0 : if (PyErr_Occurred() != NULL) {
11240 0 : return -1;
11241 : }
11242 0 : if (test_var > uint_max) {
11243 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11244 : PyLong_Type.tp_name, uint_max, test_var);
11245 0 : return -1;
11246 : }
11247 0 : *object->out.num_subkeys = test_var;
11248 : } else {
11249 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11250 : PyLong_Type.tp_name);
11251 0 : return -1;
11252 : }
11253 : }
11254 0 : return 0;
11255 : }
11256 :
11257 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_subkeylen(PyObject *obj, void *closure)
11258 : {
11259 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11260 : PyObject *py_max_subkeylen;
11261 0 : if (object->out.max_subkeylen == NULL) {
11262 0 : Py_RETURN_NONE;
11263 : }
11264 0 : py_max_subkeylen = PyLong_FromUnsignedLongLong((uint32_t)*object->out.max_subkeylen);
11265 0 : return py_max_subkeylen;
11266 : }
11267 :
11268 0 : static int py_winreg_QueryInfoKey_out_set_max_subkeylen(PyObject *py_obj, PyObject *value, void *closure)
11269 : {
11270 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11271 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_subkeylen));
11272 0 : if (value == NULL) {
11273 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.max_subkeylen");
11274 0 : return -1;
11275 : }
11276 0 : object->out.max_subkeylen = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_subkeylen);
11277 0 : if (object->out.max_subkeylen == NULL) {
11278 0 : PyErr_NoMemory();
11279 0 : return -1;
11280 : }
11281 : {
11282 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_subkeylen));
11283 0 : if (PyLong_Check(value)) {
11284 : unsigned long long test_var;
11285 0 : test_var = PyLong_AsUnsignedLongLong(value);
11286 0 : if (PyErr_Occurred() != NULL) {
11287 0 : return -1;
11288 : }
11289 0 : if (test_var > uint_max) {
11290 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11291 : PyLong_Type.tp_name, uint_max, test_var);
11292 0 : return -1;
11293 : }
11294 0 : *object->out.max_subkeylen = test_var;
11295 : } else {
11296 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11297 : PyLong_Type.tp_name);
11298 0 : return -1;
11299 : }
11300 : }
11301 0 : return 0;
11302 : }
11303 :
11304 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_classlen(PyObject *obj, void *closure)
11305 : {
11306 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11307 : PyObject *py_max_classlen;
11308 0 : if (object->out.max_classlen == NULL) {
11309 0 : Py_RETURN_NONE;
11310 : }
11311 0 : py_max_classlen = PyLong_FromUnsignedLongLong((uint32_t)*object->out.max_classlen);
11312 0 : return py_max_classlen;
11313 : }
11314 :
11315 0 : static int py_winreg_QueryInfoKey_out_set_max_classlen(PyObject *py_obj, PyObject *value, void *closure)
11316 : {
11317 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11318 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_classlen));
11319 0 : if (value == NULL) {
11320 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.max_classlen");
11321 0 : return -1;
11322 : }
11323 0 : object->out.max_classlen = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_classlen);
11324 0 : if (object->out.max_classlen == NULL) {
11325 0 : PyErr_NoMemory();
11326 0 : return -1;
11327 : }
11328 : {
11329 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_classlen));
11330 0 : if (PyLong_Check(value)) {
11331 : unsigned long long test_var;
11332 0 : test_var = PyLong_AsUnsignedLongLong(value);
11333 0 : if (PyErr_Occurred() != NULL) {
11334 0 : return -1;
11335 : }
11336 0 : if (test_var > uint_max) {
11337 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11338 : PyLong_Type.tp_name, uint_max, test_var);
11339 0 : return -1;
11340 : }
11341 0 : *object->out.max_classlen = test_var;
11342 : } else {
11343 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11344 : PyLong_Type.tp_name);
11345 0 : return -1;
11346 : }
11347 : }
11348 0 : return 0;
11349 : }
11350 :
11351 0 : static PyObject *py_winreg_QueryInfoKey_out_get_num_values(PyObject *obj, void *closure)
11352 : {
11353 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11354 : PyObject *py_num_values;
11355 0 : if (object->out.num_values == NULL) {
11356 0 : Py_RETURN_NONE;
11357 : }
11358 0 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)*object->out.num_values);
11359 0 : return py_num_values;
11360 : }
11361 :
11362 0 : static int py_winreg_QueryInfoKey_out_set_num_values(PyObject *py_obj, PyObject *value, void *closure)
11363 : {
11364 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11365 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.num_values));
11366 0 : if (value == NULL) {
11367 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.num_values");
11368 0 : return -1;
11369 : }
11370 0 : object->out.num_values = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.num_values);
11371 0 : if (object->out.num_values == NULL) {
11372 0 : PyErr_NoMemory();
11373 0 : return -1;
11374 : }
11375 : {
11376 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.num_values));
11377 0 : if (PyLong_Check(value)) {
11378 : unsigned long long test_var;
11379 0 : test_var = PyLong_AsUnsignedLongLong(value);
11380 0 : if (PyErr_Occurred() != NULL) {
11381 0 : return -1;
11382 : }
11383 0 : if (test_var > uint_max) {
11384 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11385 : PyLong_Type.tp_name, uint_max, test_var);
11386 0 : return -1;
11387 : }
11388 0 : *object->out.num_values = test_var;
11389 : } else {
11390 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11391 : PyLong_Type.tp_name);
11392 0 : return -1;
11393 : }
11394 : }
11395 0 : return 0;
11396 : }
11397 :
11398 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_valnamelen(PyObject *obj, void *closure)
11399 : {
11400 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11401 : PyObject *py_max_valnamelen;
11402 0 : if (object->out.max_valnamelen == NULL) {
11403 0 : Py_RETURN_NONE;
11404 : }
11405 0 : py_max_valnamelen = PyLong_FromUnsignedLongLong((uint32_t)*object->out.max_valnamelen);
11406 0 : return py_max_valnamelen;
11407 : }
11408 :
11409 0 : static int py_winreg_QueryInfoKey_out_set_max_valnamelen(PyObject *py_obj, PyObject *value, void *closure)
11410 : {
11411 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11412 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_valnamelen));
11413 0 : if (value == NULL) {
11414 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.max_valnamelen");
11415 0 : return -1;
11416 : }
11417 0 : object->out.max_valnamelen = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_valnamelen);
11418 0 : if (object->out.max_valnamelen == NULL) {
11419 0 : PyErr_NoMemory();
11420 0 : return -1;
11421 : }
11422 : {
11423 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_valnamelen));
11424 0 : if (PyLong_Check(value)) {
11425 : unsigned long long test_var;
11426 0 : test_var = PyLong_AsUnsignedLongLong(value);
11427 0 : if (PyErr_Occurred() != NULL) {
11428 0 : return -1;
11429 : }
11430 0 : if (test_var > uint_max) {
11431 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11432 : PyLong_Type.tp_name, uint_max, test_var);
11433 0 : return -1;
11434 : }
11435 0 : *object->out.max_valnamelen = test_var;
11436 : } else {
11437 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11438 : PyLong_Type.tp_name);
11439 0 : return -1;
11440 : }
11441 : }
11442 0 : return 0;
11443 : }
11444 :
11445 0 : static PyObject *py_winreg_QueryInfoKey_out_get_max_valbufsize(PyObject *obj, void *closure)
11446 : {
11447 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11448 : PyObject *py_max_valbufsize;
11449 0 : if (object->out.max_valbufsize == NULL) {
11450 0 : Py_RETURN_NONE;
11451 : }
11452 0 : py_max_valbufsize = PyLong_FromUnsignedLongLong((uint32_t)*object->out.max_valbufsize);
11453 0 : return py_max_valbufsize;
11454 : }
11455 :
11456 0 : static int py_winreg_QueryInfoKey_out_set_max_valbufsize(PyObject *py_obj, PyObject *value, void *closure)
11457 : {
11458 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11459 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.max_valbufsize));
11460 0 : if (value == NULL) {
11461 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.max_valbufsize");
11462 0 : return -1;
11463 : }
11464 0 : object->out.max_valbufsize = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.max_valbufsize);
11465 0 : if (object->out.max_valbufsize == NULL) {
11466 0 : PyErr_NoMemory();
11467 0 : return -1;
11468 : }
11469 : {
11470 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.max_valbufsize));
11471 0 : if (PyLong_Check(value)) {
11472 : unsigned long long test_var;
11473 0 : test_var = PyLong_AsUnsignedLongLong(value);
11474 0 : if (PyErr_Occurred() != NULL) {
11475 0 : return -1;
11476 : }
11477 0 : if (test_var > uint_max) {
11478 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11479 : PyLong_Type.tp_name, uint_max, test_var);
11480 0 : return -1;
11481 : }
11482 0 : *object->out.max_valbufsize = test_var;
11483 : } else {
11484 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11485 : PyLong_Type.tp_name);
11486 0 : return -1;
11487 : }
11488 : }
11489 0 : return 0;
11490 : }
11491 :
11492 0 : static PyObject *py_winreg_QueryInfoKey_out_get_secdescsize(PyObject *obj, void *closure)
11493 : {
11494 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11495 : PyObject *py_secdescsize;
11496 0 : if (object->out.secdescsize == NULL) {
11497 0 : Py_RETURN_NONE;
11498 : }
11499 0 : py_secdescsize = PyLong_FromUnsignedLongLong((uint32_t)*object->out.secdescsize);
11500 0 : return py_secdescsize;
11501 : }
11502 :
11503 0 : static int py_winreg_QueryInfoKey_out_set_secdescsize(PyObject *py_obj, PyObject *value, void *closure)
11504 : {
11505 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11506 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.secdescsize));
11507 0 : if (value == NULL) {
11508 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.secdescsize");
11509 0 : return -1;
11510 : }
11511 0 : object->out.secdescsize = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.secdescsize);
11512 0 : if (object->out.secdescsize == NULL) {
11513 0 : PyErr_NoMemory();
11514 0 : return -1;
11515 : }
11516 : {
11517 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.secdescsize));
11518 0 : if (PyLong_Check(value)) {
11519 : unsigned long long test_var;
11520 0 : test_var = PyLong_AsUnsignedLongLong(value);
11521 0 : if (PyErr_Occurred() != NULL) {
11522 0 : return -1;
11523 : }
11524 0 : if (test_var > uint_max) {
11525 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11526 : PyLong_Type.tp_name, uint_max, test_var);
11527 0 : return -1;
11528 : }
11529 0 : *object->out.secdescsize = test_var;
11530 : } else {
11531 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11532 : PyLong_Type.tp_name);
11533 0 : return -1;
11534 : }
11535 : }
11536 0 : return 0;
11537 : }
11538 :
11539 0 : static PyObject *py_winreg_QueryInfoKey_out_get_last_changed_time(PyObject *obj, void *closure)
11540 : {
11541 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11542 : PyObject *py_last_changed_time;
11543 0 : if (object->out.last_changed_time == NULL) {
11544 0 : Py_RETURN_NONE;
11545 : }
11546 0 : py_last_changed_time = PyLong_FromUnsignedLongLong(*object->out.last_changed_time);
11547 0 : return py_last_changed_time;
11548 : }
11549 :
11550 0 : static int py_winreg_QueryInfoKey_out_set_last_changed_time(PyObject *py_obj, PyObject *value, void *closure)
11551 : {
11552 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11553 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.last_changed_time));
11554 0 : if (value == NULL) {
11555 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.last_changed_time");
11556 0 : return -1;
11557 : }
11558 0 : object->out.last_changed_time = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.last_changed_time);
11559 0 : if (object->out.last_changed_time == NULL) {
11560 0 : PyErr_NoMemory();
11561 0 : return -1;
11562 : }
11563 : {
11564 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.last_changed_time));
11565 0 : if (PyLong_Check(value)) {
11566 : unsigned long long test_var;
11567 0 : test_var = PyLong_AsUnsignedLongLong(value);
11568 0 : if (PyErr_Occurred() != NULL) {
11569 0 : return -1;
11570 : }
11571 0 : if (test_var > uint_max) {
11572 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
11573 : PyLong_Type.tp_name, uint_max, test_var);
11574 0 : return -1;
11575 : }
11576 0 : *object->out.last_changed_time = test_var;
11577 : } else {
11578 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
11579 : PyLong_Type.tp_name);
11580 0 : return -1;
11581 : }
11582 : }
11583 0 : return 0;
11584 : }
11585 :
11586 0 : static PyObject *py_winreg_QueryInfoKey_get_result(PyObject *obj, void *closure)
11587 : {
11588 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(obj);
11589 : PyObject *py_result;
11590 0 : py_result = PyErr_FromWERROR(object->out.result);
11591 0 : return py_result;
11592 : }
11593 :
11594 0 : static int py_winreg_QueryInfoKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
11595 : {
11596 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11597 0 : if (value == NULL) {
11598 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
11599 0 : return -1;
11600 : }
11601 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
11602 0 : return 0;
11603 : }
11604 :
11605 : static PyGetSetDef py_winreg_QueryInfoKey_getsetters[] = {
11606 : {
11607 : .name = discard_const_p(char, "in_handle"),
11608 : .get = py_winreg_QueryInfoKey_in_get_handle,
11609 : .set = py_winreg_QueryInfoKey_in_set_handle,
11610 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
11611 : },
11612 : {
11613 : .name = discard_const_p(char, "in_classname"),
11614 : .get = py_winreg_QueryInfoKey_in_get_classname,
11615 : .set = py_winreg_QueryInfoKey_in_set_classname,
11616 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
11617 : },
11618 : {
11619 : .name = discard_const_p(char, "out_classname"),
11620 : .get = py_winreg_QueryInfoKey_out_get_classname,
11621 : .set = py_winreg_QueryInfoKey_out_set_classname,
11622 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
11623 : },
11624 : {
11625 : .name = discard_const_p(char, "out_num_subkeys"),
11626 : .get = py_winreg_QueryInfoKey_out_get_num_subkeys,
11627 : .set = py_winreg_QueryInfoKey_out_set_num_subkeys,
11628 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11629 : },
11630 : {
11631 : .name = discard_const_p(char, "out_max_subkeylen"),
11632 : .get = py_winreg_QueryInfoKey_out_get_max_subkeylen,
11633 : .set = py_winreg_QueryInfoKey_out_set_max_subkeylen,
11634 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11635 : },
11636 : {
11637 : .name = discard_const_p(char, "out_max_classlen"),
11638 : .get = py_winreg_QueryInfoKey_out_get_max_classlen,
11639 : .set = py_winreg_QueryInfoKey_out_set_max_classlen,
11640 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11641 : },
11642 : {
11643 : .name = discard_const_p(char, "out_num_values"),
11644 : .get = py_winreg_QueryInfoKey_out_get_num_values,
11645 : .set = py_winreg_QueryInfoKey_out_set_num_values,
11646 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11647 : },
11648 : {
11649 : .name = discard_const_p(char, "out_max_valnamelen"),
11650 : .get = py_winreg_QueryInfoKey_out_get_max_valnamelen,
11651 : .set = py_winreg_QueryInfoKey_out_set_max_valnamelen,
11652 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11653 : },
11654 : {
11655 : .name = discard_const_p(char, "out_max_valbufsize"),
11656 : .get = py_winreg_QueryInfoKey_out_get_max_valbufsize,
11657 : .set = py_winreg_QueryInfoKey_out_set_max_valbufsize,
11658 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11659 : },
11660 : {
11661 : .name = discard_const_p(char, "out_secdescsize"),
11662 : .get = py_winreg_QueryInfoKey_out_get_secdescsize,
11663 : .set = py_winreg_QueryInfoKey_out_set_secdescsize,
11664 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
11665 : },
11666 : {
11667 : .name = discard_const_p(char, "out_last_changed_time"),
11668 : .get = py_winreg_QueryInfoKey_out_get_last_changed_time,
11669 : .set = py_winreg_QueryInfoKey_out_set_last_changed_time,
11670 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
11671 : },
11672 : {
11673 : .name = discard_const_p(char, "result"),
11674 : .get = py_winreg_QueryInfoKey_get_result,
11675 : .set = py_winreg_QueryInfoKey_set_result,
11676 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
11677 : },
11678 : { .name = NULL }
11679 : };
11680 :
11681 0 : static PyObject *py_winreg_QueryInfoKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
11682 : {
11683 0 : PyObject *self = pytalloc_new(struct winreg_QueryInfoKey, type);
11684 0 : struct winreg_QueryInfoKey *_self = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(self);
11685 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
11686 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
11687 0 : _self->in.classname = talloc_zero(mem_ctx, struct winreg_String);
11688 0 : _self->out.classname = talloc_zero(mem_ctx, struct winreg_String);
11689 0 : _self->out.num_subkeys = talloc_zero(mem_ctx, uint32_t);
11690 0 : _self->out.max_subkeylen = talloc_zero(mem_ctx, uint32_t);
11691 0 : _self->out.max_classlen = talloc_zero(mem_ctx, uint32_t);
11692 0 : _self->out.num_values = talloc_zero(mem_ctx, uint32_t);
11693 0 : _self->out.max_valnamelen = talloc_zero(mem_ctx, uint32_t);
11694 0 : _self->out.max_valbufsize = talloc_zero(mem_ctx, uint32_t);
11695 0 : _self->out.secdescsize = talloc_zero(mem_ctx, uint32_t);
11696 0 : _self->out.last_changed_time = talloc_zero(mem_ctx, NTTIME);
11697 0 : return self;
11698 : }
11699 :
11700 0 : static PyObject *py_winreg_QueryInfoKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
11701 : {
11702 :
11703 :
11704 0 : return PyLong_FromLong(16);
11705 : }
11706 :
11707 0 : static PyObject *py_winreg_QueryInfoKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
11708 : {
11709 0 : const struct ndr_interface_call *call = NULL;
11710 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11711 0 : PyObject *ret = NULL;
11712 0 : struct ndr_push *push = NULL;
11713 : DATA_BLOB blob;
11714 : enum ndr_err_code err;
11715 :
11716 0 : if (ndr_table_winreg.num_calls < 17) {
11717 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryInfoKey_ndr_pack");
11718 0 : return NULL;
11719 : }
11720 0 : call = &ndr_table_winreg.calls[16];
11721 :
11722 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
11723 0 : if (push == NULL) {
11724 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
11725 0 : return NULL;
11726 : }
11727 :
11728 0 : push->flags |= ndr_push_flags;
11729 :
11730 0 : err = call->ndr_push(push, ndr_inout_flags, object);
11731 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
11732 0 : TALLOC_FREE(push);
11733 0 : PyErr_SetNdrError(err);
11734 0 : return NULL;
11735 : }
11736 0 : blob = ndr_push_blob(push);
11737 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
11738 0 : TALLOC_FREE(push);
11739 0 : return ret;
11740 : }
11741 :
11742 0 : static PyObject *py_winreg_QueryInfoKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11743 : {
11744 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
11745 0 : PyObject *bigendian_obj = NULL;
11746 0 : PyObject *ndr64_obj = NULL;
11747 0 : uint32_t ndr_push_flags = 0;
11748 :
11749 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
11750 : discard_const_p(char *, kwnames),
11751 : &bigendian_obj,
11752 : &ndr64_obj)) {
11753 0 : return NULL;
11754 : }
11755 :
11756 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11757 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
11758 : }
11759 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11760 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
11761 : }
11762 :
11763 0 : return py_winreg_QueryInfoKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
11764 : }
11765 :
11766 0 : static PyObject *py_winreg_QueryInfoKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11767 : {
11768 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
11769 0 : PyObject *bigendian_obj = NULL;
11770 0 : PyObject *ndr64_obj = NULL;
11771 0 : uint32_t ndr_push_flags = 0;
11772 :
11773 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
11774 : discard_const_p(char *, kwnames),
11775 : &bigendian_obj,
11776 : &ndr64_obj)) {
11777 0 : return NULL;
11778 : }
11779 :
11780 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11781 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
11782 : }
11783 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11784 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
11785 : }
11786 :
11787 0 : return py_winreg_QueryInfoKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
11788 : }
11789 :
11790 0 : static PyObject *py_winreg_QueryInfoKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
11791 : {
11792 0 : const struct ndr_interface_call *call = NULL;
11793 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11794 0 : struct ndr_pull *pull = NULL;
11795 : enum ndr_err_code err;
11796 :
11797 0 : if (ndr_table_winreg.num_calls < 17) {
11798 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryInfoKey_ndr_unpack");
11799 0 : return NULL;
11800 : }
11801 0 : call = &ndr_table_winreg.calls[16];
11802 :
11803 0 : pull = ndr_pull_init_blob(blob, object);
11804 0 : if (pull == NULL) {
11805 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
11806 0 : return NULL;
11807 : }
11808 :
11809 0 : pull->flags |= ndr_pull_flags;
11810 :
11811 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
11812 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
11813 0 : TALLOC_FREE(pull);
11814 0 : PyErr_SetNdrError(err);
11815 0 : return NULL;
11816 : }
11817 0 : if (!allow_remaining) {
11818 : uint32_t highest_ofs;
11819 :
11820 0 : if (pull->offset > pull->relative_highest_offset) {
11821 0 : highest_ofs = pull->offset;
11822 : } else {
11823 0 : highest_ofs = pull->relative_highest_offset;
11824 : }
11825 0 : if (highest_ofs < pull->data_size) {
11826 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
11827 : "not all bytes consumed ofs[%u] size[%u]",
11828 : highest_ofs, pull->data_size);
11829 0 : TALLOC_FREE(pull);
11830 0 : PyErr_SetNdrError(err);
11831 0 : return NULL;
11832 : }
11833 : }
11834 :
11835 0 : TALLOC_FREE(pull);
11836 0 : Py_RETURN_NONE;
11837 : }
11838 :
11839 0 : static PyObject *py_winreg_QueryInfoKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11840 : {
11841 : DATA_BLOB blob;
11842 0 : Py_ssize_t blob_length = 0;
11843 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
11844 0 : PyObject *bigendian_obj = NULL;
11845 0 : PyObject *ndr64_obj = NULL;
11846 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
11847 0 : PyObject *allow_remaining_obj = NULL;
11848 0 : bool allow_remaining = false;
11849 :
11850 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
11851 : discard_const_p(char *, kwnames),
11852 : &blob.data, &blob_length,
11853 : &bigendian_obj,
11854 : &ndr64_obj,
11855 : &allow_remaining_obj)) {
11856 0 : return NULL;
11857 : }
11858 0 : blob.length = blob_length;
11859 :
11860 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11861 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
11862 : }
11863 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11864 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
11865 : }
11866 :
11867 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
11868 0 : allow_remaining = true;
11869 : }
11870 :
11871 0 : return py_winreg_QueryInfoKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
11872 : }
11873 :
11874 0 : static PyObject *py_winreg_QueryInfoKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
11875 : {
11876 : DATA_BLOB blob;
11877 0 : Py_ssize_t blob_length = 0;
11878 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
11879 0 : PyObject *bigendian_obj = NULL;
11880 0 : PyObject *ndr64_obj = NULL;
11881 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
11882 0 : PyObject *allow_remaining_obj = NULL;
11883 0 : bool allow_remaining = false;
11884 :
11885 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
11886 : discard_const_p(char *, kwnames),
11887 : &blob.data, &blob_length,
11888 : &bigendian_obj,
11889 : &ndr64_obj,
11890 : &allow_remaining_obj)) {
11891 0 : return NULL;
11892 : }
11893 0 : blob.length = blob_length;
11894 :
11895 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
11896 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
11897 : }
11898 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
11899 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
11900 : }
11901 :
11902 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
11903 0 : allow_remaining = true;
11904 : }
11905 :
11906 0 : return py_winreg_QueryInfoKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
11907 : }
11908 :
11909 0 : static PyObject *py_winreg_QueryInfoKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
11910 : {
11911 0 : const struct ndr_interface_call *call = NULL;
11912 0 : struct winreg_QueryInfoKey *object = (struct winreg_QueryInfoKey *)pytalloc_get_ptr(py_obj);
11913 : PyObject *ret;
11914 : char *retstr;
11915 :
11916 0 : if (ndr_table_winreg.num_calls < 17) {
11917 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryInfoKey_ndr_print");
11918 0 : return NULL;
11919 : }
11920 0 : call = &ndr_table_winreg.calls[16];
11921 :
11922 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
11923 0 : ret = PyUnicode_FromString(retstr);
11924 0 : TALLOC_FREE(retstr);
11925 :
11926 0 : return ret;
11927 : }
11928 :
11929 0 : static PyObject *py_winreg_QueryInfoKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
11930 : {
11931 0 : return py_winreg_QueryInfoKey_ndr_print(py_obj, "winreg_QueryInfoKey_in", NDR_IN);
11932 : }
11933 :
11934 0 : static PyObject *py_winreg_QueryInfoKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
11935 : {
11936 0 : return py_winreg_QueryInfoKey_ndr_print(py_obj, "winreg_QueryInfoKey_out", NDR_OUT);
11937 : }
11938 :
11939 : static PyMethodDef py_winreg_QueryInfoKey_methods[] = {
11940 : { "opnum", (PyCFunction)py_winreg_QueryInfoKey_ndr_opnum, METH_NOARGS|METH_CLASS,
11941 : "winreg.QueryInfoKey.opnum() -> 16 (0x10) " },
11942 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
11943 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
11944 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
11945 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
11946 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
11947 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
11948 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryInfoKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
11949 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
11950 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryInfoKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
11951 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryInfoKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
11952 : { NULL, NULL, 0, NULL }
11953 : };
11954 :
11955 :
11956 : static PyTypeObject winreg_QueryInfoKey_Type = {
11957 : PyVarObject_HEAD_INIT(NULL, 0)
11958 : .tp_name = "winreg.QueryInfoKey",
11959 : .tp_getset = py_winreg_QueryInfoKey_getsetters,
11960 : .tp_methods = py_winreg_QueryInfoKey_methods,
11961 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
11962 : .tp_new = py_winreg_QueryInfoKey_new,
11963 : };
11964 :
11965 1 : static bool pack_py_winreg_QueryInfoKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryInfoKey *r)
11966 : {
11967 : PyObject *py_handle;
11968 : PyObject *py_classname;
11969 1 : const char *kwnames[] = {
11970 : "handle", "classname", NULL
11971 : };
11972 :
11973 1 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_QueryInfoKey", discard_const_p(char *, kwnames), &py_handle, &py_classname)) {
11974 0 : return false;
11975 : }
11976 :
11977 1 : if (py_handle == NULL) {
11978 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
11979 0 : return false;
11980 : }
11981 1 : r->in.handle = talloc_ptrtype(r, r->in.handle);
11982 1 : if (r->in.handle == NULL) {
11983 0 : PyErr_NoMemory();
11984 0 : return false;
11985 : }
11986 1 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
11987 1 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
11988 0 : PyErr_NoMemory();
11989 0 : return false;
11990 : }
11991 1 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
11992 1 : if (py_classname == NULL) {
11993 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.classname");
11994 0 : return false;
11995 : }
11996 1 : r->in.classname = talloc_ptrtype(r, r->in.classname);
11997 1 : if (r->in.classname == NULL) {
11998 0 : PyErr_NoMemory();
11999 0 : return false;
12000 : }
12001 1 : PY_CHECK_TYPE(&winreg_String_Type, py_classname, return false;);
12002 1 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_classname)) == NULL) {
12003 0 : PyErr_NoMemory();
12004 0 : return false;
12005 : }
12006 1 : r->in.classname = (struct winreg_String *)pytalloc_get_ptr(py_classname);
12007 1 : return true;
12008 : }
12009 :
12010 1 : static PyObject *unpack_py_winreg_QueryInfoKey_args_out(struct winreg_QueryInfoKey *r)
12011 : {
12012 : PyObject *result;
12013 : PyObject *py_classname;
12014 : PyObject *py_num_subkeys;
12015 : PyObject *py_max_subkeylen;
12016 : PyObject *py_max_classlen;
12017 : PyObject *py_num_values;
12018 : PyObject *py_max_valnamelen;
12019 : PyObject *py_max_valbufsize;
12020 : PyObject *py_secdescsize;
12021 : PyObject *py_last_changed_time;
12022 1 : result = PyTuple_New(9);
12023 1 : py_classname = pytalloc_reference_ex(&winreg_String_Type, r->out.classname, r->out.classname);
12024 1 : PyTuple_SetItem(result, 0, py_classname);
12025 1 : py_num_subkeys = PyLong_FromUnsignedLongLong((uint32_t)*r->out.num_subkeys);
12026 1 : PyTuple_SetItem(result, 1, py_num_subkeys);
12027 1 : py_max_subkeylen = PyLong_FromUnsignedLongLong((uint32_t)*r->out.max_subkeylen);
12028 1 : PyTuple_SetItem(result, 2, py_max_subkeylen);
12029 1 : py_max_classlen = PyLong_FromUnsignedLongLong((uint32_t)*r->out.max_classlen);
12030 1 : PyTuple_SetItem(result, 3, py_max_classlen);
12031 1 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)*r->out.num_values);
12032 1 : PyTuple_SetItem(result, 4, py_num_values);
12033 1 : py_max_valnamelen = PyLong_FromUnsignedLongLong((uint32_t)*r->out.max_valnamelen);
12034 1 : PyTuple_SetItem(result, 5, py_max_valnamelen);
12035 1 : py_max_valbufsize = PyLong_FromUnsignedLongLong((uint32_t)*r->out.max_valbufsize);
12036 1 : PyTuple_SetItem(result, 6, py_max_valbufsize);
12037 1 : py_secdescsize = PyLong_FromUnsignedLongLong((uint32_t)*r->out.secdescsize);
12038 1 : PyTuple_SetItem(result, 7, py_secdescsize);
12039 1 : py_last_changed_time = PyLong_FromUnsignedLongLong(*r->out.last_changed_time);
12040 1 : PyTuple_SetItem(result, 8, py_last_changed_time);
12041 1 : if (!W_ERROR_IS_OK(r->out.result)) {
12042 0 : PyErr_SetWERROR(r->out.result);
12043 0 : return NULL;
12044 : }
12045 :
12046 1 : return result;
12047 : }
12048 :
12049 :
12050 0 : static PyObject *py_winreg_QueryValue_in_get_handle(PyObject *obj, void *closure)
12051 : {
12052 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12053 : PyObject *py_handle;
12054 0 : if (object->in.handle == NULL) {
12055 0 : Py_RETURN_NONE;
12056 : }
12057 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
12058 0 : return py_handle;
12059 : }
12060 :
12061 0 : static int py_winreg_QueryValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
12062 : {
12063 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12064 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
12065 0 : if (value == NULL) {
12066 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
12067 0 : return -1;
12068 : }
12069 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
12070 0 : if (object->in.handle == NULL) {
12071 0 : PyErr_NoMemory();
12072 0 : return -1;
12073 : }
12074 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
12075 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
12076 0 : PyErr_NoMemory();
12077 0 : return -1;
12078 : }
12079 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
12080 0 : return 0;
12081 : }
12082 :
12083 0 : static PyObject *py_winreg_QueryValue_in_get_value_name(PyObject *obj, void *closure)
12084 : {
12085 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12086 : PyObject *py_value_name;
12087 0 : if (object->in.value_name == NULL) {
12088 0 : Py_RETURN_NONE;
12089 : }
12090 0 : py_value_name = pytalloc_reference_ex(&winreg_String_Type, object->in.value_name, object->in.value_name);
12091 0 : return py_value_name;
12092 : }
12093 :
12094 0 : static int py_winreg_QueryValue_in_set_value_name(PyObject *py_obj, PyObject *value, void *closure)
12095 : {
12096 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12097 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.value_name));
12098 0 : if (value == NULL) {
12099 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.value_name");
12100 0 : return -1;
12101 : }
12102 0 : object->in.value_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.value_name);
12103 0 : if (object->in.value_name == NULL) {
12104 0 : PyErr_NoMemory();
12105 0 : return -1;
12106 : }
12107 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
12108 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
12109 0 : PyErr_NoMemory();
12110 0 : return -1;
12111 : }
12112 0 : object->in.value_name = (struct winreg_String *)pytalloc_get_ptr(value);
12113 0 : return 0;
12114 : }
12115 :
12116 0 : static PyObject *py_winreg_QueryValue_in_get_type(PyObject *obj, void *closure)
12117 : {
12118 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12119 : PyObject *py_type;
12120 0 : if (object->in.type == NULL) {
12121 0 : Py_RETURN_NONE;
12122 : }
12123 0 : if (object->in.type == NULL) {
12124 0 : py_type = Py_None;
12125 0 : Py_INCREF(py_type);
12126 : } else {
12127 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)*object->in.type);
12128 : }
12129 0 : return py_type;
12130 : }
12131 :
12132 0 : static int py_winreg_QueryValue_in_set_type(PyObject *py_obj, PyObject *value, void *closure)
12133 : {
12134 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12135 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.type));
12136 0 : if (value == NULL) {
12137 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.type");
12138 0 : return -1;
12139 : }
12140 0 : if (value == Py_None) {
12141 0 : object->in.type = NULL;
12142 : } else {
12143 0 : object->in.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.type);
12144 0 : if (object->in.type == NULL) {
12145 0 : PyErr_NoMemory();
12146 0 : return -1;
12147 : }
12148 : {
12149 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.type));
12150 0 : if (PyLong_Check(value)) {
12151 : unsigned long long test_var;
12152 0 : test_var = PyLong_AsUnsignedLongLong(value);
12153 0 : if (PyErr_Occurred() != NULL) {
12154 0 : return -1;
12155 : }
12156 0 : if (test_var > uint_max) {
12157 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12158 : PyLong_Type.tp_name, uint_max, test_var);
12159 0 : return -1;
12160 : }
12161 0 : *object->in.type = test_var;
12162 : } else {
12163 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12164 : PyLong_Type.tp_name);
12165 0 : return -1;
12166 : }
12167 : }
12168 : }
12169 0 : return 0;
12170 : }
12171 :
12172 0 : static PyObject *py_winreg_QueryValue_out_get_type(PyObject *obj, void *closure)
12173 : {
12174 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12175 : PyObject *py_type;
12176 0 : if (object->out.type == NULL) {
12177 0 : Py_RETURN_NONE;
12178 : }
12179 0 : if (object->out.type == NULL) {
12180 0 : py_type = Py_None;
12181 0 : Py_INCREF(py_type);
12182 : } else {
12183 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)*object->out.type);
12184 : }
12185 0 : return py_type;
12186 : }
12187 :
12188 0 : static int py_winreg_QueryValue_out_set_type(PyObject *py_obj, PyObject *value, void *closure)
12189 : {
12190 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12191 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.type));
12192 0 : if (value == NULL) {
12193 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.type");
12194 0 : return -1;
12195 : }
12196 0 : if (value == Py_None) {
12197 0 : object->out.type = NULL;
12198 : } else {
12199 0 : object->out.type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.type);
12200 0 : if (object->out.type == NULL) {
12201 0 : PyErr_NoMemory();
12202 0 : return -1;
12203 : }
12204 : {
12205 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.type));
12206 0 : if (PyLong_Check(value)) {
12207 : unsigned long long test_var;
12208 0 : test_var = PyLong_AsUnsignedLongLong(value);
12209 0 : if (PyErr_Occurred() != NULL) {
12210 0 : return -1;
12211 : }
12212 0 : if (test_var > uint_max) {
12213 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12214 : PyLong_Type.tp_name, uint_max, test_var);
12215 0 : return -1;
12216 : }
12217 0 : *object->out.type = test_var;
12218 : } else {
12219 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12220 : PyLong_Type.tp_name);
12221 0 : return -1;
12222 : }
12223 : }
12224 : }
12225 0 : return 0;
12226 : }
12227 :
12228 0 : static PyObject *py_winreg_QueryValue_in_get_data(PyObject *obj, void *closure)
12229 : {
12230 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12231 : PyObject *py_data;
12232 0 : if (object->in.data == NULL) {
12233 0 : Py_RETURN_NONE;
12234 : }
12235 0 : if (object->in.data == NULL) {
12236 0 : py_data = Py_None;
12237 0 : Py_INCREF(py_data);
12238 : } else {
12239 0 : py_data = PyList_New(object->in.data_length?*object->in.data_length:0);
12240 0 : if (py_data == NULL) {
12241 0 : return NULL;
12242 : }
12243 : {
12244 : int data_cntr_1;
12245 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->in.data_length?*object->in.data_length:0); data_cntr_1++) {
12246 : PyObject *py_data_1;
12247 0 : py_data_1 = PyLong_FromLong((uint16_t)object->in.data[data_cntr_1]);
12248 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
12249 : }
12250 : }
12251 : }
12252 0 : return py_data;
12253 : }
12254 :
12255 0 : static int py_winreg_QueryValue_in_set_data(PyObject *py_obj, PyObject *value, void *closure)
12256 : {
12257 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12258 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data));
12259 0 : if (value == NULL) {
12260 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data");
12261 0 : return -1;
12262 : }
12263 0 : if (value == Py_None) {
12264 0 : object->in.data = NULL;
12265 : } else {
12266 0 : object->in.data = NULL;
12267 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
12268 : {
12269 : int data_cntr_1;
12270 0 : object->in.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data, PyList_GET_SIZE(value));
12271 0 : if (!object->in.data) { return -1;; }
12272 0 : talloc_set_name_const(object->in.data, "ARRAY: object->in.data");
12273 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
12274 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
12275 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data[data_cntr_1]");
12276 0 : return -1;
12277 : }
12278 : {
12279 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.data[data_cntr_1]));
12280 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
12281 : unsigned long long test_var;
12282 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
12283 0 : if (PyErr_Occurred() != NULL) {
12284 0 : return -1;
12285 : }
12286 0 : if (test_var > uint_max) {
12287 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12288 : PyLong_Type.tp_name, uint_max, test_var);
12289 0 : return -1;
12290 : }
12291 0 : object->in.data[data_cntr_1] = test_var;
12292 : } else {
12293 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12294 : PyLong_Type.tp_name);
12295 0 : return -1;
12296 : }
12297 : }
12298 : }
12299 : }
12300 : }
12301 0 : return 0;
12302 : }
12303 :
12304 0 : static PyObject *py_winreg_QueryValue_out_get_data(PyObject *obj, void *closure)
12305 : {
12306 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12307 : PyObject *py_data;
12308 0 : if (object->out.data == NULL) {
12309 0 : Py_RETURN_NONE;
12310 : }
12311 0 : if (object->out.data == NULL) {
12312 0 : py_data = Py_None;
12313 0 : Py_INCREF(py_data);
12314 : } else {
12315 0 : py_data = PyList_New(object->out.data_length?*object->out.data_length:0);
12316 0 : if (py_data == NULL) {
12317 0 : return NULL;
12318 : }
12319 : {
12320 : int data_cntr_1;
12321 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->out.data_length?*object->out.data_length:0); data_cntr_1++) {
12322 : PyObject *py_data_1;
12323 0 : py_data_1 = PyLong_FromLong((uint16_t)object->out.data[data_cntr_1]);
12324 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
12325 : }
12326 : }
12327 : }
12328 0 : return py_data;
12329 : }
12330 :
12331 0 : static int py_winreg_QueryValue_out_set_data(PyObject *py_obj, PyObject *value, void *closure)
12332 : {
12333 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12334 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.data));
12335 0 : if (value == NULL) {
12336 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.data");
12337 0 : return -1;
12338 : }
12339 0 : if (value == Py_None) {
12340 0 : object->out.data = NULL;
12341 : } else {
12342 0 : object->out.data = NULL;
12343 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
12344 : {
12345 : int data_cntr_1;
12346 0 : object->out.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data, PyList_GET_SIZE(value));
12347 0 : if (!object->out.data) { return -1;; }
12348 0 : talloc_set_name_const(object->out.data, "ARRAY: object->out.data");
12349 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
12350 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
12351 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.data[data_cntr_1]");
12352 0 : return -1;
12353 : }
12354 : {
12355 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.data[data_cntr_1]));
12356 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
12357 : unsigned long long test_var;
12358 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
12359 0 : if (PyErr_Occurred() != NULL) {
12360 0 : return -1;
12361 : }
12362 0 : if (test_var > uint_max) {
12363 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12364 : PyLong_Type.tp_name, uint_max, test_var);
12365 0 : return -1;
12366 : }
12367 0 : object->out.data[data_cntr_1] = test_var;
12368 : } else {
12369 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12370 : PyLong_Type.tp_name);
12371 0 : return -1;
12372 : }
12373 : }
12374 : }
12375 : }
12376 : }
12377 0 : return 0;
12378 : }
12379 :
12380 0 : static PyObject *py_winreg_QueryValue_in_get_data_size(PyObject *obj, void *closure)
12381 : {
12382 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12383 : PyObject *py_data_size;
12384 0 : if (object->in.data_size == NULL) {
12385 0 : Py_RETURN_NONE;
12386 : }
12387 0 : if (object->in.data_size == NULL) {
12388 0 : py_data_size = Py_None;
12389 0 : Py_INCREF(py_data_size);
12390 : } else {
12391 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)*object->in.data_size);
12392 : }
12393 0 : return py_data_size;
12394 : }
12395 :
12396 0 : static int py_winreg_QueryValue_in_set_data_size(PyObject *py_obj, PyObject *value, void *closure)
12397 : {
12398 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12399 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data_size));
12400 0 : if (value == NULL) {
12401 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data_size");
12402 0 : return -1;
12403 : }
12404 0 : if (value == Py_None) {
12405 0 : object->in.data_size = NULL;
12406 : } else {
12407 0 : object->in.data_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data_size);
12408 0 : if (object->in.data_size == NULL) {
12409 0 : PyErr_NoMemory();
12410 0 : return -1;
12411 : }
12412 : {
12413 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.data_size));
12414 0 : if (PyLong_Check(value)) {
12415 : unsigned long long test_var;
12416 0 : test_var = PyLong_AsUnsignedLongLong(value);
12417 0 : if (PyErr_Occurred() != NULL) {
12418 0 : return -1;
12419 : }
12420 0 : if (test_var > uint_max) {
12421 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12422 : PyLong_Type.tp_name, uint_max, test_var);
12423 0 : return -1;
12424 : }
12425 0 : *object->in.data_size = test_var;
12426 : } else {
12427 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12428 : PyLong_Type.tp_name);
12429 0 : return -1;
12430 : }
12431 : }
12432 : }
12433 0 : return 0;
12434 : }
12435 :
12436 0 : static PyObject *py_winreg_QueryValue_out_get_data_size(PyObject *obj, void *closure)
12437 : {
12438 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12439 : PyObject *py_data_size;
12440 0 : if (object->out.data_size == NULL) {
12441 0 : Py_RETURN_NONE;
12442 : }
12443 0 : if (object->out.data_size == NULL) {
12444 0 : py_data_size = Py_None;
12445 0 : Py_INCREF(py_data_size);
12446 : } else {
12447 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)*object->out.data_size);
12448 : }
12449 0 : return py_data_size;
12450 : }
12451 :
12452 0 : static int py_winreg_QueryValue_out_set_data_size(PyObject *py_obj, PyObject *value, void *closure)
12453 : {
12454 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12455 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.data_size));
12456 0 : if (value == NULL) {
12457 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.data_size");
12458 0 : return -1;
12459 : }
12460 0 : if (value == Py_None) {
12461 0 : object->out.data_size = NULL;
12462 : } else {
12463 0 : object->out.data_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data_size);
12464 0 : if (object->out.data_size == NULL) {
12465 0 : PyErr_NoMemory();
12466 0 : return -1;
12467 : }
12468 : {
12469 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.data_size));
12470 0 : if (PyLong_Check(value)) {
12471 : unsigned long long test_var;
12472 0 : test_var = PyLong_AsUnsignedLongLong(value);
12473 0 : if (PyErr_Occurred() != NULL) {
12474 0 : return -1;
12475 : }
12476 0 : if (test_var > uint_max) {
12477 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12478 : PyLong_Type.tp_name, uint_max, test_var);
12479 0 : return -1;
12480 : }
12481 0 : *object->out.data_size = test_var;
12482 : } else {
12483 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12484 : PyLong_Type.tp_name);
12485 0 : return -1;
12486 : }
12487 : }
12488 : }
12489 0 : return 0;
12490 : }
12491 :
12492 0 : static PyObject *py_winreg_QueryValue_in_get_data_length(PyObject *obj, void *closure)
12493 : {
12494 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12495 : PyObject *py_data_length;
12496 0 : if (object->in.data_length == NULL) {
12497 0 : Py_RETURN_NONE;
12498 : }
12499 0 : if (object->in.data_length == NULL) {
12500 0 : py_data_length = Py_None;
12501 0 : Py_INCREF(py_data_length);
12502 : } else {
12503 0 : py_data_length = PyLong_FromUnsignedLongLong((uint32_t)*object->in.data_length);
12504 : }
12505 0 : return py_data_length;
12506 : }
12507 :
12508 0 : static int py_winreg_QueryValue_in_set_data_length(PyObject *py_obj, PyObject *value, void *closure)
12509 : {
12510 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12511 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data_length));
12512 0 : if (value == NULL) {
12513 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data_length");
12514 0 : return -1;
12515 : }
12516 0 : if (value == Py_None) {
12517 0 : object->in.data_length = NULL;
12518 : } else {
12519 0 : object->in.data_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data_length);
12520 0 : if (object->in.data_length == NULL) {
12521 0 : PyErr_NoMemory();
12522 0 : return -1;
12523 : }
12524 : {
12525 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.data_length));
12526 0 : if (PyLong_Check(value)) {
12527 : unsigned long long test_var;
12528 0 : test_var = PyLong_AsUnsignedLongLong(value);
12529 0 : if (PyErr_Occurred() != NULL) {
12530 0 : return -1;
12531 : }
12532 0 : if (test_var > uint_max) {
12533 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12534 : PyLong_Type.tp_name, uint_max, test_var);
12535 0 : return -1;
12536 : }
12537 0 : *object->in.data_length = test_var;
12538 : } else {
12539 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12540 : PyLong_Type.tp_name);
12541 0 : return -1;
12542 : }
12543 : }
12544 : }
12545 0 : return 0;
12546 : }
12547 :
12548 0 : static PyObject *py_winreg_QueryValue_out_get_data_length(PyObject *obj, void *closure)
12549 : {
12550 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12551 : PyObject *py_data_length;
12552 0 : if (object->out.data_length == NULL) {
12553 0 : Py_RETURN_NONE;
12554 : }
12555 0 : if (object->out.data_length == NULL) {
12556 0 : py_data_length = Py_None;
12557 0 : Py_INCREF(py_data_length);
12558 : } else {
12559 0 : py_data_length = PyLong_FromUnsignedLongLong((uint32_t)*object->out.data_length);
12560 : }
12561 0 : return py_data_length;
12562 : }
12563 :
12564 0 : static int py_winreg_QueryValue_out_set_data_length(PyObject *py_obj, PyObject *value, void *closure)
12565 : {
12566 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12567 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.data_length));
12568 0 : if (value == NULL) {
12569 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.data_length");
12570 0 : return -1;
12571 : }
12572 0 : if (value == Py_None) {
12573 0 : object->out.data_length = NULL;
12574 : } else {
12575 0 : object->out.data_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.data_length);
12576 0 : if (object->out.data_length == NULL) {
12577 0 : PyErr_NoMemory();
12578 0 : return -1;
12579 : }
12580 : {
12581 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.data_length));
12582 0 : if (PyLong_Check(value)) {
12583 : unsigned long long test_var;
12584 0 : test_var = PyLong_AsUnsignedLongLong(value);
12585 0 : if (PyErr_Occurred() != NULL) {
12586 0 : return -1;
12587 : }
12588 0 : if (test_var > uint_max) {
12589 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
12590 : PyLong_Type.tp_name, uint_max, test_var);
12591 0 : return -1;
12592 : }
12593 0 : *object->out.data_length = test_var;
12594 : } else {
12595 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
12596 : PyLong_Type.tp_name);
12597 0 : return -1;
12598 : }
12599 : }
12600 : }
12601 0 : return 0;
12602 : }
12603 :
12604 0 : static PyObject *py_winreg_QueryValue_get_result(PyObject *obj, void *closure)
12605 : {
12606 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(obj);
12607 : PyObject *py_result;
12608 0 : py_result = PyErr_FromWERROR(object->out.result);
12609 0 : return py_result;
12610 : }
12611 :
12612 0 : static int py_winreg_QueryValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
12613 : {
12614 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12615 0 : if (value == NULL) {
12616 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
12617 0 : return -1;
12618 : }
12619 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
12620 0 : return 0;
12621 : }
12622 :
12623 : static PyGetSetDef py_winreg_QueryValue_getsetters[] = {
12624 : {
12625 : .name = discard_const_p(char, "in_handle"),
12626 : .get = py_winreg_QueryValue_in_get_handle,
12627 : .set = py_winreg_QueryValue_in_set_handle,
12628 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
12629 : },
12630 : {
12631 : .name = discard_const_p(char, "in_value_name"),
12632 : .get = py_winreg_QueryValue_in_get_value_name,
12633 : .set = py_winreg_QueryValue_in_set_value_name,
12634 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
12635 : },
12636 : {
12637 : .name = discard_const_p(char, "in_type"),
12638 : .get = py_winreg_QueryValue_in_get_type,
12639 : .set = py_winreg_QueryValue_in_set_type,
12640 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
12641 : },
12642 : {
12643 : .name = discard_const_p(char, "out_type"),
12644 : .get = py_winreg_QueryValue_out_get_type,
12645 : .set = py_winreg_QueryValue_out_set_type,
12646 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
12647 : },
12648 : {
12649 : .name = discard_const_p(char, "in_data"),
12650 : .get = py_winreg_QueryValue_in_get_data,
12651 : .set = py_winreg_QueryValue_in_set_data,
12652 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
12653 : },
12654 : {
12655 : .name = discard_const_p(char, "out_data"),
12656 : .get = py_winreg_QueryValue_out_get_data,
12657 : .set = py_winreg_QueryValue_out_set_data,
12658 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
12659 : },
12660 : {
12661 : .name = discard_const_p(char, "in_data_size"),
12662 : .get = py_winreg_QueryValue_in_get_data_size,
12663 : .set = py_winreg_QueryValue_in_set_data_size,
12664 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12665 : },
12666 : {
12667 : .name = discard_const_p(char, "out_data_size"),
12668 : .get = py_winreg_QueryValue_out_get_data_size,
12669 : .set = py_winreg_QueryValue_out_set_data_size,
12670 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12671 : },
12672 : {
12673 : .name = discard_const_p(char, "in_data_length"),
12674 : .get = py_winreg_QueryValue_in_get_data_length,
12675 : .set = py_winreg_QueryValue_in_set_data_length,
12676 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12677 : },
12678 : {
12679 : .name = discard_const_p(char, "out_data_length"),
12680 : .get = py_winreg_QueryValue_out_get_data_length,
12681 : .set = py_winreg_QueryValue_out_set_data_length,
12682 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
12683 : },
12684 : {
12685 : .name = discard_const_p(char, "result"),
12686 : .get = py_winreg_QueryValue_get_result,
12687 : .set = py_winreg_QueryValue_set_result,
12688 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
12689 : },
12690 : { .name = NULL }
12691 : };
12692 :
12693 0 : static PyObject *py_winreg_QueryValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
12694 : {
12695 0 : PyObject *self = pytalloc_new(struct winreg_QueryValue, type);
12696 0 : struct winreg_QueryValue *_self = (struct winreg_QueryValue *)pytalloc_get_ptr(self);
12697 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
12698 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
12699 0 : _self->in.value_name = talloc_zero(mem_ctx, struct winreg_String);
12700 0 : return self;
12701 : }
12702 :
12703 0 : static PyObject *py_winreg_QueryValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
12704 : {
12705 :
12706 :
12707 0 : return PyLong_FromLong(17);
12708 : }
12709 :
12710 0 : static PyObject *py_winreg_QueryValue_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
12711 : {
12712 0 : const struct ndr_interface_call *call = NULL;
12713 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12714 0 : PyObject *ret = NULL;
12715 0 : struct ndr_push *push = NULL;
12716 : DATA_BLOB blob;
12717 : enum ndr_err_code err;
12718 :
12719 0 : if (ndr_table_winreg.num_calls < 18) {
12720 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryValue_ndr_pack");
12721 0 : return NULL;
12722 : }
12723 0 : call = &ndr_table_winreg.calls[17];
12724 :
12725 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
12726 0 : if (push == NULL) {
12727 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
12728 0 : return NULL;
12729 : }
12730 :
12731 0 : push->flags |= ndr_push_flags;
12732 :
12733 0 : err = call->ndr_push(push, ndr_inout_flags, object);
12734 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
12735 0 : TALLOC_FREE(push);
12736 0 : PyErr_SetNdrError(err);
12737 0 : return NULL;
12738 : }
12739 0 : blob = ndr_push_blob(push);
12740 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
12741 0 : TALLOC_FREE(push);
12742 0 : return ret;
12743 : }
12744 :
12745 0 : static PyObject *py_winreg_QueryValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12746 : {
12747 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
12748 0 : PyObject *bigendian_obj = NULL;
12749 0 : PyObject *ndr64_obj = NULL;
12750 0 : uint32_t ndr_push_flags = 0;
12751 :
12752 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
12753 : discard_const_p(char *, kwnames),
12754 : &bigendian_obj,
12755 : &ndr64_obj)) {
12756 0 : return NULL;
12757 : }
12758 :
12759 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12760 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
12761 : }
12762 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12763 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
12764 : }
12765 :
12766 0 : return py_winreg_QueryValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
12767 : }
12768 :
12769 0 : static PyObject *py_winreg_QueryValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12770 : {
12771 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
12772 0 : PyObject *bigendian_obj = NULL;
12773 0 : PyObject *ndr64_obj = NULL;
12774 0 : uint32_t ndr_push_flags = 0;
12775 :
12776 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
12777 : discard_const_p(char *, kwnames),
12778 : &bigendian_obj,
12779 : &ndr64_obj)) {
12780 0 : return NULL;
12781 : }
12782 :
12783 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12784 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
12785 : }
12786 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12787 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
12788 : }
12789 :
12790 0 : return py_winreg_QueryValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
12791 : }
12792 :
12793 0 : static PyObject *py_winreg_QueryValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
12794 : {
12795 0 : const struct ndr_interface_call *call = NULL;
12796 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12797 0 : struct ndr_pull *pull = NULL;
12798 : enum ndr_err_code err;
12799 :
12800 0 : if (ndr_table_winreg.num_calls < 18) {
12801 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryValue_ndr_unpack");
12802 0 : return NULL;
12803 : }
12804 0 : call = &ndr_table_winreg.calls[17];
12805 :
12806 0 : pull = ndr_pull_init_blob(blob, object);
12807 0 : if (pull == NULL) {
12808 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
12809 0 : return NULL;
12810 : }
12811 :
12812 0 : pull->flags |= ndr_pull_flags;
12813 :
12814 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
12815 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
12816 0 : TALLOC_FREE(pull);
12817 0 : PyErr_SetNdrError(err);
12818 0 : return NULL;
12819 : }
12820 0 : if (!allow_remaining) {
12821 : uint32_t highest_ofs;
12822 :
12823 0 : if (pull->offset > pull->relative_highest_offset) {
12824 0 : highest_ofs = pull->offset;
12825 : } else {
12826 0 : highest_ofs = pull->relative_highest_offset;
12827 : }
12828 0 : if (highest_ofs < pull->data_size) {
12829 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
12830 : "not all bytes consumed ofs[%u] size[%u]",
12831 : highest_ofs, pull->data_size);
12832 0 : TALLOC_FREE(pull);
12833 0 : PyErr_SetNdrError(err);
12834 0 : return NULL;
12835 : }
12836 : }
12837 :
12838 0 : TALLOC_FREE(pull);
12839 0 : Py_RETURN_NONE;
12840 : }
12841 :
12842 0 : static PyObject *py_winreg_QueryValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12843 : {
12844 : DATA_BLOB blob;
12845 0 : Py_ssize_t blob_length = 0;
12846 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
12847 0 : PyObject *bigendian_obj = NULL;
12848 0 : PyObject *ndr64_obj = NULL;
12849 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
12850 0 : PyObject *allow_remaining_obj = NULL;
12851 0 : bool allow_remaining = false;
12852 :
12853 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
12854 : discard_const_p(char *, kwnames),
12855 : &blob.data, &blob_length,
12856 : &bigendian_obj,
12857 : &ndr64_obj,
12858 : &allow_remaining_obj)) {
12859 0 : return NULL;
12860 : }
12861 0 : blob.length = blob_length;
12862 :
12863 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12864 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
12865 : }
12866 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12867 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
12868 : }
12869 :
12870 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
12871 0 : allow_remaining = true;
12872 : }
12873 :
12874 0 : return py_winreg_QueryValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
12875 : }
12876 :
12877 0 : static PyObject *py_winreg_QueryValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
12878 : {
12879 : DATA_BLOB blob;
12880 0 : Py_ssize_t blob_length = 0;
12881 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
12882 0 : PyObject *bigendian_obj = NULL;
12883 0 : PyObject *ndr64_obj = NULL;
12884 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
12885 0 : PyObject *allow_remaining_obj = NULL;
12886 0 : bool allow_remaining = false;
12887 :
12888 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
12889 : discard_const_p(char *, kwnames),
12890 : &blob.data, &blob_length,
12891 : &bigendian_obj,
12892 : &ndr64_obj,
12893 : &allow_remaining_obj)) {
12894 0 : return NULL;
12895 : }
12896 0 : blob.length = blob_length;
12897 :
12898 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
12899 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
12900 : }
12901 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
12902 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
12903 : }
12904 :
12905 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
12906 0 : allow_remaining = true;
12907 : }
12908 :
12909 0 : return py_winreg_QueryValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
12910 : }
12911 :
12912 0 : static PyObject *py_winreg_QueryValue_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
12913 : {
12914 0 : const struct ndr_interface_call *call = NULL;
12915 0 : struct winreg_QueryValue *object = (struct winreg_QueryValue *)pytalloc_get_ptr(py_obj);
12916 : PyObject *ret;
12917 : char *retstr;
12918 :
12919 0 : if (ndr_table_winreg.num_calls < 18) {
12920 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryValue_ndr_print");
12921 0 : return NULL;
12922 : }
12923 0 : call = &ndr_table_winreg.calls[17];
12924 :
12925 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
12926 0 : ret = PyUnicode_FromString(retstr);
12927 0 : TALLOC_FREE(retstr);
12928 :
12929 0 : return ret;
12930 : }
12931 :
12932 0 : static PyObject *py_winreg_QueryValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
12933 : {
12934 0 : return py_winreg_QueryValue_ndr_print(py_obj, "winreg_QueryValue_in", NDR_IN);
12935 : }
12936 :
12937 0 : static PyObject *py_winreg_QueryValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
12938 : {
12939 0 : return py_winreg_QueryValue_ndr_print(py_obj, "winreg_QueryValue_out", NDR_OUT);
12940 : }
12941 :
12942 : static PyMethodDef py_winreg_QueryValue_methods[] = {
12943 : { "opnum", (PyCFunction)py_winreg_QueryValue_ndr_opnum, METH_NOARGS|METH_CLASS,
12944 : "winreg.QueryValue.opnum() -> 17 (0x11) " },
12945 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
12946 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
12947 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
12948 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
12949 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
12950 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
12951 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
12952 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
12953 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
12954 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
12955 : { NULL, NULL, 0, NULL }
12956 : };
12957 :
12958 :
12959 : static PyTypeObject winreg_QueryValue_Type = {
12960 : PyVarObject_HEAD_INIT(NULL, 0)
12961 : .tp_name = "winreg.QueryValue",
12962 : .tp_getset = py_winreg_QueryValue_getsetters,
12963 : .tp_methods = py_winreg_QueryValue_methods,
12964 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
12965 : .tp_new = py_winreg_QueryValue_new,
12966 : };
12967 :
12968 0 : static bool pack_py_winreg_QueryValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryValue *r)
12969 : {
12970 : PyObject *py_handle;
12971 : PyObject *py_value_name;
12972 : PyObject *py_type;
12973 : PyObject *py_data;
12974 : PyObject *py_data_size;
12975 : PyObject *py_data_length;
12976 0 : const char *kwnames[] = {
12977 : "handle", "value_name", "type", "data", "data_size", "data_length", NULL
12978 : };
12979 :
12980 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)) {
12981 0 : return false;
12982 : }
12983 :
12984 0 : if (py_handle == NULL) {
12985 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
12986 0 : return false;
12987 : }
12988 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
12989 0 : if (r->in.handle == NULL) {
12990 0 : PyErr_NoMemory();
12991 0 : return false;
12992 : }
12993 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
12994 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
12995 0 : PyErr_NoMemory();
12996 0 : return false;
12997 : }
12998 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
12999 0 : if (py_value_name == NULL) {
13000 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.value_name");
13001 0 : return false;
13002 : }
13003 0 : r->in.value_name = talloc_ptrtype(r, r->in.value_name);
13004 0 : if (r->in.value_name == NULL) {
13005 0 : PyErr_NoMemory();
13006 0 : return false;
13007 : }
13008 0 : PY_CHECK_TYPE(&winreg_String_Type, py_value_name, return false;);
13009 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_value_name)) == NULL) {
13010 0 : PyErr_NoMemory();
13011 0 : return false;
13012 : }
13013 0 : r->in.value_name = (struct winreg_String *)pytalloc_get_ptr(py_value_name);
13014 0 : if (py_type == NULL) {
13015 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.type");
13016 0 : return false;
13017 : }
13018 0 : if (py_type == Py_None) {
13019 0 : r->in.type = NULL;
13020 : } else {
13021 0 : r->in.type = talloc_ptrtype(r, r->in.type);
13022 0 : if (r->in.type == NULL) {
13023 0 : PyErr_NoMemory();
13024 0 : return false;
13025 : }
13026 : {
13027 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.type));
13028 0 : if (PyLong_Check(py_type)) {
13029 : unsigned long long test_var;
13030 0 : test_var = PyLong_AsUnsignedLongLong(py_type);
13031 0 : if (PyErr_Occurred() != NULL) {
13032 0 : return false;
13033 : }
13034 0 : if (test_var > uint_max) {
13035 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13036 : PyLong_Type.tp_name, uint_max, test_var);
13037 0 : return false;
13038 : }
13039 0 : *r->in.type = test_var;
13040 : } else {
13041 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13042 : PyLong_Type.tp_name);
13043 0 : return false;
13044 : }
13045 : }
13046 : }
13047 0 : if (py_data == NULL) {
13048 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data");
13049 0 : return false;
13050 : }
13051 0 : if (py_data == Py_None) {
13052 0 : r->in.data = NULL;
13053 : } else {
13054 0 : r->in.data = NULL;
13055 0 : PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
13056 : {
13057 : int data_cntr_1;
13058 0 : r->in.data = talloc_array_ptrtype(r, r->in.data, PyList_GET_SIZE(py_data));
13059 0 : if (!r->in.data) { return false;; }
13060 0 : talloc_set_name_const(r->in.data, "ARRAY: r->in.data");
13061 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(py_data); data_cntr_1++) {
13062 0 : if (PyList_GET_ITEM(py_data, data_cntr_1) == NULL) {
13063 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data[data_cntr_1]");
13064 0 : return false;
13065 : }
13066 : {
13067 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.data[data_cntr_1]));
13068 0 : if (PyLong_Check(PyList_GET_ITEM(py_data, data_cntr_1))) {
13069 : unsigned long long test_var;
13070 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_data, data_cntr_1));
13071 0 : if (PyErr_Occurred() != NULL) {
13072 0 : return false;
13073 : }
13074 0 : if (test_var > uint_max) {
13075 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13076 : PyLong_Type.tp_name, uint_max, test_var);
13077 0 : return false;
13078 : }
13079 0 : r->in.data[data_cntr_1] = test_var;
13080 : } else {
13081 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13082 : PyLong_Type.tp_name);
13083 0 : return false;
13084 : }
13085 : }
13086 : }
13087 : }
13088 : }
13089 0 : if (py_data_size == NULL) {
13090 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data_size");
13091 0 : return false;
13092 : }
13093 0 : if (py_data_size == Py_None) {
13094 0 : r->in.data_size = NULL;
13095 : } else {
13096 0 : r->in.data_size = talloc_ptrtype(r, r->in.data_size);
13097 0 : if (r->in.data_size == NULL) {
13098 0 : PyErr_NoMemory();
13099 0 : return false;
13100 : }
13101 : {
13102 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.data_size));
13103 0 : if (PyLong_Check(py_data_size)) {
13104 : unsigned long long test_var;
13105 0 : test_var = PyLong_AsUnsignedLongLong(py_data_size);
13106 0 : if (PyErr_Occurred() != NULL) {
13107 0 : return false;
13108 : }
13109 0 : if (test_var > uint_max) {
13110 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13111 : PyLong_Type.tp_name, uint_max, test_var);
13112 0 : return false;
13113 : }
13114 0 : *r->in.data_size = test_var;
13115 : } else {
13116 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13117 : PyLong_Type.tp_name);
13118 0 : return false;
13119 : }
13120 : }
13121 : }
13122 0 : if (py_data_length == NULL) {
13123 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data_length");
13124 0 : return false;
13125 : }
13126 0 : if (py_data_length == Py_None) {
13127 0 : r->in.data_length = NULL;
13128 : } else {
13129 0 : r->in.data_length = talloc_ptrtype(r, r->in.data_length);
13130 0 : if (r->in.data_length == NULL) {
13131 0 : PyErr_NoMemory();
13132 0 : return false;
13133 : }
13134 : {
13135 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.data_length));
13136 0 : if (PyLong_Check(py_data_length)) {
13137 : unsigned long long test_var;
13138 0 : test_var = PyLong_AsUnsignedLongLong(py_data_length);
13139 0 : if (PyErr_Occurred() != NULL) {
13140 0 : return false;
13141 : }
13142 0 : if (test_var > uint_max) {
13143 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13144 : PyLong_Type.tp_name, uint_max, test_var);
13145 0 : return false;
13146 : }
13147 0 : *r->in.data_length = test_var;
13148 : } else {
13149 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13150 : PyLong_Type.tp_name);
13151 0 : return false;
13152 : }
13153 : }
13154 : }
13155 0 : return true;
13156 : }
13157 :
13158 0 : static PyObject *unpack_py_winreg_QueryValue_args_out(struct winreg_QueryValue *r)
13159 : {
13160 : PyObject *result;
13161 : PyObject *py_type;
13162 : PyObject *py_data;
13163 : PyObject *py_data_size;
13164 : PyObject *py_data_length;
13165 0 : result = PyTuple_New(4);
13166 0 : if (r->out.type == NULL) {
13167 0 : py_type = Py_None;
13168 0 : Py_INCREF(py_type);
13169 : } else {
13170 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)*r->out.type);
13171 : }
13172 0 : PyTuple_SetItem(result, 0, py_type);
13173 0 : if (r->out.data == NULL) {
13174 0 : py_data = Py_None;
13175 0 : Py_INCREF(py_data);
13176 : } else {
13177 0 : py_data = PyList_New(r->out.data_length?*r->out.data_length:0);
13178 0 : if (py_data == NULL) {
13179 0 : return NULL;
13180 : }
13181 : {
13182 : int data_cntr_1;
13183 0 : for (data_cntr_1 = 0; data_cntr_1 < (r->out.data_length?*r->out.data_length:0); data_cntr_1++) {
13184 : PyObject *py_data_1;
13185 0 : py_data_1 = PyLong_FromLong((uint16_t)r->out.data[data_cntr_1]);
13186 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
13187 : }
13188 : }
13189 : }
13190 0 : PyTuple_SetItem(result, 1, py_data);
13191 0 : if (r->out.data_size == NULL) {
13192 0 : py_data_size = Py_None;
13193 0 : Py_INCREF(py_data_size);
13194 : } else {
13195 0 : py_data_size = PyLong_FromUnsignedLongLong((uint32_t)*r->out.data_size);
13196 : }
13197 0 : PyTuple_SetItem(result, 2, py_data_size);
13198 0 : if (r->out.data_length == NULL) {
13199 0 : py_data_length = Py_None;
13200 0 : Py_INCREF(py_data_length);
13201 : } else {
13202 0 : py_data_length = PyLong_FromUnsignedLongLong((uint32_t)*r->out.data_length);
13203 : }
13204 0 : PyTuple_SetItem(result, 3, py_data_length);
13205 0 : if (!W_ERROR_IS_OK(r->out.result)) {
13206 0 : PyErr_SetWERROR(r->out.result);
13207 0 : return NULL;
13208 : }
13209 :
13210 0 : return result;
13211 : }
13212 :
13213 :
13214 0 : static PyObject *py_winreg_ReplaceKey_in_get_handle(PyObject *obj, void *closure)
13215 : {
13216 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(obj);
13217 : PyObject *py_handle;
13218 0 : if (object->in.handle == NULL) {
13219 0 : Py_RETURN_NONE;
13220 : }
13221 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
13222 0 : return py_handle;
13223 : }
13224 :
13225 0 : static int py_winreg_ReplaceKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
13226 : {
13227 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13228 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
13229 0 : if (value == NULL) {
13230 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
13231 0 : return -1;
13232 : }
13233 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
13234 0 : if (object->in.handle == NULL) {
13235 0 : PyErr_NoMemory();
13236 0 : return -1;
13237 : }
13238 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
13239 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13240 0 : PyErr_NoMemory();
13241 0 : return -1;
13242 : }
13243 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
13244 0 : return 0;
13245 : }
13246 :
13247 0 : static PyObject *py_winreg_ReplaceKey_in_get_subkey(PyObject *obj, void *closure)
13248 : {
13249 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(obj);
13250 : PyObject *py_subkey;
13251 0 : if (object->in.subkey == NULL) {
13252 0 : Py_RETURN_NONE;
13253 : }
13254 0 : py_subkey = pytalloc_reference_ex(&winreg_String_Type, object->in.subkey, object->in.subkey);
13255 0 : return py_subkey;
13256 : }
13257 :
13258 0 : static int py_winreg_ReplaceKey_in_set_subkey(PyObject *py_obj, PyObject *value, void *closure)
13259 : {
13260 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13261 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.subkey));
13262 0 : if (value == NULL) {
13263 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.subkey");
13264 0 : return -1;
13265 : }
13266 0 : object->in.subkey = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.subkey);
13267 0 : if (object->in.subkey == NULL) {
13268 0 : PyErr_NoMemory();
13269 0 : return -1;
13270 : }
13271 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13272 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13273 0 : PyErr_NoMemory();
13274 0 : return -1;
13275 : }
13276 0 : object->in.subkey = (struct winreg_String *)pytalloc_get_ptr(value);
13277 0 : return 0;
13278 : }
13279 :
13280 0 : static PyObject *py_winreg_ReplaceKey_in_get_new_file(PyObject *obj, void *closure)
13281 : {
13282 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(obj);
13283 : PyObject *py_new_file;
13284 0 : if (object->in.new_file == NULL) {
13285 0 : Py_RETURN_NONE;
13286 : }
13287 0 : py_new_file = pytalloc_reference_ex(&winreg_String_Type, object->in.new_file, object->in.new_file);
13288 0 : return py_new_file;
13289 : }
13290 :
13291 0 : static int py_winreg_ReplaceKey_in_set_new_file(PyObject *py_obj, PyObject *value, void *closure)
13292 : {
13293 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13294 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.new_file));
13295 0 : if (value == NULL) {
13296 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.new_file");
13297 0 : return -1;
13298 : }
13299 0 : object->in.new_file = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.new_file);
13300 0 : if (object->in.new_file == NULL) {
13301 0 : PyErr_NoMemory();
13302 0 : return -1;
13303 : }
13304 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13305 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13306 0 : PyErr_NoMemory();
13307 0 : return -1;
13308 : }
13309 0 : object->in.new_file = (struct winreg_String *)pytalloc_get_ptr(value);
13310 0 : return 0;
13311 : }
13312 :
13313 0 : static PyObject *py_winreg_ReplaceKey_in_get_old_file(PyObject *obj, void *closure)
13314 : {
13315 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(obj);
13316 : PyObject *py_old_file;
13317 0 : if (object->in.old_file == NULL) {
13318 0 : Py_RETURN_NONE;
13319 : }
13320 0 : py_old_file = pytalloc_reference_ex(&winreg_String_Type, object->in.old_file, object->in.old_file);
13321 0 : return py_old_file;
13322 : }
13323 :
13324 0 : static int py_winreg_ReplaceKey_in_set_old_file(PyObject *py_obj, PyObject *value, void *closure)
13325 : {
13326 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13327 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.old_file));
13328 0 : if (value == NULL) {
13329 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.old_file");
13330 0 : return -1;
13331 : }
13332 0 : object->in.old_file = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.old_file);
13333 0 : if (object->in.old_file == NULL) {
13334 0 : PyErr_NoMemory();
13335 0 : return -1;
13336 : }
13337 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13338 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13339 0 : PyErr_NoMemory();
13340 0 : return -1;
13341 : }
13342 0 : object->in.old_file = (struct winreg_String *)pytalloc_get_ptr(value);
13343 0 : return 0;
13344 : }
13345 :
13346 0 : static PyObject *py_winreg_ReplaceKey_get_result(PyObject *obj, void *closure)
13347 : {
13348 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(obj);
13349 : PyObject *py_result;
13350 0 : py_result = PyErr_FromWERROR(object->out.result);
13351 0 : return py_result;
13352 : }
13353 :
13354 0 : static int py_winreg_ReplaceKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
13355 : {
13356 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13357 0 : if (value == NULL) {
13358 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
13359 0 : return -1;
13360 : }
13361 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
13362 0 : return 0;
13363 : }
13364 :
13365 : static PyGetSetDef py_winreg_ReplaceKey_getsetters[] = {
13366 : {
13367 : .name = discard_const_p(char, "in_handle"),
13368 : .get = py_winreg_ReplaceKey_in_get_handle,
13369 : .set = py_winreg_ReplaceKey_in_set_handle,
13370 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
13371 : },
13372 : {
13373 : .name = discard_const_p(char, "in_subkey"),
13374 : .get = py_winreg_ReplaceKey_in_get_subkey,
13375 : .set = py_winreg_ReplaceKey_in_set_subkey,
13376 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13377 : },
13378 : {
13379 : .name = discard_const_p(char, "in_new_file"),
13380 : .get = py_winreg_ReplaceKey_in_get_new_file,
13381 : .set = py_winreg_ReplaceKey_in_set_new_file,
13382 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13383 : },
13384 : {
13385 : .name = discard_const_p(char, "in_old_file"),
13386 : .get = py_winreg_ReplaceKey_in_get_old_file,
13387 : .set = py_winreg_ReplaceKey_in_set_old_file,
13388 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13389 : },
13390 : {
13391 : .name = discard_const_p(char, "result"),
13392 : .get = py_winreg_ReplaceKey_get_result,
13393 : .set = py_winreg_ReplaceKey_set_result,
13394 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
13395 : },
13396 : { .name = NULL }
13397 : };
13398 :
13399 0 : static PyObject *py_winreg_ReplaceKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
13400 : {
13401 0 : PyObject *self = pytalloc_new(struct winreg_ReplaceKey, type);
13402 0 : struct winreg_ReplaceKey *_self = (struct winreg_ReplaceKey *)pytalloc_get_ptr(self);
13403 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
13404 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
13405 0 : _self->in.subkey = talloc_zero(mem_ctx, struct winreg_String);
13406 0 : _self->in.new_file = talloc_zero(mem_ctx, struct winreg_String);
13407 0 : _self->in.old_file = talloc_zero(mem_ctx, struct winreg_String);
13408 0 : return self;
13409 : }
13410 :
13411 0 : static PyObject *py_winreg_ReplaceKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
13412 : {
13413 :
13414 :
13415 0 : return PyLong_FromLong(18);
13416 : }
13417 :
13418 0 : static PyObject *py_winreg_ReplaceKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
13419 : {
13420 0 : const struct ndr_interface_call *call = NULL;
13421 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13422 0 : PyObject *ret = NULL;
13423 0 : struct ndr_push *push = NULL;
13424 : DATA_BLOB blob;
13425 : enum ndr_err_code err;
13426 :
13427 0 : if (ndr_table_winreg.num_calls < 19) {
13428 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_ReplaceKey_ndr_pack");
13429 0 : return NULL;
13430 : }
13431 0 : call = &ndr_table_winreg.calls[18];
13432 :
13433 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
13434 0 : if (push == NULL) {
13435 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
13436 0 : return NULL;
13437 : }
13438 :
13439 0 : push->flags |= ndr_push_flags;
13440 :
13441 0 : err = call->ndr_push(push, ndr_inout_flags, object);
13442 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
13443 0 : TALLOC_FREE(push);
13444 0 : PyErr_SetNdrError(err);
13445 0 : return NULL;
13446 : }
13447 0 : blob = ndr_push_blob(push);
13448 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
13449 0 : TALLOC_FREE(push);
13450 0 : return ret;
13451 : }
13452 :
13453 0 : static PyObject *py_winreg_ReplaceKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13454 : {
13455 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13456 0 : PyObject *bigendian_obj = NULL;
13457 0 : PyObject *ndr64_obj = NULL;
13458 0 : uint32_t ndr_push_flags = 0;
13459 :
13460 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
13461 : discard_const_p(char *, kwnames),
13462 : &bigendian_obj,
13463 : &ndr64_obj)) {
13464 0 : return NULL;
13465 : }
13466 :
13467 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13468 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
13469 : }
13470 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13471 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
13472 : }
13473 :
13474 0 : return py_winreg_ReplaceKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
13475 : }
13476 :
13477 0 : static PyObject *py_winreg_ReplaceKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13478 : {
13479 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13480 0 : PyObject *bigendian_obj = NULL;
13481 0 : PyObject *ndr64_obj = NULL;
13482 0 : uint32_t ndr_push_flags = 0;
13483 :
13484 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
13485 : discard_const_p(char *, kwnames),
13486 : &bigendian_obj,
13487 : &ndr64_obj)) {
13488 0 : return NULL;
13489 : }
13490 :
13491 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13492 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
13493 : }
13494 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13495 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
13496 : }
13497 :
13498 0 : return py_winreg_ReplaceKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
13499 : }
13500 :
13501 0 : static PyObject *py_winreg_ReplaceKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
13502 : {
13503 0 : const struct ndr_interface_call *call = NULL;
13504 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13505 0 : struct ndr_pull *pull = NULL;
13506 : enum ndr_err_code err;
13507 :
13508 0 : if (ndr_table_winreg.num_calls < 19) {
13509 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_ReplaceKey_ndr_unpack");
13510 0 : return NULL;
13511 : }
13512 0 : call = &ndr_table_winreg.calls[18];
13513 :
13514 0 : pull = ndr_pull_init_blob(blob, object);
13515 0 : if (pull == NULL) {
13516 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
13517 0 : return NULL;
13518 : }
13519 :
13520 0 : pull->flags |= ndr_pull_flags;
13521 :
13522 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
13523 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
13524 0 : TALLOC_FREE(pull);
13525 0 : PyErr_SetNdrError(err);
13526 0 : return NULL;
13527 : }
13528 0 : if (!allow_remaining) {
13529 : uint32_t highest_ofs;
13530 :
13531 0 : if (pull->offset > pull->relative_highest_offset) {
13532 0 : highest_ofs = pull->offset;
13533 : } else {
13534 0 : highest_ofs = pull->relative_highest_offset;
13535 : }
13536 0 : if (highest_ofs < pull->data_size) {
13537 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
13538 : "not all bytes consumed ofs[%u] size[%u]",
13539 : highest_ofs, pull->data_size);
13540 0 : TALLOC_FREE(pull);
13541 0 : PyErr_SetNdrError(err);
13542 0 : return NULL;
13543 : }
13544 : }
13545 :
13546 0 : TALLOC_FREE(pull);
13547 0 : Py_RETURN_NONE;
13548 : }
13549 :
13550 0 : static PyObject *py_winreg_ReplaceKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13551 : {
13552 : DATA_BLOB blob;
13553 0 : Py_ssize_t blob_length = 0;
13554 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
13555 0 : PyObject *bigendian_obj = NULL;
13556 0 : PyObject *ndr64_obj = NULL;
13557 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
13558 0 : PyObject *allow_remaining_obj = NULL;
13559 0 : bool allow_remaining = false;
13560 :
13561 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
13562 : discard_const_p(char *, kwnames),
13563 : &blob.data, &blob_length,
13564 : &bigendian_obj,
13565 : &ndr64_obj,
13566 : &allow_remaining_obj)) {
13567 0 : return NULL;
13568 : }
13569 0 : blob.length = blob_length;
13570 :
13571 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13572 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
13573 : }
13574 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13575 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
13576 : }
13577 :
13578 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
13579 0 : allow_remaining = true;
13580 : }
13581 :
13582 0 : return py_winreg_ReplaceKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
13583 : }
13584 :
13585 0 : static PyObject *py_winreg_ReplaceKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13586 : {
13587 : DATA_BLOB blob;
13588 0 : Py_ssize_t blob_length = 0;
13589 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
13590 0 : PyObject *bigendian_obj = NULL;
13591 0 : PyObject *ndr64_obj = NULL;
13592 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
13593 0 : PyObject *allow_remaining_obj = NULL;
13594 0 : bool allow_remaining = false;
13595 :
13596 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
13597 : discard_const_p(char *, kwnames),
13598 : &blob.data, &blob_length,
13599 : &bigendian_obj,
13600 : &ndr64_obj,
13601 : &allow_remaining_obj)) {
13602 0 : return NULL;
13603 : }
13604 0 : blob.length = blob_length;
13605 :
13606 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13607 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
13608 : }
13609 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13610 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
13611 : }
13612 :
13613 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
13614 0 : allow_remaining = true;
13615 : }
13616 :
13617 0 : return py_winreg_ReplaceKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
13618 : }
13619 :
13620 0 : static PyObject *py_winreg_ReplaceKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
13621 : {
13622 0 : const struct ndr_interface_call *call = NULL;
13623 0 : struct winreg_ReplaceKey *object = (struct winreg_ReplaceKey *)pytalloc_get_ptr(py_obj);
13624 : PyObject *ret;
13625 : char *retstr;
13626 :
13627 0 : if (ndr_table_winreg.num_calls < 19) {
13628 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_ReplaceKey_ndr_print");
13629 0 : return NULL;
13630 : }
13631 0 : call = &ndr_table_winreg.calls[18];
13632 :
13633 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
13634 0 : ret = PyUnicode_FromString(retstr);
13635 0 : TALLOC_FREE(retstr);
13636 :
13637 0 : return ret;
13638 : }
13639 :
13640 0 : static PyObject *py_winreg_ReplaceKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
13641 : {
13642 0 : return py_winreg_ReplaceKey_ndr_print(py_obj, "winreg_ReplaceKey_in", NDR_IN);
13643 : }
13644 :
13645 0 : static PyObject *py_winreg_ReplaceKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
13646 : {
13647 0 : return py_winreg_ReplaceKey_ndr_print(py_obj, "winreg_ReplaceKey_out", NDR_OUT);
13648 : }
13649 :
13650 : static PyMethodDef py_winreg_ReplaceKey_methods[] = {
13651 : { "opnum", (PyCFunction)py_winreg_ReplaceKey_ndr_opnum, METH_NOARGS|METH_CLASS,
13652 : "winreg.ReplaceKey.opnum() -> 18 (0x12) " },
13653 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
13654 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
13655 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
13656 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
13657 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
13658 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
13659 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_ReplaceKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
13660 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
13661 : { "__ndr_print_in__", (PyCFunction)py_winreg_ReplaceKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
13662 : { "__ndr_print_out__", (PyCFunction)py_winreg_ReplaceKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
13663 : { NULL, NULL, 0, NULL }
13664 : };
13665 :
13666 :
13667 : static PyTypeObject winreg_ReplaceKey_Type = {
13668 : PyVarObject_HEAD_INIT(NULL, 0)
13669 : .tp_name = "winreg.ReplaceKey",
13670 : .tp_getset = py_winreg_ReplaceKey_getsetters,
13671 : .tp_methods = py_winreg_ReplaceKey_methods,
13672 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
13673 : .tp_new = py_winreg_ReplaceKey_new,
13674 : };
13675 :
13676 0 : static bool pack_py_winreg_ReplaceKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_ReplaceKey *r)
13677 : {
13678 : PyObject *py_handle;
13679 : PyObject *py_subkey;
13680 : PyObject *py_new_file;
13681 : PyObject *py_old_file;
13682 0 : const char *kwnames[] = {
13683 : "handle", "subkey", "new_file", "old_file", NULL
13684 : };
13685 :
13686 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_ReplaceKey", discard_const_p(char *, kwnames), &py_handle, &py_subkey, &py_new_file, &py_old_file)) {
13687 0 : return false;
13688 : }
13689 :
13690 0 : if (py_handle == NULL) {
13691 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
13692 0 : return false;
13693 : }
13694 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
13695 0 : if (r->in.handle == NULL) {
13696 0 : PyErr_NoMemory();
13697 0 : return false;
13698 : }
13699 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
13700 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
13701 0 : PyErr_NoMemory();
13702 0 : return false;
13703 : }
13704 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
13705 0 : if (py_subkey == NULL) {
13706 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.subkey");
13707 0 : return false;
13708 : }
13709 0 : r->in.subkey = talloc_ptrtype(r, r->in.subkey);
13710 0 : if (r->in.subkey == NULL) {
13711 0 : PyErr_NoMemory();
13712 0 : return false;
13713 : }
13714 0 : PY_CHECK_TYPE(&winreg_String_Type, py_subkey, return false;);
13715 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_subkey)) == NULL) {
13716 0 : PyErr_NoMemory();
13717 0 : return false;
13718 : }
13719 0 : r->in.subkey = (struct winreg_String *)pytalloc_get_ptr(py_subkey);
13720 0 : if (py_new_file == NULL) {
13721 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.new_file");
13722 0 : return false;
13723 : }
13724 0 : r->in.new_file = talloc_ptrtype(r, r->in.new_file);
13725 0 : if (r->in.new_file == NULL) {
13726 0 : PyErr_NoMemory();
13727 0 : return false;
13728 : }
13729 0 : PY_CHECK_TYPE(&winreg_String_Type, py_new_file, return false;);
13730 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_new_file)) == NULL) {
13731 0 : PyErr_NoMemory();
13732 0 : return false;
13733 : }
13734 0 : r->in.new_file = (struct winreg_String *)pytalloc_get_ptr(py_new_file);
13735 0 : if (py_old_file == NULL) {
13736 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.old_file");
13737 0 : return false;
13738 : }
13739 0 : r->in.old_file = talloc_ptrtype(r, r->in.old_file);
13740 0 : if (r->in.old_file == NULL) {
13741 0 : PyErr_NoMemory();
13742 0 : return false;
13743 : }
13744 0 : PY_CHECK_TYPE(&winreg_String_Type, py_old_file, return false;);
13745 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_old_file)) == NULL) {
13746 0 : PyErr_NoMemory();
13747 0 : return false;
13748 : }
13749 0 : r->in.old_file = (struct winreg_String *)pytalloc_get_ptr(py_old_file);
13750 0 : return true;
13751 : }
13752 :
13753 0 : static PyObject *unpack_py_winreg_ReplaceKey_args_out(struct winreg_ReplaceKey *r)
13754 : {
13755 : PyObject *result;
13756 0 : result = Py_None;
13757 0 : Py_INCREF(result);
13758 0 : if (!W_ERROR_IS_OK(r->out.result)) {
13759 0 : PyErr_SetWERROR(r->out.result);
13760 0 : return NULL;
13761 : }
13762 :
13763 0 : return result;
13764 : }
13765 :
13766 :
13767 0 : static PyObject *py_winreg_RestoreKey_in_get_handle(PyObject *obj, void *closure)
13768 : {
13769 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(obj);
13770 : PyObject *py_handle;
13771 0 : if (object->in.handle == NULL) {
13772 0 : Py_RETURN_NONE;
13773 : }
13774 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
13775 0 : return py_handle;
13776 : }
13777 :
13778 0 : static int py_winreg_RestoreKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
13779 : {
13780 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(py_obj);
13781 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
13782 0 : if (value == NULL) {
13783 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
13784 0 : return -1;
13785 : }
13786 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
13787 0 : if (object->in.handle == NULL) {
13788 0 : PyErr_NoMemory();
13789 0 : return -1;
13790 : }
13791 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
13792 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13793 0 : PyErr_NoMemory();
13794 0 : return -1;
13795 : }
13796 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
13797 0 : return 0;
13798 : }
13799 :
13800 0 : static PyObject *py_winreg_RestoreKey_in_get_filename(PyObject *obj, void *closure)
13801 : {
13802 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(obj);
13803 : PyObject *py_filename;
13804 0 : if (object->in.filename == NULL) {
13805 0 : Py_RETURN_NONE;
13806 : }
13807 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
13808 0 : return py_filename;
13809 : }
13810 :
13811 0 : static int py_winreg_RestoreKey_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
13812 : {
13813 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(py_obj);
13814 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
13815 0 : if (value == NULL) {
13816 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.filename");
13817 0 : return -1;
13818 : }
13819 0 : object->in.filename = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.filename);
13820 0 : if (object->in.filename == NULL) {
13821 0 : PyErr_NoMemory();
13822 0 : return -1;
13823 : }
13824 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
13825 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
13826 0 : PyErr_NoMemory();
13827 0 : return -1;
13828 : }
13829 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
13830 0 : return 0;
13831 : }
13832 :
13833 0 : static PyObject *py_winreg_RestoreKey_in_get_flags(PyObject *obj, void *closure)
13834 : {
13835 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(obj);
13836 : PyObject *py_flags;
13837 0 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags);
13838 0 : return py_flags;
13839 : }
13840 :
13841 0 : static int py_winreg_RestoreKey_in_set_flags(PyObject *py_obj, PyObject *value, void *closure)
13842 : {
13843 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(py_obj);
13844 0 : if (value == NULL) {
13845 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags");
13846 0 : return -1;
13847 : }
13848 : {
13849 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags));
13850 0 : if (PyLong_Check(value)) {
13851 : unsigned long long test_var;
13852 0 : test_var = PyLong_AsUnsignedLongLong(value);
13853 0 : if (PyErr_Occurred() != NULL) {
13854 0 : return -1;
13855 : }
13856 0 : if (test_var > uint_max) {
13857 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
13858 : PyLong_Type.tp_name, uint_max, test_var);
13859 0 : return -1;
13860 : }
13861 0 : object->in.flags = test_var;
13862 : } else {
13863 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
13864 : PyLong_Type.tp_name);
13865 0 : return -1;
13866 : }
13867 : }
13868 0 : return 0;
13869 : }
13870 :
13871 0 : static PyObject *py_winreg_RestoreKey_get_result(PyObject *obj, void *closure)
13872 : {
13873 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(obj);
13874 : PyObject *py_result;
13875 0 : py_result = PyErr_FromWERROR(object->out.result);
13876 0 : return py_result;
13877 : }
13878 :
13879 0 : static int py_winreg_RestoreKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
13880 : {
13881 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(py_obj);
13882 0 : if (value == NULL) {
13883 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
13884 0 : return -1;
13885 : }
13886 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
13887 0 : return 0;
13888 : }
13889 :
13890 : static PyGetSetDef py_winreg_RestoreKey_getsetters[] = {
13891 : {
13892 : .name = discard_const_p(char, "in_handle"),
13893 : .get = py_winreg_RestoreKey_in_get_handle,
13894 : .set = py_winreg_RestoreKey_in_set_handle,
13895 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
13896 : },
13897 : {
13898 : .name = discard_const_p(char, "in_filename"),
13899 : .get = py_winreg_RestoreKey_in_get_filename,
13900 : .set = py_winreg_RestoreKey_in_set_filename,
13901 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
13902 : },
13903 : {
13904 : .name = discard_const_p(char, "in_flags"),
13905 : .get = py_winreg_RestoreKey_in_get_flags,
13906 : .set = py_winreg_RestoreKey_in_set_flags,
13907 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_RestoreKeyFlags")
13908 : },
13909 : {
13910 : .name = discard_const_p(char, "result"),
13911 : .get = py_winreg_RestoreKey_get_result,
13912 : .set = py_winreg_RestoreKey_set_result,
13913 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
13914 : },
13915 : { .name = NULL }
13916 : };
13917 :
13918 0 : static PyObject *py_winreg_RestoreKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
13919 : {
13920 0 : PyObject *self = pytalloc_new(struct winreg_RestoreKey, type);
13921 0 : struct winreg_RestoreKey *_self = (struct winreg_RestoreKey *)pytalloc_get_ptr(self);
13922 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
13923 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
13924 0 : _self->in.filename = talloc_zero(mem_ctx, struct winreg_String);
13925 0 : return self;
13926 : }
13927 :
13928 0 : static PyObject *py_winreg_RestoreKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
13929 : {
13930 :
13931 :
13932 0 : return PyLong_FromLong(19);
13933 : }
13934 :
13935 0 : static PyObject *py_winreg_RestoreKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
13936 : {
13937 0 : const struct ndr_interface_call *call = NULL;
13938 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(py_obj);
13939 0 : PyObject *ret = NULL;
13940 0 : struct ndr_push *push = NULL;
13941 : DATA_BLOB blob;
13942 : enum ndr_err_code err;
13943 :
13944 0 : if (ndr_table_winreg.num_calls < 20) {
13945 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_RestoreKey_ndr_pack");
13946 0 : return NULL;
13947 : }
13948 0 : call = &ndr_table_winreg.calls[19];
13949 :
13950 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
13951 0 : if (push == NULL) {
13952 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
13953 0 : return NULL;
13954 : }
13955 :
13956 0 : push->flags |= ndr_push_flags;
13957 :
13958 0 : err = call->ndr_push(push, ndr_inout_flags, object);
13959 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
13960 0 : TALLOC_FREE(push);
13961 0 : PyErr_SetNdrError(err);
13962 0 : return NULL;
13963 : }
13964 0 : blob = ndr_push_blob(push);
13965 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
13966 0 : TALLOC_FREE(push);
13967 0 : return ret;
13968 : }
13969 :
13970 0 : static PyObject *py_winreg_RestoreKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13971 : {
13972 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13973 0 : PyObject *bigendian_obj = NULL;
13974 0 : PyObject *ndr64_obj = NULL;
13975 0 : uint32_t ndr_push_flags = 0;
13976 :
13977 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
13978 : discard_const_p(char *, kwnames),
13979 : &bigendian_obj,
13980 : &ndr64_obj)) {
13981 0 : return NULL;
13982 : }
13983 :
13984 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
13985 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
13986 : }
13987 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
13988 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
13989 : }
13990 :
13991 0 : return py_winreg_RestoreKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
13992 : }
13993 :
13994 0 : static PyObject *py_winreg_RestoreKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
13995 : {
13996 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
13997 0 : PyObject *bigendian_obj = NULL;
13998 0 : PyObject *ndr64_obj = NULL;
13999 0 : uint32_t ndr_push_flags = 0;
14000 :
14001 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
14002 : discard_const_p(char *, kwnames),
14003 : &bigendian_obj,
14004 : &ndr64_obj)) {
14005 0 : return NULL;
14006 : }
14007 :
14008 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14009 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14010 : }
14011 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14012 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
14013 : }
14014 :
14015 0 : return py_winreg_RestoreKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
14016 : }
14017 :
14018 0 : static PyObject *py_winreg_RestoreKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
14019 : {
14020 0 : const struct ndr_interface_call *call = NULL;
14021 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(py_obj);
14022 0 : struct ndr_pull *pull = NULL;
14023 : enum ndr_err_code err;
14024 :
14025 0 : if (ndr_table_winreg.num_calls < 20) {
14026 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_RestoreKey_ndr_unpack");
14027 0 : return NULL;
14028 : }
14029 0 : call = &ndr_table_winreg.calls[19];
14030 :
14031 0 : pull = ndr_pull_init_blob(blob, object);
14032 0 : if (pull == NULL) {
14033 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14034 0 : return NULL;
14035 : }
14036 :
14037 0 : pull->flags |= ndr_pull_flags;
14038 :
14039 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
14040 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14041 0 : TALLOC_FREE(pull);
14042 0 : PyErr_SetNdrError(err);
14043 0 : return NULL;
14044 : }
14045 0 : if (!allow_remaining) {
14046 : uint32_t highest_ofs;
14047 :
14048 0 : if (pull->offset > pull->relative_highest_offset) {
14049 0 : highest_ofs = pull->offset;
14050 : } else {
14051 0 : highest_ofs = pull->relative_highest_offset;
14052 : }
14053 0 : if (highest_ofs < pull->data_size) {
14054 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
14055 : "not all bytes consumed ofs[%u] size[%u]",
14056 : highest_ofs, pull->data_size);
14057 0 : TALLOC_FREE(pull);
14058 0 : PyErr_SetNdrError(err);
14059 0 : return NULL;
14060 : }
14061 : }
14062 :
14063 0 : TALLOC_FREE(pull);
14064 0 : Py_RETURN_NONE;
14065 : }
14066 :
14067 0 : static PyObject *py_winreg_RestoreKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14068 : {
14069 : DATA_BLOB blob;
14070 0 : Py_ssize_t blob_length = 0;
14071 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14072 0 : PyObject *bigendian_obj = NULL;
14073 0 : PyObject *ndr64_obj = NULL;
14074 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14075 0 : PyObject *allow_remaining_obj = NULL;
14076 0 : bool allow_remaining = false;
14077 :
14078 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
14079 : discard_const_p(char *, kwnames),
14080 : &blob.data, &blob_length,
14081 : &bigendian_obj,
14082 : &ndr64_obj,
14083 : &allow_remaining_obj)) {
14084 0 : return NULL;
14085 : }
14086 0 : blob.length = blob_length;
14087 :
14088 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14089 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14090 : }
14091 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14092 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14093 : }
14094 :
14095 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14096 0 : allow_remaining = true;
14097 : }
14098 :
14099 0 : return py_winreg_RestoreKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
14100 : }
14101 :
14102 0 : static PyObject *py_winreg_RestoreKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14103 : {
14104 : DATA_BLOB blob;
14105 0 : Py_ssize_t blob_length = 0;
14106 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14107 0 : PyObject *bigendian_obj = NULL;
14108 0 : PyObject *ndr64_obj = NULL;
14109 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14110 0 : PyObject *allow_remaining_obj = NULL;
14111 0 : bool allow_remaining = false;
14112 :
14113 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
14114 : discard_const_p(char *, kwnames),
14115 : &blob.data, &blob_length,
14116 : &bigendian_obj,
14117 : &ndr64_obj,
14118 : &allow_remaining_obj)) {
14119 0 : return NULL;
14120 : }
14121 0 : blob.length = blob_length;
14122 :
14123 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14124 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14125 : }
14126 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14127 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14128 : }
14129 :
14130 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14131 0 : allow_remaining = true;
14132 : }
14133 :
14134 0 : return py_winreg_RestoreKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
14135 : }
14136 :
14137 0 : static PyObject *py_winreg_RestoreKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
14138 : {
14139 0 : const struct ndr_interface_call *call = NULL;
14140 0 : struct winreg_RestoreKey *object = (struct winreg_RestoreKey *)pytalloc_get_ptr(py_obj);
14141 : PyObject *ret;
14142 : char *retstr;
14143 :
14144 0 : if (ndr_table_winreg.num_calls < 20) {
14145 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_RestoreKey_ndr_print");
14146 0 : return NULL;
14147 : }
14148 0 : call = &ndr_table_winreg.calls[19];
14149 :
14150 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
14151 0 : ret = PyUnicode_FromString(retstr);
14152 0 : TALLOC_FREE(retstr);
14153 :
14154 0 : return ret;
14155 : }
14156 :
14157 0 : static PyObject *py_winreg_RestoreKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14158 : {
14159 0 : return py_winreg_RestoreKey_ndr_print(py_obj, "winreg_RestoreKey_in", NDR_IN);
14160 : }
14161 :
14162 0 : static PyObject *py_winreg_RestoreKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14163 : {
14164 0 : return py_winreg_RestoreKey_ndr_print(py_obj, "winreg_RestoreKey_out", NDR_OUT);
14165 : }
14166 :
14167 : static PyMethodDef py_winreg_RestoreKey_methods[] = {
14168 : { "opnum", (PyCFunction)py_winreg_RestoreKey_ndr_opnum, METH_NOARGS|METH_CLASS,
14169 : "winreg.RestoreKey.opnum() -> 19 (0x13) " },
14170 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
14171 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
14172 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
14173 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
14174 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
14175 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
14176 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_RestoreKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
14177 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
14178 : { "__ndr_print_in__", (PyCFunction)py_winreg_RestoreKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
14179 : { "__ndr_print_out__", (PyCFunction)py_winreg_RestoreKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
14180 : { NULL, NULL, 0, NULL }
14181 : };
14182 :
14183 :
14184 : static PyTypeObject winreg_RestoreKey_Type = {
14185 : PyVarObject_HEAD_INIT(NULL, 0)
14186 : .tp_name = "winreg.RestoreKey",
14187 : .tp_getset = py_winreg_RestoreKey_getsetters,
14188 : .tp_methods = py_winreg_RestoreKey_methods,
14189 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
14190 : .tp_new = py_winreg_RestoreKey_new,
14191 : };
14192 :
14193 0 : static bool pack_py_winreg_RestoreKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_RestoreKey *r)
14194 : {
14195 : PyObject *py_handle;
14196 : PyObject *py_filename;
14197 : PyObject *py_flags;
14198 0 : const char *kwnames[] = {
14199 : "handle", "filename", "flags", NULL
14200 : };
14201 :
14202 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_RestoreKey", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_flags)) {
14203 0 : return false;
14204 : }
14205 :
14206 0 : if (py_handle == NULL) {
14207 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
14208 0 : return false;
14209 : }
14210 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
14211 0 : if (r->in.handle == NULL) {
14212 0 : PyErr_NoMemory();
14213 0 : return false;
14214 : }
14215 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
14216 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
14217 0 : PyErr_NoMemory();
14218 0 : return false;
14219 : }
14220 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
14221 0 : if (py_filename == NULL) {
14222 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.filename");
14223 0 : return false;
14224 : }
14225 0 : r->in.filename = talloc_ptrtype(r, r->in.filename);
14226 0 : if (r->in.filename == NULL) {
14227 0 : PyErr_NoMemory();
14228 0 : return false;
14229 : }
14230 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
14231 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
14232 0 : PyErr_NoMemory();
14233 0 : return false;
14234 : }
14235 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
14236 0 : if (py_flags == NULL) {
14237 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags");
14238 0 : return false;
14239 : }
14240 : {
14241 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags));
14242 0 : if (PyLong_Check(py_flags)) {
14243 : unsigned long long test_var;
14244 0 : test_var = PyLong_AsUnsignedLongLong(py_flags);
14245 0 : if (PyErr_Occurred() != NULL) {
14246 0 : return false;
14247 : }
14248 0 : if (test_var > uint_max) {
14249 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
14250 : PyLong_Type.tp_name, uint_max, test_var);
14251 0 : return false;
14252 : }
14253 0 : r->in.flags = test_var;
14254 : } else {
14255 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
14256 : PyLong_Type.tp_name);
14257 0 : return false;
14258 : }
14259 : }
14260 0 : return true;
14261 : }
14262 :
14263 0 : static PyObject *unpack_py_winreg_RestoreKey_args_out(struct winreg_RestoreKey *r)
14264 : {
14265 : PyObject *result;
14266 0 : result = Py_None;
14267 0 : Py_INCREF(result);
14268 0 : if (!W_ERROR_IS_OK(r->out.result)) {
14269 0 : PyErr_SetWERROR(r->out.result);
14270 0 : return NULL;
14271 : }
14272 :
14273 0 : return result;
14274 : }
14275 :
14276 :
14277 0 : static PyObject *py_winreg_SaveKey_in_get_handle(PyObject *obj, void *closure)
14278 : {
14279 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(obj);
14280 : PyObject *py_handle;
14281 0 : if (object->in.handle == NULL) {
14282 0 : Py_RETURN_NONE;
14283 : }
14284 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
14285 0 : return py_handle;
14286 : }
14287 :
14288 0 : static int py_winreg_SaveKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
14289 : {
14290 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(py_obj);
14291 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
14292 0 : if (value == NULL) {
14293 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
14294 0 : return -1;
14295 : }
14296 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
14297 0 : if (object->in.handle == NULL) {
14298 0 : PyErr_NoMemory();
14299 0 : return -1;
14300 : }
14301 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
14302 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14303 0 : PyErr_NoMemory();
14304 0 : return -1;
14305 : }
14306 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
14307 0 : return 0;
14308 : }
14309 :
14310 0 : static PyObject *py_winreg_SaveKey_in_get_filename(PyObject *obj, void *closure)
14311 : {
14312 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(obj);
14313 : PyObject *py_filename;
14314 0 : if (object->in.filename == NULL) {
14315 0 : Py_RETURN_NONE;
14316 : }
14317 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
14318 0 : return py_filename;
14319 : }
14320 :
14321 0 : static int py_winreg_SaveKey_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
14322 : {
14323 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(py_obj);
14324 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
14325 0 : if (value == NULL) {
14326 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.filename");
14327 0 : return -1;
14328 : }
14329 0 : object->in.filename = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.filename);
14330 0 : if (object->in.filename == NULL) {
14331 0 : PyErr_NoMemory();
14332 0 : return -1;
14333 : }
14334 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
14335 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14336 0 : PyErr_NoMemory();
14337 0 : return -1;
14338 : }
14339 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
14340 0 : return 0;
14341 : }
14342 :
14343 0 : static PyObject *py_winreg_SaveKey_in_get_sec_attrib(PyObject *obj, void *closure)
14344 : {
14345 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(obj);
14346 : PyObject *py_sec_attrib;
14347 0 : if (object->in.sec_attrib == NULL) {
14348 0 : Py_RETURN_NONE;
14349 : }
14350 0 : if (object->in.sec_attrib == NULL) {
14351 0 : py_sec_attrib = Py_None;
14352 0 : Py_INCREF(py_sec_attrib);
14353 : } else {
14354 0 : py_sec_attrib = pytalloc_reference_ex(&KeySecurityAttribute_Type, object->in.sec_attrib, object->in.sec_attrib);
14355 : }
14356 0 : return py_sec_attrib;
14357 : }
14358 :
14359 0 : static int py_winreg_SaveKey_in_set_sec_attrib(PyObject *py_obj, PyObject *value, void *closure)
14360 : {
14361 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(py_obj);
14362 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sec_attrib));
14363 0 : if (value == NULL) {
14364 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sec_attrib");
14365 0 : return -1;
14366 : }
14367 0 : if (value == Py_None) {
14368 0 : object->in.sec_attrib = NULL;
14369 : } else {
14370 0 : object->in.sec_attrib = NULL;
14371 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, value, return -1;);
14372 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14373 0 : PyErr_NoMemory();
14374 0 : return -1;
14375 : }
14376 0 : object->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(value);
14377 : }
14378 0 : return 0;
14379 : }
14380 :
14381 0 : static PyObject *py_winreg_SaveKey_get_result(PyObject *obj, void *closure)
14382 : {
14383 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(obj);
14384 : PyObject *py_result;
14385 0 : py_result = PyErr_FromWERROR(object->out.result);
14386 0 : return py_result;
14387 : }
14388 :
14389 0 : static int py_winreg_SaveKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
14390 : {
14391 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(py_obj);
14392 0 : if (value == NULL) {
14393 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
14394 0 : return -1;
14395 : }
14396 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
14397 0 : return 0;
14398 : }
14399 :
14400 : static PyGetSetDef py_winreg_SaveKey_getsetters[] = {
14401 : {
14402 : .name = discard_const_p(char, "in_handle"),
14403 : .get = py_winreg_SaveKey_in_get_handle,
14404 : .set = py_winreg_SaveKey_in_set_handle,
14405 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
14406 : },
14407 : {
14408 : .name = discard_const_p(char, "in_filename"),
14409 : .get = py_winreg_SaveKey_in_get_filename,
14410 : .set = py_winreg_SaveKey_in_set_filename,
14411 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
14412 : },
14413 : {
14414 : .name = discard_const_p(char, "in_sec_attrib"),
14415 : .get = py_winreg_SaveKey_in_get_sec_attrib,
14416 : .set = py_winreg_SaveKey_in_set_sec_attrib,
14417 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityAttribute")
14418 : },
14419 : {
14420 : .name = discard_const_p(char, "result"),
14421 : .get = py_winreg_SaveKey_get_result,
14422 : .set = py_winreg_SaveKey_set_result,
14423 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
14424 : },
14425 : { .name = NULL }
14426 : };
14427 :
14428 0 : static PyObject *py_winreg_SaveKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
14429 : {
14430 0 : PyObject *self = pytalloc_new(struct winreg_SaveKey, type);
14431 0 : struct winreg_SaveKey *_self = (struct winreg_SaveKey *)pytalloc_get_ptr(self);
14432 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
14433 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
14434 0 : _self->in.filename = talloc_zero(mem_ctx, struct winreg_String);
14435 0 : return self;
14436 : }
14437 :
14438 0 : static PyObject *py_winreg_SaveKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
14439 : {
14440 :
14441 :
14442 0 : return PyLong_FromLong(20);
14443 : }
14444 :
14445 0 : static PyObject *py_winreg_SaveKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
14446 : {
14447 0 : const struct ndr_interface_call *call = NULL;
14448 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(py_obj);
14449 0 : PyObject *ret = NULL;
14450 0 : struct ndr_push *push = NULL;
14451 : DATA_BLOB blob;
14452 : enum ndr_err_code err;
14453 :
14454 0 : if (ndr_table_winreg.num_calls < 21) {
14455 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKey_ndr_pack");
14456 0 : return NULL;
14457 : }
14458 0 : call = &ndr_table_winreg.calls[20];
14459 :
14460 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
14461 0 : if (push == NULL) {
14462 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14463 0 : return NULL;
14464 : }
14465 :
14466 0 : push->flags |= ndr_push_flags;
14467 :
14468 0 : err = call->ndr_push(push, ndr_inout_flags, object);
14469 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14470 0 : TALLOC_FREE(push);
14471 0 : PyErr_SetNdrError(err);
14472 0 : return NULL;
14473 : }
14474 0 : blob = ndr_push_blob(push);
14475 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
14476 0 : TALLOC_FREE(push);
14477 0 : return ret;
14478 : }
14479 :
14480 0 : static PyObject *py_winreg_SaveKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14481 : {
14482 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
14483 0 : PyObject *bigendian_obj = NULL;
14484 0 : PyObject *ndr64_obj = NULL;
14485 0 : uint32_t ndr_push_flags = 0;
14486 :
14487 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
14488 : discard_const_p(char *, kwnames),
14489 : &bigendian_obj,
14490 : &ndr64_obj)) {
14491 0 : return NULL;
14492 : }
14493 :
14494 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14495 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14496 : }
14497 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14498 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
14499 : }
14500 :
14501 0 : return py_winreg_SaveKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
14502 : }
14503 :
14504 0 : static PyObject *py_winreg_SaveKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14505 : {
14506 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
14507 0 : PyObject *bigendian_obj = NULL;
14508 0 : PyObject *ndr64_obj = NULL;
14509 0 : uint32_t ndr_push_flags = 0;
14510 :
14511 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
14512 : discard_const_p(char *, kwnames),
14513 : &bigendian_obj,
14514 : &ndr64_obj)) {
14515 0 : return NULL;
14516 : }
14517 :
14518 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14519 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14520 : }
14521 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14522 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
14523 : }
14524 :
14525 0 : return py_winreg_SaveKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
14526 : }
14527 :
14528 0 : static PyObject *py_winreg_SaveKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
14529 : {
14530 0 : const struct ndr_interface_call *call = NULL;
14531 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(py_obj);
14532 0 : struct ndr_pull *pull = NULL;
14533 : enum ndr_err_code err;
14534 :
14535 0 : if (ndr_table_winreg.num_calls < 21) {
14536 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKey_ndr_unpack");
14537 0 : return NULL;
14538 : }
14539 0 : call = &ndr_table_winreg.calls[20];
14540 :
14541 0 : pull = ndr_pull_init_blob(blob, object);
14542 0 : if (pull == NULL) {
14543 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14544 0 : return NULL;
14545 : }
14546 :
14547 0 : pull->flags |= ndr_pull_flags;
14548 :
14549 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
14550 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14551 0 : TALLOC_FREE(pull);
14552 0 : PyErr_SetNdrError(err);
14553 0 : return NULL;
14554 : }
14555 0 : if (!allow_remaining) {
14556 : uint32_t highest_ofs;
14557 :
14558 0 : if (pull->offset > pull->relative_highest_offset) {
14559 0 : highest_ofs = pull->offset;
14560 : } else {
14561 0 : highest_ofs = pull->relative_highest_offset;
14562 : }
14563 0 : if (highest_ofs < pull->data_size) {
14564 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
14565 : "not all bytes consumed ofs[%u] size[%u]",
14566 : highest_ofs, pull->data_size);
14567 0 : TALLOC_FREE(pull);
14568 0 : PyErr_SetNdrError(err);
14569 0 : return NULL;
14570 : }
14571 : }
14572 :
14573 0 : TALLOC_FREE(pull);
14574 0 : Py_RETURN_NONE;
14575 : }
14576 :
14577 0 : static PyObject *py_winreg_SaveKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14578 : {
14579 : DATA_BLOB blob;
14580 0 : Py_ssize_t blob_length = 0;
14581 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14582 0 : PyObject *bigendian_obj = NULL;
14583 0 : PyObject *ndr64_obj = NULL;
14584 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14585 0 : PyObject *allow_remaining_obj = NULL;
14586 0 : bool allow_remaining = false;
14587 :
14588 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
14589 : discard_const_p(char *, kwnames),
14590 : &blob.data, &blob_length,
14591 : &bigendian_obj,
14592 : &ndr64_obj,
14593 : &allow_remaining_obj)) {
14594 0 : return NULL;
14595 : }
14596 0 : blob.length = blob_length;
14597 :
14598 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14599 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14600 : }
14601 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14602 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14603 : }
14604 :
14605 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14606 0 : allow_remaining = true;
14607 : }
14608 :
14609 0 : return py_winreg_SaveKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
14610 : }
14611 :
14612 0 : static PyObject *py_winreg_SaveKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14613 : {
14614 : DATA_BLOB blob;
14615 0 : Py_ssize_t blob_length = 0;
14616 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
14617 0 : PyObject *bigendian_obj = NULL;
14618 0 : PyObject *ndr64_obj = NULL;
14619 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
14620 0 : PyObject *allow_remaining_obj = NULL;
14621 0 : bool allow_remaining = false;
14622 :
14623 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
14624 : discard_const_p(char *, kwnames),
14625 : &blob.data, &blob_length,
14626 : &bigendian_obj,
14627 : &ndr64_obj,
14628 : &allow_remaining_obj)) {
14629 0 : return NULL;
14630 : }
14631 0 : blob.length = blob_length;
14632 :
14633 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14634 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
14635 : }
14636 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14637 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
14638 : }
14639 :
14640 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
14641 0 : allow_remaining = true;
14642 : }
14643 :
14644 0 : return py_winreg_SaveKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
14645 : }
14646 :
14647 0 : static PyObject *py_winreg_SaveKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
14648 : {
14649 0 : const struct ndr_interface_call *call = NULL;
14650 0 : struct winreg_SaveKey *object = (struct winreg_SaveKey *)pytalloc_get_ptr(py_obj);
14651 : PyObject *ret;
14652 : char *retstr;
14653 :
14654 0 : if (ndr_table_winreg.num_calls < 21) {
14655 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKey_ndr_print");
14656 0 : return NULL;
14657 : }
14658 0 : call = &ndr_table_winreg.calls[20];
14659 :
14660 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
14661 0 : ret = PyUnicode_FromString(retstr);
14662 0 : TALLOC_FREE(retstr);
14663 :
14664 0 : return ret;
14665 : }
14666 :
14667 0 : static PyObject *py_winreg_SaveKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14668 : {
14669 0 : return py_winreg_SaveKey_ndr_print(py_obj, "winreg_SaveKey_in", NDR_IN);
14670 : }
14671 :
14672 0 : static PyObject *py_winreg_SaveKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
14673 : {
14674 0 : return py_winreg_SaveKey_ndr_print(py_obj, "winreg_SaveKey_out", NDR_OUT);
14675 : }
14676 :
14677 : static PyMethodDef py_winreg_SaveKey_methods[] = {
14678 : { "opnum", (PyCFunction)py_winreg_SaveKey_ndr_opnum, METH_NOARGS|METH_CLASS,
14679 : "winreg.SaveKey.opnum() -> 20 (0x14) " },
14680 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
14681 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
14682 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
14683 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
14684 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
14685 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
14686 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
14687 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
14688 : { "__ndr_print_in__", (PyCFunction)py_winreg_SaveKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
14689 : { "__ndr_print_out__", (PyCFunction)py_winreg_SaveKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
14690 : { NULL, NULL, 0, NULL }
14691 : };
14692 :
14693 :
14694 : static PyTypeObject winreg_SaveKey_Type = {
14695 : PyVarObject_HEAD_INIT(NULL, 0)
14696 : .tp_name = "winreg.SaveKey",
14697 : .tp_getset = py_winreg_SaveKey_getsetters,
14698 : .tp_methods = py_winreg_SaveKey_methods,
14699 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
14700 : .tp_new = py_winreg_SaveKey_new,
14701 : };
14702 :
14703 0 : static bool pack_py_winreg_SaveKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_SaveKey *r)
14704 : {
14705 : PyObject *py_handle;
14706 : PyObject *py_filename;
14707 : PyObject *py_sec_attrib;
14708 0 : const char *kwnames[] = {
14709 : "handle", "filename", "sec_attrib", NULL
14710 : };
14711 :
14712 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_SaveKey", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_sec_attrib)) {
14713 0 : return false;
14714 : }
14715 :
14716 0 : if (py_handle == NULL) {
14717 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
14718 0 : return false;
14719 : }
14720 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
14721 0 : if (r->in.handle == NULL) {
14722 0 : PyErr_NoMemory();
14723 0 : return false;
14724 : }
14725 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
14726 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
14727 0 : PyErr_NoMemory();
14728 0 : return false;
14729 : }
14730 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
14731 0 : if (py_filename == NULL) {
14732 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.filename");
14733 0 : return false;
14734 : }
14735 0 : r->in.filename = talloc_ptrtype(r, r->in.filename);
14736 0 : if (r->in.filename == NULL) {
14737 0 : PyErr_NoMemory();
14738 0 : return false;
14739 : }
14740 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
14741 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
14742 0 : PyErr_NoMemory();
14743 0 : return false;
14744 : }
14745 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
14746 0 : if (py_sec_attrib == NULL) {
14747 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sec_attrib");
14748 0 : return false;
14749 : }
14750 0 : if (py_sec_attrib == Py_None) {
14751 0 : r->in.sec_attrib = NULL;
14752 : } else {
14753 0 : r->in.sec_attrib = NULL;
14754 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, py_sec_attrib, return false;);
14755 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sec_attrib)) == NULL) {
14756 0 : PyErr_NoMemory();
14757 0 : return false;
14758 : }
14759 0 : r->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(py_sec_attrib);
14760 : }
14761 0 : return true;
14762 : }
14763 :
14764 0 : static PyObject *unpack_py_winreg_SaveKey_args_out(struct winreg_SaveKey *r)
14765 : {
14766 : PyObject *result;
14767 0 : result = Py_None;
14768 0 : Py_INCREF(result);
14769 0 : if (!W_ERROR_IS_OK(r->out.result)) {
14770 0 : PyErr_SetWERROR(r->out.result);
14771 0 : return NULL;
14772 : }
14773 :
14774 0 : return result;
14775 : }
14776 :
14777 :
14778 0 : static PyObject *py_winreg_SetKeySecurity_in_get_handle(PyObject *obj, void *closure)
14779 : {
14780 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(obj);
14781 : PyObject *py_handle;
14782 0 : if (object->in.handle == NULL) {
14783 0 : Py_RETURN_NONE;
14784 : }
14785 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
14786 0 : return py_handle;
14787 : }
14788 :
14789 0 : static int py_winreg_SetKeySecurity_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
14790 : {
14791 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(py_obj);
14792 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
14793 0 : if (value == NULL) {
14794 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
14795 0 : return -1;
14796 : }
14797 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
14798 0 : if (object->in.handle == NULL) {
14799 0 : PyErr_NoMemory();
14800 0 : return -1;
14801 : }
14802 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
14803 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14804 0 : PyErr_NoMemory();
14805 0 : return -1;
14806 : }
14807 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
14808 0 : return 0;
14809 : }
14810 :
14811 0 : static PyObject *py_winreg_SetKeySecurity_in_get_sec_info(PyObject *obj, void *closure)
14812 : {
14813 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(obj);
14814 : PyObject *py_sec_info;
14815 0 : py_sec_info = PyLong_FromUnsignedLongLong((uint32_t)object->in.sec_info);
14816 0 : return py_sec_info;
14817 : }
14818 :
14819 0 : static int py_winreg_SetKeySecurity_in_set_sec_info(PyObject *py_obj, PyObject *value, void *closure)
14820 : {
14821 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(py_obj);
14822 0 : if (value == NULL) {
14823 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sec_info");
14824 0 : return -1;
14825 : }
14826 : {
14827 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.sec_info));
14828 0 : if (PyLong_Check(value)) {
14829 : unsigned long long test_var;
14830 0 : test_var = PyLong_AsUnsignedLongLong(value);
14831 0 : if (PyErr_Occurred() != NULL) {
14832 0 : return -1;
14833 : }
14834 0 : if (test_var > uint_max) {
14835 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
14836 : PyLong_Type.tp_name, uint_max, test_var);
14837 0 : return -1;
14838 : }
14839 0 : object->in.sec_info = test_var;
14840 : } else {
14841 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
14842 : PyLong_Type.tp_name);
14843 0 : return -1;
14844 : }
14845 : }
14846 0 : return 0;
14847 : }
14848 :
14849 0 : static PyObject *py_winreg_SetKeySecurity_in_get_sd(PyObject *obj, void *closure)
14850 : {
14851 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(obj);
14852 : PyObject *py_sd;
14853 0 : if (object->in.sd == NULL) {
14854 0 : Py_RETURN_NONE;
14855 : }
14856 0 : py_sd = pytalloc_reference_ex(&KeySecurityData_Type, object->in.sd, object->in.sd);
14857 0 : return py_sd;
14858 : }
14859 :
14860 0 : static int py_winreg_SetKeySecurity_in_set_sd(PyObject *py_obj, PyObject *value, void *closure)
14861 : {
14862 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(py_obj);
14863 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sd));
14864 0 : if (value == NULL) {
14865 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sd");
14866 0 : return -1;
14867 : }
14868 0 : object->in.sd = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.sd);
14869 0 : if (object->in.sd == NULL) {
14870 0 : PyErr_NoMemory();
14871 0 : return -1;
14872 : }
14873 0 : PY_CHECK_TYPE(&KeySecurityData_Type, value, return -1;);
14874 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
14875 0 : PyErr_NoMemory();
14876 0 : return -1;
14877 : }
14878 0 : object->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(value);
14879 0 : return 0;
14880 : }
14881 :
14882 0 : static PyObject *py_winreg_SetKeySecurity_get_result(PyObject *obj, void *closure)
14883 : {
14884 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(obj);
14885 : PyObject *py_result;
14886 0 : py_result = PyErr_FromWERROR(object->out.result);
14887 0 : return py_result;
14888 : }
14889 :
14890 0 : static int py_winreg_SetKeySecurity_set_result(PyObject *py_obj, PyObject *value, void *closure)
14891 : {
14892 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(py_obj);
14893 0 : if (value == NULL) {
14894 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
14895 0 : return -1;
14896 : }
14897 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
14898 0 : return 0;
14899 : }
14900 :
14901 : static PyGetSetDef py_winreg_SetKeySecurity_getsetters[] = {
14902 : {
14903 : .name = discard_const_p(char, "in_handle"),
14904 : .get = py_winreg_SetKeySecurity_in_get_handle,
14905 : .set = py_winreg_SetKeySecurity_in_set_handle,
14906 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
14907 : },
14908 : {
14909 : .name = discard_const_p(char, "in_sec_info"),
14910 : .get = py_winreg_SetKeySecurity_in_get_sec_info,
14911 : .set = py_winreg_SetKeySecurity_in_set_sec_info,
14912 : .doc = discard_const_p(char, "PIDL-generated element of base type security_secinfo")
14913 : },
14914 : {
14915 : .name = discard_const_p(char, "in_sd"),
14916 : .get = py_winreg_SetKeySecurity_in_get_sd,
14917 : .set = py_winreg_SetKeySecurity_in_set_sd,
14918 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityData")
14919 : },
14920 : {
14921 : .name = discard_const_p(char, "result"),
14922 : .get = py_winreg_SetKeySecurity_get_result,
14923 : .set = py_winreg_SetKeySecurity_set_result,
14924 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
14925 : },
14926 : { .name = NULL }
14927 : };
14928 :
14929 0 : static PyObject *py_winreg_SetKeySecurity_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
14930 : {
14931 0 : PyObject *self = pytalloc_new(struct winreg_SetKeySecurity, type);
14932 0 : struct winreg_SetKeySecurity *_self = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(self);
14933 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
14934 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
14935 0 : _self->in.sd = talloc_zero(mem_ctx, struct KeySecurityData);
14936 0 : return self;
14937 : }
14938 :
14939 0 : static PyObject *py_winreg_SetKeySecurity_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
14940 : {
14941 :
14942 :
14943 0 : return PyLong_FromLong(21);
14944 : }
14945 :
14946 0 : static PyObject *py_winreg_SetKeySecurity_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
14947 : {
14948 0 : const struct ndr_interface_call *call = NULL;
14949 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(py_obj);
14950 0 : PyObject *ret = NULL;
14951 0 : struct ndr_push *push = NULL;
14952 : DATA_BLOB blob;
14953 : enum ndr_err_code err;
14954 :
14955 0 : if (ndr_table_winreg.num_calls < 22) {
14956 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetKeySecurity_ndr_pack");
14957 0 : return NULL;
14958 : }
14959 0 : call = &ndr_table_winreg.calls[21];
14960 :
14961 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
14962 0 : if (push == NULL) {
14963 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
14964 0 : return NULL;
14965 : }
14966 :
14967 0 : push->flags |= ndr_push_flags;
14968 :
14969 0 : err = call->ndr_push(push, ndr_inout_flags, object);
14970 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
14971 0 : TALLOC_FREE(push);
14972 0 : PyErr_SetNdrError(err);
14973 0 : return NULL;
14974 : }
14975 0 : blob = ndr_push_blob(push);
14976 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
14977 0 : TALLOC_FREE(push);
14978 0 : return ret;
14979 : }
14980 :
14981 0 : static PyObject *py_winreg_SetKeySecurity_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
14982 : {
14983 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
14984 0 : PyObject *bigendian_obj = NULL;
14985 0 : PyObject *ndr64_obj = NULL;
14986 0 : uint32_t ndr_push_flags = 0;
14987 :
14988 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
14989 : discard_const_p(char *, kwnames),
14990 : &bigendian_obj,
14991 : &ndr64_obj)) {
14992 0 : return NULL;
14993 : }
14994 :
14995 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
14996 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
14997 : }
14998 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
14999 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
15000 : }
15001 :
15002 0 : return py_winreg_SetKeySecurity_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
15003 : }
15004 :
15005 0 : static PyObject *py_winreg_SetKeySecurity_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15006 : {
15007 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
15008 0 : PyObject *bigendian_obj = NULL;
15009 0 : PyObject *ndr64_obj = NULL;
15010 0 : uint32_t ndr_push_flags = 0;
15011 :
15012 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
15013 : discard_const_p(char *, kwnames),
15014 : &bigendian_obj,
15015 : &ndr64_obj)) {
15016 0 : return NULL;
15017 : }
15018 :
15019 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15020 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
15021 : }
15022 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15023 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
15024 : }
15025 :
15026 0 : return py_winreg_SetKeySecurity_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
15027 : }
15028 :
15029 0 : static PyObject *py_winreg_SetKeySecurity_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
15030 : {
15031 0 : const struct ndr_interface_call *call = NULL;
15032 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(py_obj);
15033 0 : struct ndr_pull *pull = NULL;
15034 : enum ndr_err_code err;
15035 :
15036 0 : if (ndr_table_winreg.num_calls < 22) {
15037 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetKeySecurity_ndr_unpack");
15038 0 : return NULL;
15039 : }
15040 0 : call = &ndr_table_winreg.calls[21];
15041 :
15042 0 : pull = ndr_pull_init_blob(blob, object);
15043 0 : if (pull == NULL) {
15044 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
15045 0 : return NULL;
15046 : }
15047 :
15048 0 : pull->flags |= ndr_pull_flags;
15049 :
15050 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
15051 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
15052 0 : TALLOC_FREE(pull);
15053 0 : PyErr_SetNdrError(err);
15054 0 : return NULL;
15055 : }
15056 0 : if (!allow_remaining) {
15057 : uint32_t highest_ofs;
15058 :
15059 0 : if (pull->offset > pull->relative_highest_offset) {
15060 0 : highest_ofs = pull->offset;
15061 : } else {
15062 0 : highest_ofs = pull->relative_highest_offset;
15063 : }
15064 0 : if (highest_ofs < pull->data_size) {
15065 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
15066 : "not all bytes consumed ofs[%u] size[%u]",
15067 : highest_ofs, pull->data_size);
15068 0 : TALLOC_FREE(pull);
15069 0 : PyErr_SetNdrError(err);
15070 0 : return NULL;
15071 : }
15072 : }
15073 :
15074 0 : TALLOC_FREE(pull);
15075 0 : Py_RETURN_NONE;
15076 : }
15077 :
15078 0 : static PyObject *py_winreg_SetKeySecurity_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15079 : {
15080 : DATA_BLOB blob;
15081 0 : Py_ssize_t blob_length = 0;
15082 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15083 0 : PyObject *bigendian_obj = NULL;
15084 0 : PyObject *ndr64_obj = NULL;
15085 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15086 0 : PyObject *allow_remaining_obj = NULL;
15087 0 : bool allow_remaining = false;
15088 :
15089 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
15090 : discard_const_p(char *, kwnames),
15091 : &blob.data, &blob_length,
15092 : &bigendian_obj,
15093 : &ndr64_obj,
15094 : &allow_remaining_obj)) {
15095 0 : return NULL;
15096 : }
15097 0 : blob.length = blob_length;
15098 :
15099 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15100 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15101 : }
15102 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15103 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15104 : }
15105 :
15106 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15107 0 : allow_remaining = true;
15108 : }
15109 :
15110 0 : return py_winreg_SetKeySecurity_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
15111 : }
15112 :
15113 0 : static PyObject *py_winreg_SetKeySecurity_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15114 : {
15115 : DATA_BLOB blob;
15116 0 : Py_ssize_t blob_length = 0;
15117 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15118 0 : PyObject *bigendian_obj = NULL;
15119 0 : PyObject *ndr64_obj = NULL;
15120 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15121 0 : PyObject *allow_remaining_obj = NULL;
15122 0 : bool allow_remaining = false;
15123 :
15124 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
15125 : discard_const_p(char *, kwnames),
15126 : &blob.data, &blob_length,
15127 : &bigendian_obj,
15128 : &ndr64_obj,
15129 : &allow_remaining_obj)) {
15130 0 : return NULL;
15131 : }
15132 0 : blob.length = blob_length;
15133 :
15134 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15135 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15136 : }
15137 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15138 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15139 : }
15140 :
15141 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15142 0 : allow_remaining = true;
15143 : }
15144 :
15145 0 : return py_winreg_SetKeySecurity_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
15146 : }
15147 :
15148 0 : static PyObject *py_winreg_SetKeySecurity_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
15149 : {
15150 0 : const struct ndr_interface_call *call = NULL;
15151 0 : struct winreg_SetKeySecurity *object = (struct winreg_SetKeySecurity *)pytalloc_get_ptr(py_obj);
15152 : PyObject *ret;
15153 : char *retstr;
15154 :
15155 0 : if (ndr_table_winreg.num_calls < 22) {
15156 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetKeySecurity_ndr_print");
15157 0 : return NULL;
15158 : }
15159 0 : call = &ndr_table_winreg.calls[21];
15160 :
15161 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
15162 0 : ret = PyUnicode_FromString(retstr);
15163 0 : TALLOC_FREE(retstr);
15164 :
15165 0 : return ret;
15166 : }
15167 :
15168 0 : static PyObject *py_winreg_SetKeySecurity_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15169 : {
15170 0 : return py_winreg_SetKeySecurity_ndr_print(py_obj, "winreg_SetKeySecurity_in", NDR_IN);
15171 : }
15172 :
15173 0 : static PyObject *py_winreg_SetKeySecurity_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15174 : {
15175 0 : return py_winreg_SetKeySecurity_ndr_print(py_obj, "winreg_SetKeySecurity_out", NDR_OUT);
15176 : }
15177 :
15178 : static PyMethodDef py_winreg_SetKeySecurity_methods[] = {
15179 : { "opnum", (PyCFunction)py_winreg_SetKeySecurity_ndr_opnum, METH_NOARGS|METH_CLASS,
15180 : "winreg.SetKeySecurity.opnum() -> 21 (0x15) " },
15181 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
15182 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
15183 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
15184 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
15185 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
15186 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
15187 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetKeySecurity_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
15188 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
15189 : { "__ndr_print_in__", (PyCFunction)py_winreg_SetKeySecurity_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
15190 : { "__ndr_print_out__", (PyCFunction)py_winreg_SetKeySecurity_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
15191 : { NULL, NULL, 0, NULL }
15192 : };
15193 :
15194 :
15195 : static PyTypeObject winreg_SetKeySecurity_Type = {
15196 : PyVarObject_HEAD_INIT(NULL, 0)
15197 : .tp_name = "winreg.SetKeySecurity",
15198 : .tp_getset = py_winreg_SetKeySecurity_getsetters,
15199 : .tp_methods = py_winreg_SetKeySecurity_methods,
15200 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
15201 : .tp_new = py_winreg_SetKeySecurity_new,
15202 : };
15203 :
15204 0 : static bool pack_py_winreg_SetKeySecurity_args_in(PyObject *args, PyObject *kwargs, struct winreg_SetKeySecurity *r)
15205 : {
15206 : PyObject *py_handle;
15207 : PyObject *py_sec_info;
15208 : PyObject *py_sd;
15209 0 : const char *kwnames[] = {
15210 : "handle", "sec_info", "sd", NULL
15211 : };
15212 :
15213 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_SetKeySecurity", discard_const_p(char *, kwnames), &py_handle, &py_sec_info, &py_sd)) {
15214 0 : return false;
15215 : }
15216 :
15217 0 : if (py_handle == NULL) {
15218 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
15219 0 : return false;
15220 : }
15221 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
15222 0 : if (r->in.handle == NULL) {
15223 0 : PyErr_NoMemory();
15224 0 : return false;
15225 : }
15226 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
15227 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
15228 0 : PyErr_NoMemory();
15229 0 : return false;
15230 : }
15231 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
15232 0 : if (py_sec_info == NULL) {
15233 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sec_info");
15234 0 : return false;
15235 : }
15236 : {
15237 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.sec_info));
15238 0 : if (PyLong_Check(py_sec_info)) {
15239 : unsigned long long test_var;
15240 0 : test_var = PyLong_AsUnsignedLongLong(py_sec_info);
15241 0 : if (PyErr_Occurred() != NULL) {
15242 0 : return false;
15243 : }
15244 0 : if (test_var > uint_max) {
15245 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15246 : PyLong_Type.tp_name, uint_max, test_var);
15247 0 : return false;
15248 : }
15249 0 : r->in.sec_info = test_var;
15250 : } else {
15251 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15252 : PyLong_Type.tp_name);
15253 0 : return false;
15254 : }
15255 : }
15256 0 : if (py_sd == NULL) {
15257 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sd");
15258 0 : return false;
15259 : }
15260 0 : r->in.sd = talloc_ptrtype(r, r->in.sd);
15261 0 : if (r->in.sd == NULL) {
15262 0 : PyErr_NoMemory();
15263 0 : return false;
15264 : }
15265 0 : PY_CHECK_TYPE(&KeySecurityData_Type, py_sd, return false;);
15266 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sd)) == NULL) {
15267 0 : PyErr_NoMemory();
15268 0 : return false;
15269 : }
15270 0 : r->in.sd = (struct KeySecurityData *)pytalloc_get_ptr(py_sd);
15271 0 : return true;
15272 : }
15273 :
15274 0 : static PyObject *unpack_py_winreg_SetKeySecurity_args_out(struct winreg_SetKeySecurity *r)
15275 : {
15276 : PyObject *result;
15277 0 : result = Py_None;
15278 0 : Py_INCREF(result);
15279 0 : if (!W_ERROR_IS_OK(r->out.result)) {
15280 0 : PyErr_SetWERROR(r->out.result);
15281 0 : return NULL;
15282 : }
15283 :
15284 0 : return result;
15285 : }
15286 :
15287 :
15288 0 : static PyObject *py_winreg_SetValue_in_get_handle(PyObject *obj, void *closure)
15289 : {
15290 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(obj);
15291 : PyObject *py_handle;
15292 0 : if (object->in.handle == NULL) {
15293 0 : Py_RETURN_NONE;
15294 : }
15295 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
15296 0 : return py_handle;
15297 : }
15298 :
15299 0 : static int py_winreg_SetValue_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
15300 : {
15301 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15302 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
15303 0 : if (value == NULL) {
15304 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
15305 0 : return -1;
15306 : }
15307 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
15308 0 : if (object->in.handle == NULL) {
15309 0 : PyErr_NoMemory();
15310 0 : return -1;
15311 : }
15312 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
15313 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
15314 0 : PyErr_NoMemory();
15315 0 : return -1;
15316 : }
15317 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
15318 0 : return 0;
15319 : }
15320 :
15321 0 : static PyObject *py_winreg_SetValue_in_get_name(PyObject *obj, void *closure)
15322 : {
15323 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(obj);
15324 : PyObject *py_name;
15325 0 : py_name = pytalloc_reference_ex(&winreg_String_Type, pytalloc_get_mem_ctx(obj), &object->in.name);
15326 0 : return py_name;
15327 : }
15328 :
15329 0 : static int py_winreg_SetValue_in_set_name(PyObject *py_obj, PyObject *value, void *closure)
15330 : {
15331 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15332 0 : if (value == NULL) {
15333 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.name");
15334 0 : return -1;
15335 : }
15336 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
15337 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
15338 0 : PyErr_NoMemory();
15339 0 : return -1;
15340 : }
15341 0 : object->in.name = *(struct winreg_String *)pytalloc_get_ptr(value);
15342 0 : return 0;
15343 : }
15344 :
15345 0 : static PyObject *py_winreg_SetValue_in_get_type(PyObject *obj, void *closure)
15346 : {
15347 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(obj);
15348 : PyObject *py_type;
15349 0 : py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type);
15350 0 : return py_type;
15351 : }
15352 :
15353 0 : static int py_winreg_SetValue_in_set_type(PyObject *py_obj, PyObject *value, void *closure)
15354 : {
15355 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15356 0 : if (value == NULL) {
15357 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.type");
15358 0 : return -1;
15359 : }
15360 : {
15361 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.type));
15362 0 : if (PyLong_Check(value)) {
15363 : unsigned long long test_var;
15364 0 : test_var = PyLong_AsUnsignedLongLong(value);
15365 0 : if (PyErr_Occurred() != NULL) {
15366 0 : return -1;
15367 : }
15368 0 : if (test_var > uint_max) {
15369 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15370 : PyLong_Type.tp_name, uint_max, test_var);
15371 0 : return -1;
15372 : }
15373 0 : object->in.type = test_var;
15374 : } else {
15375 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15376 : PyLong_Type.tp_name);
15377 0 : return -1;
15378 : }
15379 : }
15380 0 : return 0;
15381 : }
15382 :
15383 0 : static PyObject *py_winreg_SetValue_in_get_data(PyObject *obj, void *closure)
15384 : {
15385 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(obj);
15386 : PyObject *py_data;
15387 0 : if (object->in.data == NULL) {
15388 0 : Py_RETURN_NONE;
15389 : }
15390 0 : py_data = PyList_New(object->in.size);
15391 0 : if (py_data == NULL) {
15392 0 : return NULL;
15393 : }
15394 : {
15395 : int data_cntr_1;
15396 0 : for (data_cntr_1 = 0; data_cntr_1 < (object->in.size); data_cntr_1++) {
15397 : PyObject *py_data_1;
15398 0 : py_data_1 = PyLong_FromLong((uint16_t)object->in.data[data_cntr_1]);
15399 0 : PyList_SetItem(py_data, data_cntr_1, py_data_1);
15400 : }
15401 : }
15402 0 : return py_data;
15403 : }
15404 :
15405 0 : static int py_winreg_SetValue_in_set_data(PyObject *py_obj, PyObject *value, void *closure)
15406 : {
15407 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15408 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.data));
15409 0 : if (value == NULL) {
15410 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data");
15411 0 : return -1;
15412 : }
15413 0 : object->in.data = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data);
15414 0 : if (object->in.data == NULL) {
15415 0 : PyErr_NoMemory();
15416 0 : return -1;
15417 : }
15418 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
15419 : {
15420 : int data_cntr_1;
15421 0 : object->in.data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.data, PyList_GET_SIZE(value));
15422 0 : if (!object->in.data) { return -1;; }
15423 0 : talloc_set_name_const(object->in.data, "ARRAY: object->in.data");
15424 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(value); data_cntr_1++) {
15425 0 : if (PyList_GET_ITEM(value, data_cntr_1) == NULL) {
15426 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.data[data_cntr_1]");
15427 0 : return -1;
15428 : }
15429 : {
15430 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.data[data_cntr_1]));
15431 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_1))) {
15432 : unsigned long long test_var;
15433 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_1));
15434 0 : if (PyErr_Occurred() != NULL) {
15435 0 : return -1;
15436 : }
15437 0 : if (test_var > uint_max) {
15438 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15439 : PyLong_Type.tp_name, uint_max, test_var);
15440 0 : return -1;
15441 : }
15442 0 : object->in.data[data_cntr_1] = test_var;
15443 : } else {
15444 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15445 : PyLong_Type.tp_name);
15446 0 : return -1;
15447 : }
15448 : }
15449 : }
15450 : }
15451 0 : return 0;
15452 : }
15453 :
15454 0 : static PyObject *py_winreg_SetValue_in_get_size(PyObject *obj, void *closure)
15455 : {
15456 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(obj);
15457 : PyObject *py_size;
15458 0 : py_size = PyLong_FromUnsignedLongLong((uint32_t)object->in.size);
15459 0 : return py_size;
15460 : }
15461 :
15462 0 : static int py_winreg_SetValue_in_set_size(PyObject *py_obj, PyObject *value, void *closure)
15463 : {
15464 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15465 0 : if (value == NULL) {
15466 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.size");
15467 0 : return -1;
15468 : }
15469 : {
15470 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.size));
15471 0 : if (PyLong_Check(value)) {
15472 : unsigned long long test_var;
15473 0 : test_var = PyLong_AsUnsignedLongLong(value);
15474 0 : if (PyErr_Occurred() != NULL) {
15475 0 : return -1;
15476 : }
15477 0 : if (test_var > uint_max) {
15478 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15479 : PyLong_Type.tp_name, uint_max, test_var);
15480 0 : return -1;
15481 : }
15482 0 : object->in.size = test_var;
15483 : } else {
15484 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15485 : PyLong_Type.tp_name);
15486 0 : return -1;
15487 : }
15488 : }
15489 0 : return 0;
15490 : }
15491 :
15492 0 : static PyObject *py_winreg_SetValue_get_result(PyObject *obj, void *closure)
15493 : {
15494 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(obj);
15495 : PyObject *py_result;
15496 0 : py_result = PyErr_FromWERROR(object->out.result);
15497 0 : return py_result;
15498 : }
15499 :
15500 0 : static int py_winreg_SetValue_set_result(PyObject *py_obj, PyObject *value, void *closure)
15501 : {
15502 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15503 0 : if (value == NULL) {
15504 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
15505 0 : return -1;
15506 : }
15507 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
15508 0 : return 0;
15509 : }
15510 :
15511 : static PyGetSetDef py_winreg_SetValue_getsetters[] = {
15512 : {
15513 : .name = discard_const_p(char, "in_handle"),
15514 : .get = py_winreg_SetValue_in_get_handle,
15515 : .set = py_winreg_SetValue_in_set_handle,
15516 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
15517 : },
15518 : {
15519 : .name = discard_const_p(char, "in_name"),
15520 : .get = py_winreg_SetValue_in_get_name,
15521 : .set = py_winreg_SetValue_in_set_name,
15522 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
15523 : },
15524 : {
15525 : .name = discard_const_p(char, "in_type"),
15526 : .get = py_winreg_SetValue_in_get_type,
15527 : .set = py_winreg_SetValue_in_set_type,
15528 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type")
15529 : },
15530 : {
15531 : .name = discard_const_p(char, "in_data"),
15532 : .get = py_winreg_SetValue_in_get_data,
15533 : .set = py_winreg_SetValue_in_set_data,
15534 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
15535 : },
15536 : {
15537 : .name = discard_const_p(char, "in_size"),
15538 : .get = py_winreg_SetValue_in_get_size,
15539 : .set = py_winreg_SetValue_in_set_size,
15540 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
15541 : },
15542 : {
15543 : .name = discard_const_p(char, "result"),
15544 : .get = py_winreg_SetValue_get_result,
15545 : .set = py_winreg_SetValue_set_result,
15546 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
15547 : },
15548 : { .name = NULL }
15549 : };
15550 :
15551 0 : static PyObject *py_winreg_SetValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
15552 : {
15553 0 : PyObject *self = pytalloc_new(struct winreg_SetValue, type);
15554 0 : struct winreg_SetValue *_self = (struct winreg_SetValue *)pytalloc_get_ptr(self);
15555 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
15556 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
15557 0 : _self->in.data = talloc_zero(mem_ctx, uint8_t);
15558 0 : return self;
15559 : }
15560 :
15561 0 : static PyObject *py_winreg_SetValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
15562 : {
15563 :
15564 :
15565 0 : return PyLong_FromLong(22);
15566 : }
15567 :
15568 0 : static PyObject *py_winreg_SetValue_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
15569 : {
15570 0 : const struct ndr_interface_call *call = NULL;
15571 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15572 0 : PyObject *ret = NULL;
15573 0 : struct ndr_push *push = NULL;
15574 : DATA_BLOB blob;
15575 : enum ndr_err_code err;
15576 :
15577 0 : if (ndr_table_winreg.num_calls < 23) {
15578 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetValue_ndr_pack");
15579 0 : return NULL;
15580 : }
15581 0 : call = &ndr_table_winreg.calls[22];
15582 :
15583 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
15584 0 : if (push == NULL) {
15585 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
15586 0 : return NULL;
15587 : }
15588 :
15589 0 : push->flags |= ndr_push_flags;
15590 :
15591 0 : err = call->ndr_push(push, ndr_inout_flags, object);
15592 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
15593 0 : TALLOC_FREE(push);
15594 0 : PyErr_SetNdrError(err);
15595 0 : return NULL;
15596 : }
15597 0 : blob = ndr_push_blob(push);
15598 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
15599 0 : TALLOC_FREE(push);
15600 0 : return ret;
15601 : }
15602 :
15603 0 : static PyObject *py_winreg_SetValue_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15604 : {
15605 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
15606 0 : PyObject *bigendian_obj = NULL;
15607 0 : PyObject *ndr64_obj = NULL;
15608 0 : uint32_t ndr_push_flags = 0;
15609 :
15610 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
15611 : discard_const_p(char *, kwnames),
15612 : &bigendian_obj,
15613 : &ndr64_obj)) {
15614 0 : return NULL;
15615 : }
15616 :
15617 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15618 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
15619 : }
15620 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15621 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
15622 : }
15623 :
15624 0 : return py_winreg_SetValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
15625 : }
15626 :
15627 0 : static PyObject *py_winreg_SetValue_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15628 : {
15629 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
15630 0 : PyObject *bigendian_obj = NULL;
15631 0 : PyObject *ndr64_obj = NULL;
15632 0 : uint32_t ndr_push_flags = 0;
15633 :
15634 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
15635 : discard_const_p(char *, kwnames),
15636 : &bigendian_obj,
15637 : &ndr64_obj)) {
15638 0 : return NULL;
15639 : }
15640 :
15641 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15642 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
15643 : }
15644 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15645 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
15646 : }
15647 :
15648 0 : return py_winreg_SetValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
15649 : }
15650 :
15651 0 : static PyObject *py_winreg_SetValue_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
15652 : {
15653 0 : const struct ndr_interface_call *call = NULL;
15654 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15655 0 : struct ndr_pull *pull = NULL;
15656 : enum ndr_err_code err;
15657 :
15658 0 : if (ndr_table_winreg.num_calls < 23) {
15659 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetValue_ndr_unpack");
15660 0 : return NULL;
15661 : }
15662 0 : call = &ndr_table_winreg.calls[22];
15663 :
15664 0 : pull = ndr_pull_init_blob(blob, object);
15665 0 : if (pull == NULL) {
15666 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
15667 0 : return NULL;
15668 : }
15669 :
15670 0 : pull->flags |= ndr_pull_flags;
15671 :
15672 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
15673 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
15674 0 : TALLOC_FREE(pull);
15675 0 : PyErr_SetNdrError(err);
15676 0 : return NULL;
15677 : }
15678 0 : if (!allow_remaining) {
15679 : uint32_t highest_ofs;
15680 :
15681 0 : if (pull->offset > pull->relative_highest_offset) {
15682 0 : highest_ofs = pull->offset;
15683 : } else {
15684 0 : highest_ofs = pull->relative_highest_offset;
15685 : }
15686 0 : if (highest_ofs < pull->data_size) {
15687 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
15688 : "not all bytes consumed ofs[%u] size[%u]",
15689 : highest_ofs, pull->data_size);
15690 0 : TALLOC_FREE(pull);
15691 0 : PyErr_SetNdrError(err);
15692 0 : return NULL;
15693 : }
15694 : }
15695 :
15696 0 : TALLOC_FREE(pull);
15697 0 : Py_RETURN_NONE;
15698 : }
15699 :
15700 0 : static PyObject *py_winreg_SetValue_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15701 : {
15702 : DATA_BLOB blob;
15703 0 : Py_ssize_t blob_length = 0;
15704 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15705 0 : PyObject *bigendian_obj = NULL;
15706 0 : PyObject *ndr64_obj = NULL;
15707 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15708 0 : PyObject *allow_remaining_obj = NULL;
15709 0 : bool allow_remaining = false;
15710 :
15711 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
15712 : discard_const_p(char *, kwnames),
15713 : &blob.data, &blob_length,
15714 : &bigendian_obj,
15715 : &ndr64_obj,
15716 : &allow_remaining_obj)) {
15717 0 : return NULL;
15718 : }
15719 0 : blob.length = blob_length;
15720 :
15721 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15722 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15723 : }
15724 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15725 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15726 : }
15727 :
15728 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15729 0 : allow_remaining = true;
15730 : }
15731 :
15732 0 : return py_winreg_SetValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
15733 : }
15734 :
15735 0 : static PyObject *py_winreg_SetValue_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
15736 : {
15737 : DATA_BLOB blob;
15738 0 : Py_ssize_t blob_length = 0;
15739 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
15740 0 : PyObject *bigendian_obj = NULL;
15741 0 : PyObject *ndr64_obj = NULL;
15742 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
15743 0 : PyObject *allow_remaining_obj = NULL;
15744 0 : bool allow_remaining = false;
15745 :
15746 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
15747 : discard_const_p(char *, kwnames),
15748 : &blob.data, &blob_length,
15749 : &bigendian_obj,
15750 : &ndr64_obj,
15751 : &allow_remaining_obj)) {
15752 0 : return NULL;
15753 : }
15754 0 : blob.length = blob_length;
15755 :
15756 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
15757 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
15758 : }
15759 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
15760 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
15761 : }
15762 :
15763 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
15764 0 : allow_remaining = true;
15765 : }
15766 :
15767 0 : return py_winreg_SetValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
15768 : }
15769 :
15770 0 : static PyObject *py_winreg_SetValue_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
15771 : {
15772 0 : const struct ndr_interface_call *call = NULL;
15773 0 : struct winreg_SetValue *object = (struct winreg_SetValue *)pytalloc_get_ptr(py_obj);
15774 : PyObject *ret;
15775 : char *retstr;
15776 :
15777 0 : if (ndr_table_winreg.num_calls < 23) {
15778 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SetValue_ndr_print");
15779 0 : return NULL;
15780 : }
15781 0 : call = &ndr_table_winreg.calls[22];
15782 :
15783 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
15784 0 : ret = PyUnicode_FromString(retstr);
15785 0 : TALLOC_FREE(retstr);
15786 :
15787 0 : return ret;
15788 : }
15789 :
15790 0 : static PyObject *py_winreg_SetValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15791 : {
15792 0 : return py_winreg_SetValue_ndr_print(py_obj, "winreg_SetValue_in", NDR_IN);
15793 : }
15794 :
15795 0 : static PyObject *py_winreg_SetValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
15796 : {
15797 0 : return py_winreg_SetValue_ndr_print(py_obj, "winreg_SetValue_out", NDR_OUT);
15798 : }
15799 :
15800 : static PyMethodDef py_winreg_SetValue_methods[] = {
15801 : { "opnum", (PyCFunction)py_winreg_SetValue_ndr_opnum, METH_NOARGS|METH_CLASS,
15802 : "winreg.SetValue.opnum() -> 22 (0x16) " },
15803 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
15804 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
15805 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
15806 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
15807 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
15808 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
15809 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SetValue_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
15810 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
15811 : { "__ndr_print_in__", (PyCFunction)py_winreg_SetValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
15812 : { "__ndr_print_out__", (PyCFunction)py_winreg_SetValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
15813 : { NULL, NULL, 0, NULL }
15814 : };
15815 :
15816 :
15817 : static PyTypeObject winreg_SetValue_Type = {
15818 : PyVarObject_HEAD_INIT(NULL, 0)
15819 : .tp_name = "winreg.SetValue",
15820 : .tp_getset = py_winreg_SetValue_getsetters,
15821 : .tp_methods = py_winreg_SetValue_methods,
15822 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
15823 : .tp_new = py_winreg_SetValue_new,
15824 : };
15825 :
15826 0 : static bool pack_py_winreg_SetValue_args_in(PyObject *args, PyObject *kwargs, struct winreg_SetValue *r)
15827 : {
15828 : PyObject *py_handle;
15829 : PyObject *py_name;
15830 : PyObject *py_type;
15831 : PyObject *py_data;
15832 0 : const char *kwnames[] = {
15833 : "handle", "name", "type", "data", NULL
15834 : };
15835 :
15836 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_SetValue", discard_const_p(char *, kwnames), &py_handle, &py_name, &py_type, &py_data)) {
15837 0 : return false;
15838 : }
15839 :
15840 0 : if (py_handle == NULL) {
15841 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
15842 0 : return false;
15843 : }
15844 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
15845 0 : if (r->in.handle == NULL) {
15846 0 : PyErr_NoMemory();
15847 0 : return false;
15848 : }
15849 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
15850 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
15851 0 : PyErr_NoMemory();
15852 0 : return false;
15853 : }
15854 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
15855 0 : if (py_name == NULL) {
15856 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.name");
15857 0 : return false;
15858 : }
15859 0 : PY_CHECK_TYPE(&winreg_String_Type, py_name, return false;);
15860 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_name)) == NULL) {
15861 0 : PyErr_NoMemory();
15862 0 : return false;
15863 : }
15864 0 : r->in.name = *(struct winreg_String *)pytalloc_get_ptr(py_name);
15865 0 : if (py_type == NULL) {
15866 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.type");
15867 0 : return false;
15868 : }
15869 : {
15870 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.type));
15871 0 : if (PyLong_Check(py_type)) {
15872 : unsigned long long test_var;
15873 0 : test_var = PyLong_AsUnsignedLongLong(py_type);
15874 0 : if (PyErr_Occurred() != NULL) {
15875 0 : return false;
15876 : }
15877 0 : if (test_var > uint_max) {
15878 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15879 : PyLong_Type.tp_name, uint_max, test_var);
15880 0 : return false;
15881 : }
15882 0 : r->in.type = test_var;
15883 : } else {
15884 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15885 : PyLong_Type.tp_name);
15886 0 : return false;
15887 : }
15888 : }
15889 0 : if (py_data == NULL) {
15890 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data");
15891 0 : return false;
15892 : }
15893 0 : r->in.data = talloc_ptrtype(r, r->in.data);
15894 0 : if (r->in.data == NULL) {
15895 0 : PyErr_NoMemory();
15896 0 : return false;
15897 : }
15898 0 : PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
15899 : {
15900 : int data_cntr_1;
15901 0 : r->in.data = talloc_array_ptrtype(r, r->in.data, PyList_GET_SIZE(py_data));
15902 0 : if (!r->in.data) { return false;; }
15903 0 : talloc_set_name_const(r->in.data, "ARRAY: r->in.data");
15904 0 : for (data_cntr_1 = 0; data_cntr_1 < PyList_GET_SIZE(py_data); data_cntr_1++) {
15905 0 : if (PyList_GET_ITEM(py_data, data_cntr_1) == NULL) {
15906 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.data[data_cntr_1]");
15907 0 : return false;
15908 : }
15909 : {
15910 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.data[data_cntr_1]));
15911 0 : if (PyLong_Check(PyList_GET_ITEM(py_data, data_cntr_1))) {
15912 : unsigned long long test_var;
15913 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_data, data_cntr_1));
15914 0 : if (PyErr_Occurred() != NULL) {
15915 0 : return false;
15916 : }
15917 0 : if (test_var > uint_max) {
15918 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
15919 : PyLong_Type.tp_name, uint_max, test_var);
15920 0 : return false;
15921 : }
15922 0 : r->in.data[data_cntr_1] = test_var;
15923 : } else {
15924 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
15925 : PyLong_Type.tp_name);
15926 0 : return false;
15927 : }
15928 : }
15929 : }
15930 : }
15931 0 : PY_CHECK_TYPE(&PyList_Type, py_data, return false;);
15932 0 : r->in.size = PyList_GET_SIZE(py_data);
15933 0 : return true;
15934 : }
15935 :
15936 0 : static PyObject *unpack_py_winreg_SetValue_args_out(struct winreg_SetValue *r)
15937 : {
15938 : PyObject *result;
15939 0 : result = Py_None;
15940 0 : Py_INCREF(result);
15941 0 : if (!W_ERROR_IS_OK(r->out.result)) {
15942 0 : PyErr_SetWERROR(r->out.result);
15943 0 : return NULL;
15944 : }
15945 :
15946 0 : return result;
15947 : }
15948 :
15949 :
15950 0 : static PyObject *py_winreg_UnLoadKey_in_get_handle(PyObject *obj, void *closure)
15951 : {
15952 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(obj);
15953 : PyObject *py_handle;
15954 0 : if (object->in.handle == NULL) {
15955 0 : Py_RETURN_NONE;
15956 : }
15957 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
15958 0 : return py_handle;
15959 : }
15960 :
15961 0 : static int py_winreg_UnLoadKey_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
15962 : {
15963 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(py_obj);
15964 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
15965 0 : if (value == NULL) {
15966 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
15967 0 : return -1;
15968 : }
15969 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
15970 0 : if (object->in.handle == NULL) {
15971 0 : PyErr_NoMemory();
15972 0 : return -1;
15973 : }
15974 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
15975 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
15976 0 : PyErr_NoMemory();
15977 0 : return -1;
15978 : }
15979 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
15980 0 : return 0;
15981 : }
15982 :
15983 0 : static PyObject *py_winreg_UnLoadKey_in_get_subkey(PyObject *obj, void *closure)
15984 : {
15985 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(obj);
15986 : PyObject *py_subkey;
15987 0 : if (object->in.subkey == NULL) {
15988 0 : Py_RETURN_NONE;
15989 : }
15990 0 : py_subkey = pytalloc_reference_ex(&winreg_String_Type, object->in.subkey, object->in.subkey);
15991 0 : return py_subkey;
15992 : }
15993 :
15994 0 : static int py_winreg_UnLoadKey_in_set_subkey(PyObject *py_obj, PyObject *value, void *closure)
15995 : {
15996 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(py_obj);
15997 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.subkey));
15998 0 : if (value == NULL) {
15999 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.subkey");
16000 0 : return -1;
16001 : }
16002 0 : object->in.subkey = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.subkey);
16003 0 : if (object->in.subkey == NULL) {
16004 0 : PyErr_NoMemory();
16005 0 : return -1;
16006 : }
16007 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
16008 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
16009 0 : PyErr_NoMemory();
16010 0 : return -1;
16011 : }
16012 0 : object->in.subkey = (struct winreg_String *)pytalloc_get_ptr(value);
16013 0 : return 0;
16014 : }
16015 :
16016 0 : static PyObject *py_winreg_UnLoadKey_get_result(PyObject *obj, void *closure)
16017 : {
16018 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(obj);
16019 : PyObject *py_result;
16020 0 : py_result = PyErr_FromWERROR(object->out.result);
16021 0 : return py_result;
16022 : }
16023 :
16024 0 : static int py_winreg_UnLoadKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
16025 : {
16026 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(py_obj);
16027 0 : if (value == NULL) {
16028 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
16029 0 : return -1;
16030 : }
16031 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
16032 0 : return 0;
16033 : }
16034 :
16035 : static PyGetSetDef py_winreg_UnLoadKey_getsetters[] = {
16036 : {
16037 : .name = discard_const_p(char, "in_handle"),
16038 : .get = py_winreg_UnLoadKey_in_get_handle,
16039 : .set = py_winreg_UnLoadKey_in_set_handle,
16040 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
16041 : },
16042 : {
16043 : .name = discard_const_p(char, "in_subkey"),
16044 : .get = py_winreg_UnLoadKey_in_get_subkey,
16045 : .set = py_winreg_UnLoadKey_in_set_subkey,
16046 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
16047 : },
16048 : {
16049 : .name = discard_const_p(char, "result"),
16050 : .get = py_winreg_UnLoadKey_get_result,
16051 : .set = py_winreg_UnLoadKey_set_result,
16052 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
16053 : },
16054 : { .name = NULL }
16055 : };
16056 :
16057 0 : static PyObject *py_winreg_UnLoadKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
16058 : {
16059 0 : PyObject *self = pytalloc_new(struct winreg_UnLoadKey, type);
16060 0 : struct winreg_UnLoadKey *_self = (struct winreg_UnLoadKey *)pytalloc_get_ptr(self);
16061 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
16062 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
16063 0 : _self->in.subkey = talloc_zero(mem_ctx, struct winreg_String);
16064 0 : return self;
16065 : }
16066 :
16067 0 : static PyObject *py_winreg_UnLoadKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
16068 : {
16069 :
16070 :
16071 0 : return PyLong_FromLong(23);
16072 : }
16073 :
16074 0 : static PyObject *py_winreg_UnLoadKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
16075 : {
16076 0 : const struct ndr_interface_call *call = NULL;
16077 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(py_obj);
16078 0 : PyObject *ret = NULL;
16079 0 : struct ndr_push *push = NULL;
16080 : DATA_BLOB blob;
16081 : enum ndr_err_code err;
16082 :
16083 0 : if (ndr_table_winreg.num_calls < 24) {
16084 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_UnLoadKey_ndr_pack");
16085 0 : return NULL;
16086 : }
16087 0 : call = &ndr_table_winreg.calls[23];
16088 :
16089 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
16090 0 : if (push == NULL) {
16091 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16092 0 : return NULL;
16093 : }
16094 :
16095 0 : push->flags |= ndr_push_flags;
16096 :
16097 0 : err = call->ndr_push(push, ndr_inout_flags, object);
16098 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16099 0 : TALLOC_FREE(push);
16100 0 : PyErr_SetNdrError(err);
16101 0 : return NULL;
16102 : }
16103 0 : blob = ndr_push_blob(push);
16104 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
16105 0 : TALLOC_FREE(push);
16106 0 : return ret;
16107 : }
16108 :
16109 0 : static PyObject *py_winreg_UnLoadKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16110 : {
16111 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16112 0 : PyObject *bigendian_obj = NULL;
16113 0 : PyObject *ndr64_obj = NULL;
16114 0 : uint32_t ndr_push_flags = 0;
16115 :
16116 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
16117 : discard_const_p(char *, kwnames),
16118 : &bigendian_obj,
16119 : &ndr64_obj)) {
16120 0 : return NULL;
16121 : }
16122 :
16123 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16124 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16125 : }
16126 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16127 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16128 : }
16129 :
16130 0 : return py_winreg_UnLoadKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
16131 : }
16132 :
16133 0 : static PyObject *py_winreg_UnLoadKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16134 : {
16135 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16136 0 : PyObject *bigendian_obj = NULL;
16137 0 : PyObject *ndr64_obj = NULL;
16138 0 : uint32_t ndr_push_flags = 0;
16139 :
16140 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
16141 : discard_const_p(char *, kwnames),
16142 : &bigendian_obj,
16143 : &ndr64_obj)) {
16144 0 : return NULL;
16145 : }
16146 :
16147 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16148 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16149 : }
16150 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16151 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16152 : }
16153 :
16154 0 : return py_winreg_UnLoadKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
16155 : }
16156 :
16157 0 : static PyObject *py_winreg_UnLoadKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
16158 : {
16159 0 : const struct ndr_interface_call *call = NULL;
16160 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(py_obj);
16161 0 : struct ndr_pull *pull = NULL;
16162 : enum ndr_err_code err;
16163 :
16164 0 : if (ndr_table_winreg.num_calls < 24) {
16165 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_UnLoadKey_ndr_unpack");
16166 0 : return NULL;
16167 : }
16168 0 : call = &ndr_table_winreg.calls[23];
16169 :
16170 0 : pull = ndr_pull_init_blob(blob, object);
16171 0 : if (pull == NULL) {
16172 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16173 0 : return NULL;
16174 : }
16175 :
16176 0 : pull->flags |= ndr_pull_flags;
16177 :
16178 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
16179 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16180 0 : TALLOC_FREE(pull);
16181 0 : PyErr_SetNdrError(err);
16182 0 : return NULL;
16183 : }
16184 0 : if (!allow_remaining) {
16185 : uint32_t highest_ofs;
16186 :
16187 0 : if (pull->offset > pull->relative_highest_offset) {
16188 0 : highest_ofs = pull->offset;
16189 : } else {
16190 0 : highest_ofs = pull->relative_highest_offset;
16191 : }
16192 0 : if (highest_ofs < pull->data_size) {
16193 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
16194 : "not all bytes consumed ofs[%u] size[%u]",
16195 : highest_ofs, pull->data_size);
16196 0 : TALLOC_FREE(pull);
16197 0 : PyErr_SetNdrError(err);
16198 0 : return NULL;
16199 : }
16200 : }
16201 :
16202 0 : TALLOC_FREE(pull);
16203 0 : Py_RETURN_NONE;
16204 : }
16205 :
16206 0 : static PyObject *py_winreg_UnLoadKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16207 : {
16208 : DATA_BLOB blob;
16209 0 : Py_ssize_t blob_length = 0;
16210 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16211 0 : PyObject *bigendian_obj = NULL;
16212 0 : PyObject *ndr64_obj = NULL;
16213 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16214 0 : PyObject *allow_remaining_obj = NULL;
16215 0 : bool allow_remaining = false;
16216 :
16217 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
16218 : discard_const_p(char *, kwnames),
16219 : &blob.data, &blob_length,
16220 : &bigendian_obj,
16221 : &ndr64_obj,
16222 : &allow_remaining_obj)) {
16223 0 : return NULL;
16224 : }
16225 0 : blob.length = blob_length;
16226 :
16227 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16228 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16229 : }
16230 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16231 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16232 : }
16233 :
16234 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16235 0 : allow_remaining = true;
16236 : }
16237 :
16238 0 : return py_winreg_UnLoadKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
16239 : }
16240 :
16241 0 : static PyObject *py_winreg_UnLoadKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16242 : {
16243 : DATA_BLOB blob;
16244 0 : Py_ssize_t blob_length = 0;
16245 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16246 0 : PyObject *bigendian_obj = NULL;
16247 0 : PyObject *ndr64_obj = NULL;
16248 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16249 0 : PyObject *allow_remaining_obj = NULL;
16250 0 : bool allow_remaining = false;
16251 :
16252 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
16253 : discard_const_p(char *, kwnames),
16254 : &blob.data, &blob_length,
16255 : &bigendian_obj,
16256 : &ndr64_obj,
16257 : &allow_remaining_obj)) {
16258 0 : return NULL;
16259 : }
16260 0 : blob.length = blob_length;
16261 :
16262 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16263 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16264 : }
16265 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16266 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16267 : }
16268 :
16269 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16270 0 : allow_remaining = true;
16271 : }
16272 :
16273 0 : return py_winreg_UnLoadKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
16274 : }
16275 :
16276 0 : static PyObject *py_winreg_UnLoadKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
16277 : {
16278 0 : const struct ndr_interface_call *call = NULL;
16279 0 : struct winreg_UnLoadKey *object = (struct winreg_UnLoadKey *)pytalloc_get_ptr(py_obj);
16280 : PyObject *ret;
16281 : char *retstr;
16282 :
16283 0 : if (ndr_table_winreg.num_calls < 24) {
16284 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_UnLoadKey_ndr_print");
16285 0 : return NULL;
16286 : }
16287 0 : call = &ndr_table_winreg.calls[23];
16288 :
16289 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
16290 0 : ret = PyUnicode_FromString(retstr);
16291 0 : TALLOC_FREE(retstr);
16292 :
16293 0 : return ret;
16294 : }
16295 :
16296 0 : static PyObject *py_winreg_UnLoadKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16297 : {
16298 0 : return py_winreg_UnLoadKey_ndr_print(py_obj, "winreg_UnLoadKey_in", NDR_IN);
16299 : }
16300 :
16301 0 : static PyObject *py_winreg_UnLoadKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16302 : {
16303 0 : return py_winreg_UnLoadKey_ndr_print(py_obj, "winreg_UnLoadKey_out", NDR_OUT);
16304 : }
16305 :
16306 : static PyMethodDef py_winreg_UnLoadKey_methods[] = {
16307 : { "opnum", (PyCFunction)py_winreg_UnLoadKey_ndr_opnum, METH_NOARGS|METH_CLASS,
16308 : "winreg.UnLoadKey.opnum() -> 23 (0x17) " },
16309 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
16310 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
16311 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
16312 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
16313 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
16314 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
16315 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_UnLoadKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
16316 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
16317 : { "__ndr_print_in__", (PyCFunction)py_winreg_UnLoadKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
16318 : { "__ndr_print_out__", (PyCFunction)py_winreg_UnLoadKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
16319 : { NULL, NULL, 0, NULL }
16320 : };
16321 :
16322 :
16323 : static PyTypeObject winreg_UnLoadKey_Type = {
16324 : PyVarObject_HEAD_INIT(NULL, 0)
16325 : .tp_name = "winreg.UnLoadKey",
16326 : .tp_getset = py_winreg_UnLoadKey_getsetters,
16327 : .tp_methods = py_winreg_UnLoadKey_methods,
16328 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
16329 : .tp_new = py_winreg_UnLoadKey_new,
16330 : };
16331 :
16332 0 : static bool pack_py_winreg_UnLoadKey_args_in(PyObject *args, PyObject *kwargs, struct winreg_UnLoadKey *r)
16333 : {
16334 : PyObject *py_handle;
16335 : PyObject *py_subkey;
16336 0 : const char *kwnames[] = {
16337 : "handle", "subkey", NULL
16338 : };
16339 :
16340 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_UnLoadKey", discard_const_p(char *, kwnames), &py_handle, &py_subkey)) {
16341 0 : return false;
16342 : }
16343 :
16344 0 : if (py_handle == NULL) {
16345 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
16346 0 : return false;
16347 : }
16348 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
16349 0 : if (r->in.handle == NULL) {
16350 0 : PyErr_NoMemory();
16351 0 : return false;
16352 : }
16353 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
16354 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
16355 0 : PyErr_NoMemory();
16356 0 : return false;
16357 : }
16358 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
16359 0 : if (py_subkey == NULL) {
16360 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.subkey");
16361 0 : return false;
16362 : }
16363 0 : r->in.subkey = talloc_ptrtype(r, r->in.subkey);
16364 0 : if (r->in.subkey == NULL) {
16365 0 : PyErr_NoMemory();
16366 0 : return false;
16367 : }
16368 0 : PY_CHECK_TYPE(&winreg_String_Type, py_subkey, return false;);
16369 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_subkey)) == NULL) {
16370 0 : PyErr_NoMemory();
16371 0 : return false;
16372 : }
16373 0 : r->in.subkey = (struct winreg_String *)pytalloc_get_ptr(py_subkey);
16374 0 : return true;
16375 : }
16376 :
16377 0 : static PyObject *unpack_py_winreg_UnLoadKey_args_out(struct winreg_UnLoadKey *r)
16378 : {
16379 : PyObject *result;
16380 0 : result = Py_None;
16381 0 : Py_INCREF(result);
16382 0 : if (!W_ERROR_IS_OK(r->out.result)) {
16383 0 : PyErr_SetWERROR(r->out.result);
16384 0 : return NULL;
16385 : }
16386 :
16387 0 : return result;
16388 : }
16389 :
16390 :
16391 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_hostname(PyObject *obj, void *closure)
16392 : {
16393 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(obj);
16394 : PyObject *py_hostname;
16395 0 : if (object->in.hostname == NULL) {
16396 0 : Py_RETURN_NONE;
16397 : }
16398 0 : if (object->in.hostname == NULL) {
16399 0 : py_hostname = Py_None;
16400 0 : Py_INCREF(py_hostname);
16401 : } else {
16402 0 : py_hostname = PyLong_FromLong((uint16_t)*object->in.hostname);
16403 : }
16404 0 : return py_hostname;
16405 : }
16406 :
16407 0 : static int py_winreg_InitiateSystemShutdown_in_set_hostname(PyObject *py_obj, PyObject *value, void *closure)
16408 : {
16409 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16410 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.hostname));
16411 0 : if (value == NULL) {
16412 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hostname");
16413 0 : return -1;
16414 : }
16415 0 : if (value == Py_None) {
16416 0 : object->in.hostname = NULL;
16417 : } else {
16418 0 : object->in.hostname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.hostname);
16419 0 : if (object->in.hostname == NULL) {
16420 0 : PyErr_NoMemory();
16421 0 : return -1;
16422 : }
16423 : {
16424 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.hostname));
16425 0 : if (PyLong_Check(value)) {
16426 : unsigned long long test_var;
16427 0 : test_var = PyLong_AsUnsignedLongLong(value);
16428 0 : if (PyErr_Occurred() != NULL) {
16429 0 : return -1;
16430 : }
16431 0 : if (test_var > uint_max) {
16432 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16433 : PyLong_Type.tp_name, uint_max, test_var);
16434 0 : return -1;
16435 : }
16436 0 : *object->in.hostname = test_var;
16437 : } else {
16438 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16439 : PyLong_Type.tp_name);
16440 0 : return -1;
16441 : }
16442 : }
16443 : }
16444 0 : return 0;
16445 : }
16446 :
16447 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_message(PyObject *obj, void *closure)
16448 : {
16449 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(obj);
16450 : PyObject *py_message;
16451 0 : if (object->in.message == NULL) {
16452 0 : Py_RETURN_NONE;
16453 : }
16454 0 : if (object->in.message == NULL) {
16455 0 : py_message = Py_None;
16456 0 : Py_INCREF(py_message);
16457 : } else {
16458 0 : py_message = pytalloc_reference_ex(lsa_StringLarge_Type, object->in.message, object->in.message);
16459 : }
16460 0 : return py_message;
16461 : }
16462 :
16463 0 : static int py_winreg_InitiateSystemShutdown_in_set_message(PyObject *py_obj, PyObject *value, void *closure)
16464 : {
16465 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16466 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.message));
16467 0 : if (value == NULL) {
16468 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.message");
16469 0 : return -1;
16470 : }
16471 0 : if (value == Py_None) {
16472 0 : object->in.message = NULL;
16473 : } else {
16474 0 : object->in.message = NULL;
16475 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, value, return -1;);
16476 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
16477 0 : PyErr_NoMemory();
16478 0 : return -1;
16479 : }
16480 0 : object->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(value);
16481 : }
16482 0 : return 0;
16483 : }
16484 :
16485 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_timeout(PyObject *obj, void *closure)
16486 : {
16487 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(obj);
16488 : PyObject *py_timeout;
16489 0 : py_timeout = PyLong_FromUnsignedLongLong((uint32_t)object->in.timeout);
16490 0 : return py_timeout;
16491 : }
16492 :
16493 0 : static int py_winreg_InitiateSystemShutdown_in_set_timeout(PyObject *py_obj, PyObject *value, void *closure)
16494 : {
16495 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16496 0 : if (value == NULL) {
16497 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.timeout");
16498 0 : return -1;
16499 : }
16500 : {
16501 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.timeout));
16502 0 : if (PyLong_Check(value)) {
16503 : unsigned long long test_var;
16504 0 : test_var = PyLong_AsUnsignedLongLong(value);
16505 0 : if (PyErr_Occurred() != NULL) {
16506 0 : return -1;
16507 : }
16508 0 : if (test_var > uint_max) {
16509 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16510 : PyLong_Type.tp_name, uint_max, test_var);
16511 0 : return -1;
16512 : }
16513 0 : object->in.timeout = test_var;
16514 : } else {
16515 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16516 : PyLong_Type.tp_name);
16517 0 : return -1;
16518 : }
16519 : }
16520 0 : return 0;
16521 : }
16522 :
16523 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_force_apps(PyObject *obj, void *closure)
16524 : {
16525 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(obj);
16526 : PyObject *py_force_apps;
16527 0 : py_force_apps = PyLong_FromLong((uint16_t)object->in.force_apps);
16528 0 : return py_force_apps;
16529 : }
16530 :
16531 0 : static int py_winreg_InitiateSystemShutdown_in_set_force_apps(PyObject *py_obj, PyObject *value, void *closure)
16532 : {
16533 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16534 0 : if (value == NULL) {
16535 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.force_apps");
16536 0 : return -1;
16537 : }
16538 : {
16539 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.force_apps));
16540 0 : if (PyLong_Check(value)) {
16541 : unsigned long long test_var;
16542 0 : test_var = PyLong_AsUnsignedLongLong(value);
16543 0 : if (PyErr_Occurred() != NULL) {
16544 0 : return -1;
16545 : }
16546 0 : if (test_var > uint_max) {
16547 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16548 : PyLong_Type.tp_name, uint_max, test_var);
16549 0 : return -1;
16550 : }
16551 0 : object->in.force_apps = test_var;
16552 : } else {
16553 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16554 : PyLong_Type.tp_name);
16555 0 : return -1;
16556 : }
16557 : }
16558 0 : return 0;
16559 : }
16560 :
16561 0 : static PyObject *py_winreg_InitiateSystemShutdown_in_get_do_reboot(PyObject *obj, void *closure)
16562 : {
16563 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(obj);
16564 : PyObject *py_do_reboot;
16565 0 : py_do_reboot = PyLong_FromLong((uint16_t)object->in.do_reboot);
16566 0 : return py_do_reboot;
16567 : }
16568 :
16569 0 : static int py_winreg_InitiateSystemShutdown_in_set_do_reboot(PyObject *py_obj, PyObject *value, void *closure)
16570 : {
16571 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16572 0 : if (value == NULL) {
16573 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.do_reboot");
16574 0 : return -1;
16575 : }
16576 : {
16577 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.do_reboot));
16578 0 : if (PyLong_Check(value)) {
16579 : unsigned long long test_var;
16580 0 : test_var = PyLong_AsUnsignedLongLong(value);
16581 0 : if (PyErr_Occurred() != NULL) {
16582 0 : return -1;
16583 : }
16584 0 : if (test_var > uint_max) {
16585 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16586 : PyLong_Type.tp_name, uint_max, test_var);
16587 0 : return -1;
16588 : }
16589 0 : object->in.do_reboot = test_var;
16590 : } else {
16591 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16592 : PyLong_Type.tp_name);
16593 0 : return -1;
16594 : }
16595 : }
16596 0 : return 0;
16597 : }
16598 :
16599 0 : static PyObject *py_winreg_InitiateSystemShutdown_get_result(PyObject *obj, void *closure)
16600 : {
16601 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(obj);
16602 : PyObject *py_result;
16603 0 : py_result = PyErr_FromWERROR(object->out.result);
16604 0 : return py_result;
16605 : }
16606 :
16607 0 : static int py_winreg_InitiateSystemShutdown_set_result(PyObject *py_obj, PyObject *value, void *closure)
16608 : {
16609 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16610 0 : if (value == NULL) {
16611 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
16612 0 : return -1;
16613 : }
16614 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
16615 0 : return 0;
16616 : }
16617 :
16618 : static PyGetSetDef py_winreg_InitiateSystemShutdown_getsetters[] = {
16619 : {
16620 : .name = discard_const_p(char, "in_hostname"),
16621 : .get = py_winreg_InitiateSystemShutdown_in_get_hostname,
16622 : .set = py_winreg_InitiateSystemShutdown_in_set_hostname,
16623 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
16624 : },
16625 : {
16626 : .name = discard_const_p(char, "in_message"),
16627 : .get = py_winreg_InitiateSystemShutdown_in_get_message,
16628 : .set = py_winreg_InitiateSystemShutdown_in_set_message,
16629 : .doc = discard_const_p(char, "PIDL-generated element of base type lsa_StringLarge")
16630 : },
16631 : {
16632 : .name = discard_const_p(char, "in_timeout"),
16633 : .get = py_winreg_InitiateSystemShutdown_in_get_timeout,
16634 : .set = py_winreg_InitiateSystemShutdown_in_set_timeout,
16635 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
16636 : },
16637 : {
16638 : .name = discard_const_p(char, "in_force_apps"),
16639 : .get = py_winreg_InitiateSystemShutdown_in_get_force_apps,
16640 : .set = py_winreg_InitiateSystemShutdown_in_set_force_apps,
16641 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
16642 : },
16643 : {
16644 : .name = discard_const_p(char, "in_do_reboot"),
16645 : .get = py_winreg_InitiateSystemShutdown_in_get_do_reboot,
16646 : .set = py_winreg_InitiateSystemShutdown_in_set_do_reboot,
16647 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
16648 : },
16649 : {
16650 : .name = discard_const_p(char, "result"),
16651 : .get = py_winreg_InitiateSystemShutdown_get_result,
16652 : .set = py_winreg_InitiateSystemShutdown_set_result,
16653 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
16654 : },
16655 : { .name = NULL }
16656 : };
16657 :
16658 0 : static PyObject *py_winreg_InitiateSystemShutdown_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
16659 : {
16660 0 : PyObject *self = pytalloc_new(struct winreg_InitiateSystemShutdown, type);
16661 0 : return self;
16662 : }
16663 :
16664 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
16665 : {
16666 :
16667 :
16668 0 : return PyLong_FromLong(24);
16669 : }
16670 :
16671 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
16672 : {
16673 0 : const struct ndr_interface_call *call = NULL;
16674 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16675 0 : PyObject *ret = NULL;
16676 0 : struct ndr_push *push = NULL;
16677 : DATA_BLOB blob;
16678 : enum ndr_err_code err;
16679 :
16680 0 : if (ndr_table_winreg.num_calls < 25) {
16681 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdown_ndr_pack");
16682 0 : return NULL;
16683 : }
16684 0 : call = &ndr_table_winreg.calls[24];
16685 :
16686 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
16687 0 : if (push == NULL) {
16688 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16689 0 : return NULL;
16690 : }
16691 :
16692 0 : push->flags |= ndr_push_flags;
16693 :
16694 0 : err = call->ndr_push(push, ndr_inout_flags, object);
16695 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16696 0 : TALLOC_FREE(push);
16697 0 : PyErr_SetNdrError(err);
16698 0 : return NULL;
16699 : }
16700 0 : blob = ndr_push_blob(push);
16701 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
16702 0 : TALLOC_FREE(push);
16703 0 : return ret;
16704 : }
16705 :
16706 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16707 : {
16708 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16709 0 : PyObject *bigendian_obj = NULL;
16710 0 : PyObject *ndr64_obj = NULL;
16711 0 : uint32_t ndr_push_flags = 0;
16712 :
16713 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
16714 : discard_const_p(char *, kwnames),
16715 : &bigendian_obj,
16716 : &ndr64_obj)) {
16717 0 : return NULL;
16718 : }
16719 :
16720 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16721 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16722 : }
16723 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16724 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16725 : }
16726 :
16727 0 : return py_winreg_InitiateSystemShutdown_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
16728 : }
16729 :
16730 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16731 : {
16732 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
16733 0 : PyObject *bigendian_obj = NULL;
16734 0 : PyObject *ndr64_obj = NULL;
16735 0 : uint32_t ndr_push_flags = 0;
16736 :
16737 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
16738 : discard_const_p(char *, kwnames),
16739 : &bigendian_obj,
16740 : &ndr64_obj)) {
16741 0 : return NULL;
16742 : }
16743 :
16744 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16745 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
16746 : }
16747 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16748 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
16749 : }
16750 :
16751 0 : return py_winreg_InitiateSystemShutdown_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
16752 : }
16753 :
16754 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
16755 : {
16756 0 : const struct ndr_interface_call *call = NULL;
16757 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16758 0 : struct ndr_pull *pull = NULL;
16759 : enum ndr_err_code err;
16760 :
16761 0 : if (ndr_table_winreg.num_calls < 25) {
16762 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdown_ndr_unpack");
16763 0 : return NULL;
16764 : }
16765 0 : call = &ndr_table_winreg.calls[24];
16766 :
16767 0 : pull = ndr_pull_init_blob(blob, object);
16768 0 : if (pull == NULL) {
16769 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
16770 0 : return NULL;
16771 : }
16772 :
16773 0 : pull->flags |= ndr_pull_flags;
16774 :
16775 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
16776 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
16777 0 : TALLOC_FREE(pull);
16778 0 : PyErr_SetNdrError(err);
16779 0 : return NULL;
16780 : }
16781 0 : if (!allow_remaining) {
16782 : uint32_t highest_ofs;
16783 :
16784 0 : if (pull->offset > pull->relative_highest_offset) {
16785 0 : highest_ofs = pull->offset;
16786 : } else {
16787 0 : highest_ofs = pull->relative_highest_offset;
16788 : }
16789 0 : if (highest_ofs < pull->data_size) {
16790 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
16791 : "not all bytes consumed ofs[%u] size[%u]",
16792 : highest_ofs, pull->data_size);
16793 0 : TALLOC_FREE(pull);
16794 0 : PyErr_SetNdrError(err);
16795 0 : return NULL;
16796 : }
16797 : }
16798 :
16799 0 : TALLOC_FREE(pull);
16800 0 : Py_RETURN_NONE;
16801 : }
16802 :
16803 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16804 : {
16805 : DATA_BLOB blob;
16806 0 : Py_ssize_t blob_length = 0;
16807 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16808 0 : PyObject *bigendian_obj = NULL;
16809 0 : PyObject *ndr64_obj = NULL;
16810 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16811 0 : PyObject *allow_remaining_obj = NULL;
16812 0 : bool allow_remaining = false;
16813 :
16814 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
16815 : discard_const_p(char *, kwnames),
16816 : &blob.data, &blob_length,
16817 : &bigendian_obj,
16818 : &ndr64_obj,
16819 : &allow_remaining_obj)) {
16820 0 : return NULL;
16821 : }
16822 0 : blob.length = blob_length;
16823 :
16824 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16825 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16826 : }
16827 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16828 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16829 : }
16830 :
16831 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16832 0 : allow_remaining = true;
16833 : }
16834 :
16835 0 : return py_winreg_InitiateSystemShutdown_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
16836 : }
16837 :
16838 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
16839 : {
16840 : DATA_BLOB blob;
16841 0 : Py_ssize_t blob_length = 0;
16842 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
16843 0 : PyObject *bigendian_obj = NULL;
16844 0 : PyObject *ndr64_obj = NULL;
16845 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
16846 0 : PyObject *allow_remaining_obj = NULL;
16847 0 : bool allow_remaining = false;
16848 :
16849 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
16850 : discard_const_p(char *, kwnames),
16851 : &blob.data, &blob_length,
16852 : &bigendian_obj,
16853 : &ndr64_obj,
16854 : &allow_remaining_obj)) {
16855 0 : return NULL;
16856 : }
16857 0 : blob.length = blob_length;
16858 :
16859 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
16860 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
16861 : }
16862 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
16863 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
16864 : }
16865 :
16866 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
16867 0 : allow_remaining = true;
16868 : }
16869 :
16870 0 : return py_winreg_InitiateSystemShutdown_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
16871 : }
16872 :
16873 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
16874 : {
16875 0 : const struct ndr_interface_call *call = NULL;
16876 0 : struct winreg_InitiateSystemShutdown *object = (struct winreg_InitiateSystemShutdown *)pytalloc_get_ptr(py_obj);
16877 : PyObject *ret;
16878 : char *retstr;
16879 :
16880 0 : if (ndr_table_winreg.num_calls < 25) {
16881 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdown_ndr_print");
16882 0 : return NULL;
16883 : }
16884 0 : call = &ndr_table_winreg.calls[24];
16885 :
16886 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
16887 0 : ret = PyUnicode_FromString(retstr);
16888 0 : TALLOC_FREE(retstr);
16889 :
16890 0 : return ret;
16891 : }
16892 :
16893 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16894 : {
16895 0 : return py_winreg_InitiateSystemShutdown_ndr_print(py_obj, "winreg_InitiateSystemShutdown_in", NDR_IN);
16896 : }
16897 :
16898 0 : static PyObject *py_winreg_InitiateSystemShutdown_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
16899 : {
16900 0 : return py_winreg_InitiateSystemShutdown_ndr_print(py_obj, "winreg_InitiateSystemShutdown_out", NDR_OUT);
16901 : }
16902 :
16903 : static PyMethodDef py_winreg_InitiateSystemShutdown_methods[] = {
16904 : { "opnum", (PyCFunction)py_winreg_InitiateSystemShutdown_ndr_opnum, METH_NOARGS|METH_CLASS,
16905 : "winreg.InitiateSystemShutdown.opnum() -> 24 (0x18) " },
16906 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
16907 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
16908 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
16909 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
16910 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
16911 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
16912 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdown_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
16913 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
16914 : { "__ndr_print_in__", (PyCFunction)py_winreg_InitiateSystemShutdown_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
16915 : { "__ndr_print_out__", (PyCFunction)py_winreg_InitiateSystemShutdown_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
16916 : { NULL, NULL, 0, NULL }
16917 : };
16918 :
16919 :
16920 : static PyTypeObject winreg_InitiateSystemShutdown_Type = {
16921 : PyVarObject_HEAD_INIT(NULL, 0)
16922 : .tp_name = "winreg.InitiateSystemShutdown",
16923 : .tp_getset = py_winreg_InitiateSystemShutdown_getsetters,
16924 : .tp_methods = py_winreg_InitiateSystemShutdown_methods,
16925 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
16926 : .tp_new = py_winreg_InitiateSystemShutdown_new,
16927 : };
16928 :
16929 0 : static bool pack_py_winreg_InitiateSystemShutdown_args_in(PyObject *args, PyObject *kwargs, struct winreg_InitiateSystemShutdown *r)
16930 : {
16931 : PyObject *py_hostname;
16932 : PyObject *py_message;
16933 : PyObject *py_timeout;
16934 : PyObject *py_force_apps;
16935 : PyObject *py_do_reboot;
16936 0 : const char *kwnames[] = {
16937 : "hostname", "message", "timeout", "force_apps", "do_reboot", NULL
16938 : };
16939 :
16940 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)) {
16941 0 : return false;
16942 : }
16943 :
16944 0 : if (py_hostname == NULL) {
16945 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hostname");
16946 0 : return false;
16947 : }
16948 0 : if (py_hostname == Py_None) {
16949 0 : r->in.hostname = NULL;
16950 : } else {
16951 0 : r->in.hostname = talloc_ptrtype(r, r->in.hostname);
16952 0 : if (r->in.hostname == NULL) {
16953 0 : PyErr_NoMemory();
16954 0 : return false;
16955 : }
16956 : {
16957 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.hostname));
16958 0 : if (PyLong_Check(py_hostname)) {
16959 : unsigned long long test_var;
16960 0 : test_var = PyLong_AsUnsignedLongLong(py_hostname);
16961 0 : if (PyErr_Occurred() != NULL) {
16962 0 : return false;
16963 : }
16964 0 : if (test_var > uint_max) {
16965 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
16966 : PyLong_Type.tp_name, uint_max, test_var);
16967 0 : return false;
16968 : }
16969 0 : *r->in.hostname = test_var;
16970 : } else {
16971 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
16972 : PyLong_Type.tp_name);
16973 0 : return false;
16974 : }
16975 : }
16976 : }
16977 0 : if (py_message == NULL) {
16978 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.message");
16979 0 : return false;
16980 : }
16981 0 : if (py_message == Py_None) {
16982 0 : r->in.message = NULL;
16983 : } else {
16984 0 : r->in.message = NULL;
16985 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
16986 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_message)) == NULL) {
16987 0 : PyErr_NoMemory();
16988 0 : return false;
16989 : }
16990 0 : r->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(py_message);
16991 : }
16992 0 : if (py_timeout == NULL) {
16993 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.timeout");
16994 0 : return false;
16995 : }
16996 : {
16997 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.timeout));
16998 0 : if (PyLong_Check(py_timeout)) {
16999 : unsigned long long test_var;
17000 0 : test_var = PyLong_AsUnsignedLongLong(py_timeout);
17001 0 : if (PyErr_Occurred() != NULL) {
17002 0 : return false;
17003 : }
17004 0 : if (test_var > uint_max) {
17005 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17006 : PyLong_Type.tp_name, uint_max, test_var);
17007 0 : return false;
17008 : }
17009 0 : r->in.timeout = test_var;
17010 : } else {
17011 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17012 : PyLong_Type.tp_name);
17013 0 : return false;
17014 : }
17015 : }
17016 0 : if (py_force_apps == NULL) {
17017 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.force_apps");
17018 0 : return false;
17019 : }
17020 : {
17021 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.force_apps));
17022 0 : if (PyLong_Check(py_force_apps)) {
17023 : unsigned long long test_var;
17024 0 : test_var = PyLong_AsUnsignedLongLong(py_force_apps);
17025 0 : if (PyErr_Occurred() != NULL) {
17026 0 : return false;
17027 : }
17028 0 : if (test_var > uint_max) {
17029 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17030 : PyLong_Type.tp_name, uint_max, test_var);
17031 0 : return false;
17032 : }
17033 0 : r->in.force_apps = test_var;
17034 : } else {
17035 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17036 : PyLong_Type.tp_name);
17037 0 : return false;
17038 : }
17039 : }
17040 0 : if (py_do_reboot == NULL) {
17041 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.do_reboot");
17042 0 : return false;
17043 : }
17044 : {
17045 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.do_reboot));
17046 0 : if (PyLong_Check(py_do_reboot)) {
17047 : unsigned long long test_var;
17048 0 : test_var = PyLong_AsUnsignedLongLong(py_do_reboot);
17049 0 : if (PyErr_Occurred() != NULL) {
17050 0 : return false;
17051 : }
17052 0 : if (test_var > uint_max) {
17053 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17054 : PyLong_Type.tp_name, uint_max, test_var);
17055 0 : return false;
17056 : }
17057 0 : r->in.do_reboot = test_var;
17058 : } else {
17059 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17060 : PyLong_Type.tp_name);
17061 0 : return false;
17062 : }
17063 : }
17064 0 : return true;
17065 : }
17066 :
17067 0 : static PyObject *unpack_py_winreg_InitiateSystemShutdown_args_out(struct winreg_InitiateSystemShutdown *r)
17068 : {
17069 : PyObject *result;
17070 0 : result = Py_None;
17071 0 : Py_INCREF(result);
17072 0 : if (!W_ERROR_IS_OK(r->out.result)) {
17073 0 : PyErr_SetWERROR(r->out.result);
17074 0 : return NULL;
17075 : }
17076 :
17077 0 : return result;
17078 : }
17079 :
17080 :
17081 0 : static PyObject *py_winreg_AbortSystemShutdown_in_get_server(PyObject *obj, void *closure)
17082 : {
17083 0 : struct winreg_AbortSystemShutdown *object = (struct winreg_AbortSystemShutdown *)pytalloc_get_ptr(obj);
17084 : PyObject *py_server;
17085 0 : if (object->in.server == NULL) {
17086 0 : Py_RETURN_NONE;
17087 : }
17088 0 : if (object->in.server == NULL) {
17089 0 : py_server = Py_None;
17090 0 : Py_INCREF(py_server);
17091 : } else {
17092 0 : py_server = PyLong_FromLong((uint16_t)*object->in.server);
17093 : }
17094 0 : return py_server;
17095 : }
17096 :
17097 0 : static int py_winreg_AbortSystemShutdown_in_set_server(PyObject *py_obj, PyObject *value, void *closure)
17098 : {
17099 0 : struct winreg_AbortSystemShutdown *object = (struct winreg_AbortSystemShutdown *)pytalloc_get_ptr(py_obj);
17100 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.server));
17101 0 : if (value == NULL) {
17102 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.server");
17103 0 : return -1;
17104 : }
17105 0 : if (value == Py_None) {
17106 0 : object->in.server = NULL;
17107 : } else {
17108 0 : object->in.server = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.server);
17109 0 : if (object->in.server == NULL) {
17110 0 : PyErr_NoMemory();
17111 0 : return -1;
17112 : }
17113 : {
17114 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.server));
17115 0 : if (PyLong_Check(value)) {
17116 : unsigned long long test_var;
17117 0 : test_var = PyLong_AsUnsignedLongLong(value);
17118 0 : if (PyErr_Occurred() != NULL) {
17119 0 : return -1;
17120 : }
17121 0 : if (test_var > uint_max) {
17122 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17123 : PyLong_Type.tp_name, uint_max, test_var);
17124 0 : return -1;
17125 : }
17126 0 : *object->in.server = test_var;
17127 : } else {
17128 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17129 : PyLong_Type.tp_name);
17130 0 : return -1;
17131 : }
17132 : }
17133 : }
17134 0 : return 0;
17135 : }
17136 :
17137 0 : static PyObject *py_winreg_AbortSystemShutdown_get_result(PyObject *obj, void *closure)
17138 : {
17139 0 : struct winreg_AbortSystemShutdown *object = (struct winreg_AbortSystemShutdown *)pytalloc_get_ptr(obj);
17140 : PyObject *py_result;
17141 0 : py_result = PyErr_FromWERROR(object->out.result);
17142 0 : return py_result;
17143 : }
17144 :
17145 0 : static int py_winreg_AbortSystemShutdown_set_result(PyObject *py_obj, PyObject *value, void *closure)
17146 : {
17147 0 : struct winreg_AbortSystemShutdown *object = (struct winreg_AbortSystemShutdown *)pytalloc_get_ptr(py_obj);
17148 0 : if (value == NULL) {
17149 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
17150 0 : return -1;
17151 : }
17152 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
17153 0 : return 0;
17154 : }
17155 :
17156 : static PyGetSetDef py_winreg_AbortSystemShutdown_getsetters[] = {
17157 : {
17158 : .name = discard_const_p(char, "in_server"),
17159 : .get = py_winreg_AbortSystemShutdown_in_get_server,
17160 : .set = py_winreg_AbortSystemShutdown_in_set_server,
17161 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
17162 : },
17163 : {
17164 : .name = discard_const_p(char, "result"),
17165 : .get = py_winreg_AbortSystemShutdown_get_result,
17166 : .set = py_winreg_AbortSystemShutdown_set_result,
17167 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
17168 : },
17169 : { .name = NULL }
17170 : };
17171 :
17172 0 : static PyObject *py_winreg_AbortSystemShutdown_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
17173 : {
17174 0 : PyObject *self = pytalloc_new(struct winreg_AbortSystemShutdown, type);
17175 0 : return self;
17176 : }
17177 :
17178 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
17179 : {
17180 :
17181 :
17182 0 : return PyLong_FromLong(25);
17183 : }
17184 :
17185 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
17186 : {
17187 0 : const struct ndr_interface_call *call = NULL;
17188 0 : struct winreg_AbortSystemShutdown *object = (struct winreg_AbortSystemShutdown *)pytalloc_get_ptr(py_obj);
17189 0 : PyObject *ret = NULL;
17190 0 : struct ndr_push *push = NULL;
17191 : DATA_BLOB blob;
17192 : enum ndr_err_code err;
17193 :
17194 0 : if (ndr_table_winreg.num_calls < 26) {
17195 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_AbortSystemShutdown_ndr_pack");
17196 0 : return NULL;
17197 : }
17198 0 : call = &ndr_table_winreg.calls[25];
17199 :
17200 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
17201 0 : if (push == NULL) {
17202 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17203 0 : return NULL;
17204 : }
17205 :
17206 0 : push->flags |= ndr_push_flags;
17207 :
17208 0 : err = call->ndr_push(push, ndr_inout_flags, object);
17209 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17210 0 : TALLOC_FREE(push);
17211 0 : PyErr_SetNdrError(err);
17212 0 : return NULL;
17213 : }
17214 0 : blob = ndr_push_blob(push);
17215 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
17216 0 : TALLOC_FREE(push);
17217 0 : return ret;
17218 : }
17219 :
17220 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17221 : {
17222 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17223 0 : PyObject *bigendian_obj = NULL;
17224 0 : PyObject *ndr64_obj = NULL;
17225 0 : uint32_t ndr_push_flags = 0;
17226 :
17227 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
17228 : discard_const_p(char *, kwnames),
17229 : &bigendian_obj,
17230 : &ndr64_obj)) {
17231 0 : return NULL;
17232 : }
17233 :
17234 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17235 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17236 : }
17237 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17238 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17239 : }
17240 :
17241 0 : return py_winreg_AbortSystemShutdown_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
17242 : }
17243 :
17244 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17245 : {
17246 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17247 0 : PyObject *bigendian_obj = NULL;
17248 0 : PyObject *ndr64_obj = NULL;
17249 0 : uint32_t ndr_push_flags = 0;
17250 :
17251 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
17252 : discard_const_p(char *, kwnames),
17253 : &bigendian_obj,
17254 : &ndr64_obj)) {
17255 0 : return NULL;
17256 : }
17257 :
17258 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17259 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17260 : }
17261 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17262 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17263 : }
17264 :
17265 0 : return py_winreg_AbortSystemShutdown_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
17266 : }
17267 :
17268 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
17269 : {
17270 0 : const struct ndr_interface_call *call = NULL;
17271 0 : struct winreg_AbortSystemShutdown *object = (struct winreg_AbortSystemShutdown *)pytalloc_get_ptr(py_obj);
17272 0 : struct ndr_pull *pull = NULL;
17273 : enum ndr_err_code err;
17274 :
17275 0 : if (ndr_table_winreg.num_calls < 26) {
17276 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_AbortSystemShutdown_ndr_unpack");
17277 0 : return NULL;
17278 : }
17279 0 : call = &ndr_table_winreg.calls[25];
17280 :
17281 0 : pull = ndr_pull_init_blob(blob, object);
17282 0 : if (pull == NULL) {
17283 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17284 0 : return NULL;
17285 : }
17286 :
17287 0 : pull->flags |= ndr_pull_flags;
17288 :
17289 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
17290 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17291 0 : TALLOC_FREE(pull);
17292 0 : PyErr_SetNdrError(err);
17293 0 : return NULL;
17294 : }
17295 0 : if (!allow_remaining) {
17296 : uint32_t highest_ofs;
17297 :
17298 0 : if (pull->offset > pull->relative_highest_offset) {
17299 0 : highest_ofs = pull->offset;
17300 : } else {
17301 0 : highest_ofs = pull->relative_highest_offset;
17302 : }
17303 0 : if (highest_ofs < pull->data_size) {
17304 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
17305 : "not all bytes consumed ofs[%u] size[%u]",
17306 : highest_ofs, pull->data_size);
17307 0 : TALLOC_FREE(pull);
17308 0 : PyErr_SetNdrError(err);
17309 0 : return NULL;
17310 : }
17311 : }
17312 :
17313 0 : TALLOC_FREE(pull);
17314 0 : Py_RETURN_NONE;
17315 : }
17316 :
17317 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17318 : {
17319 : DATA_BLOB blob;
17320 0 : Py_ssize_t blob_length = 0;
17321 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17322 0 : PyObject *bigendian_obj = NULL;
17323 0 : PyObject *ndr64_obj = NULL;
17324 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17325 0 : PyObject *allow_remaining_obj = NULL;
17326 0 : bool allow_remaining = false;
17327 :
17328 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
17329 : discard_const_p(char *, kwnames),
17330 : &blob.data, &blob_length,
17331 : &bigendian_obj,
17332 : &ndr64_obj,
17333 : &allow_remaining_obj)) {
17334 0 : return NULL;
17335 : }
17336 0 : blob.length = blob_length;
17337 :
17338 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17339 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17340 : }
17341 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17342 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17343 : }
17344 :
17345 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17346 0 : allow_remaining = true;
17347 : }
17348 :
17349 0 : return py_winreg_AbortSystemShutdown_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
17350 : }
17351 :
17352 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17353 : {
17354 : DATA_BLOB blob;
17355 0 : Py_ssize_t blob_length = 0;
17356 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17357 0 : PyObject *bigendian_obj = NULL;
17358 0 : PyObject *ndr64_obj = NULL;
17359 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17360 0 : PyObject *allow_remaining_obj = NULL;
17361 0 : bool allow_remaining = false;
17362 :
17363 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
17364 : discard_const_p(char *, kwnames),
17365 : &blob.data, &blob_length,
17366 : &bigendian_obj,
17367 : &ndr64_obj,
17368 : &allow_remaining_obj)) {
17369 0 : return NULL;
17370 : }
17371 0 : blob.length = blob_length;
17372 :
17373 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17374 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17375 : }
17376 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17377 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17378 : }
17379 :
17380 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17381 0 : allow_remaining = true;
17382 : }
17383 :
17384 0 : return py_winreg_AbortSystemShutdown_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
17385 : }
17386 :
17387 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
17388 : {
17389 0 : const struct ndr_interface_call *call = NULL;
17390 0 : struct winreg_AbortSystemShutdown *object = (struct winreg_AbortSystemShutdown *)pytalloc_get_ptr(py_obj);
17391 : PyObject *ret;
17392 : char *retstr;
17393 :
17394 0 : if (ndr_table_winreg.num_calls < 26) {
17395 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_AbortSystemShutdown_ndr_print");
17396 0 : return NULL;
17397 : }
17398 0 : call = &ndr_table_winreg.calls[25];
17399 :
17400 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
17401 0 : ret = PyUnicode_FromString(retstr);
17402 0 : TALLOC_FREE(retstr);
17403 :
17404 0 : return ret;
17405 : }
17406 :
17407 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17408 : {
17409 0 : return py_winreg_AbortSystemShutdown_ndr_print(py_obj, "winreg_AbortSystemShutdown_in", NDR_IN);
17410 : }
17411 :
17412 0 : static PyObject *py_winreg_AbortSystemShutdown_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17413 : {
17414 0 : return py_winreg_AbortSystemShutdown_ndr_print(py_obj, "winreg_AbortSystemShutdown_out", NDR_OUT);
17415 : }
17416 :
17417 : static PyMethodDef py_winreg_AbortSystemShutdown_methods[] = {
17418 : { "opnum", (PyCFunction)py_winreg_AbortSystemShutdown_ndr_opnum, METH_NOARGS|METH_CLASS,
17419 : "winreg.AbortSystemShutdown.opnum() -> 25 (0x19) " },
17420 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
17421 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
17422 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
17423 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
17424 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
17425 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
17426 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_AbortSystemShutdown_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
17427 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
17428 : { "__ndr_print_in__", (PyCFunction)py_winreg_AbortSystemShutdown_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
17429 : { "__ndr_print_out__", (PyCFunction)py_winreg_AbortSystemShutdown_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
17430 : { NULL, NULL, 0, NULL }
17431 : };
17432 :
17433 :
17434 : static PyTypeObject winreg_AbortSystemShutdown_Type = {
17435 : PyVarObject_HEAD_INIT(NULL, 0)
17436 : .tp_name = "winreg.AbortSystemShutdown",
17437 : .tp_getset = py_winreg_AbortSystemShutdown_getsetters,
17438 : .tp_methods = py_winreg_AbortSystemShutdown_methods,
17439 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
17440 : .tp_new = py_winreg_AbortSystemShutdown_new,
17441 : };
17442 :
17443 0 : static bool pack_py_winreg_AbortSystemShutdown_args_in(PyObject *args, PyObject *kwargs, struct winreg_AbortSystemShutdown *r)
17444 : {
17445 : PyObject *py_server;
17446 0 : const char *kwnames[] = {
17447 : "server", NULL
17448 : };
17449 :
17450 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_AbortSystemShutdown", discard_const_p(char *, kwnames), &py_server)) {
17451 0 : return false;
17452 : }
17453 :
17454 0 : if (py_server == NULL) {
17455 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.server");
17456 0 : return false;
17457 : }
17458 0 : if (py_server == Py_None) {
17459 0 : r->in.server = NULL;
17460 : } else {
17461 0 : r->in.server = talloc_ptrtype(r, r->in.server);
17462 0 : if (r->in.server == NULL) {
17463 0 : PyErr_NoMemory();
17464 0 : return false;
17465 : }
17466 : {
17467 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.server));
17468 0 : if (PyLong_Check(py_server)) {
17469 : unsigned long long test_var;
17470 0 : test_var = PyLong_AsUnsignedLongLong(py_server);
17471 0 : if (PyErr_Occurred() != NULL) {
17472 0 : return false;
17473 : }
17474 0 : if (test_var > uint_max) {
17475 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17476 : PyLong_Type.tp_name, uint_max, test_var);
17477 0 : return false;
17478 : }
17479 0 : *r->in.server = test_var;
17480 : } else {
17481 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17482 : PyLong_Type.tp_name);
17483 0 : return false;
17484 : }
17485 : }
17486 : }
17487 0 : return true;
17488 : }
17489 :
17490 0 : static PyObject *unpack_py_winreg_AbortSystemShutdown_args_out(struct winreg_AbortSystemShutdown *r)
17491 : {
17492 : PyObject *result;
17493 0 : result = Py_None;
17494 0 : Py_INCREF(result);
17495 0 : if (!W_ERROR_IS_OK(r->out.result)) {
17496 0 : PyErr_SetWERROR(r->out.result);
17497 0 : return NULL;
17498 : }
17499 :
17500 0 : return result;
17501 : }
17502 :
17503 :
17504 0 : static PyObject *py_winreg_GetVersion_in_get_handle(PyObject *obj, void *closure)
17505 : {
17506 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(obj);
17507 : PyObject *py_handle;
17508 0 : if (object->in.handle == NULL) {
17509 0 : Py_RETURN_NONE;
17510 : }
17511 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
17512 0 : return py_handle;
17513 : }
17514 :
17515 0 : static int py_winreg_GetVersion_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
17516 : {
17517 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(py_obj);
17518 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
17519 0 : if (value == NULL) {
17520 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
17521 0 : return -1;
17522 : }
17523 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
17524 0 : if (object->in.handle == NULL) {
17525 0 : PyErr_NoMemory();
17526 0 : return -1;
17527 : }
17528 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
17529 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
17530 0 : PyErr_NoMemory();
17531 0 : return -1;
17532 : }
17533 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
17534 0 : return 0;
17535 : }
17536 :
17537 0 : static PyObject *py_winreg_GetVersion_out_get_version(PyObject *obj, void *closure)
17538 : {
17539 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(obj);
17540 : PyObject *py_version;
17541 0 : if (object->out.version == NULL) {
17542 0 : Py_RETURN_NONE;
17543 : }
17544 0 : py_version = PyLong_FromUnsignedLongLong((uint32_t)*object->out.version);
17545 0 : return py_version;
17546 : }
17547 :
17548 0 : static int py_winreg_GetVersion_out_set_version(PyObject *py_obj, PyObject *value, void *closure)
17549 : {
17550 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(py_obj);
17551 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.version));
17552 0 : if (value == NULL) {
17553 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.version");
17554 0 : return -1;
17555 : }
17556 0 : object->out.version = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.version);
17557 0 : if (object->out.version == NULL) {
17558 0 : PyErr_NoMemory();
17559 0 : return -1;
17560 : }
17561 : {
17562 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.version));
17563 0 : if (PyLong_Check(value)) {
17564 : unsigned long long test_var;
17565 0 : test_var = PyLong_AsUnsignedLongLong(value);
17566 0 : if (PyErr_Occurred() != NULL) {
17567 0 : return -1;
17568 : }
17569 0 : if (test_var > uint_max) {
17570 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17571 : PyLong_Type.tp_name, uint_max, test_var);
17572 0 : return -1;
17573 : }
17574 0 : *object->out.version = test_var;
17575 : } else {
17576 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17577 : PyLong_Type.tp_name);
17578 0 : return -1;
17579 : }
17580 : }
17581 0 : return 0;
17582 : }
17583 :
17584 0 : static PyObject *py_winreg_GetVersion_get_result(PyObject *obj, void *closure)
17585 : {
17586 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(obj);
17587 : PyObject *py_result;
17588 0 : py_result = PyErr_FromWERROR(object->out.result);
17589 0 : return py_result;
17590 : }
17591 :
17592 0 : static int py_winreg_GetVersion_set_result(PyObject *py_obj, PyObject *value, void *closure)
17593 : {
17594 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(py_obj);
17595 0 : if (value == NULL) {
17596 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
17597 0 : return -1;
17598 : }
17599 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
17600 0 : return 0;
17601 : }
17602 :
17603 : static PyGetSetDef py_winreg_GetVersion_getsetters[] = {
17604 : {
17605 : .name = discard_const_p(char, "in_handle"),
17606 : .get = py_winreg_GetVersion_in_get_handle,
17607 : .set = py_winreg_GetVersion_in_set_handle,
17608 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
17609 : },
17610 : {
17611 : .name = discard_const_p(char, "out_version"),
17612 : .get = py_winreg_GetVersion_out_get_version,
17613 : .set = py_winreg_GetVersion_out_set_version,
17614 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
17615 : },
17616 : {
17617 : .name = discard_const_p(char, "result"),
17618 : .get = py_winreg_GetVersion_get_result,
17619 : .set = py_winreg_GetVersion_set_result,
17620 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
17621 : },
17622 : { .name = NULL }
17623 : };
17624 :
17625 0 : static PyObject *py_winreg_GetVersion_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
17626 : {
17627 0 : PyObject *self = pytalloc_new(struct winreg_GetVersion, type);
17628 0 : struct winreg_GetVersion *_self = (struct winreg_GetVersion *)pytalloc_get_ptr(self);
17629 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
17630 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
17631 0 : _self->out.version = talloc_zero(mem_ctx, uint32_t);
17632 0 : return self;
17633 : }
17634 :
17635 0 : static PyObject *py_winreg_GetVersion_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
17636 : {
17637 :
17638 :
17639 0 : return PyLong_FromLong(26);
17640 : }
17641 :
17642 0 : static PyObject *py_winreg_GetVersion_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
17643 : {
17644 0 : const struct ndr_interface_call *call = NULL;
17645 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(py_obj);
17646 0 : PyObject *ret = NULL;
17647 0 : struct ndr_push *push = NULL;
17648 : DATA_BLOB blob;
17649 : enum ndr_err_code err;
17650 :
17651 0 : if (ndr_table_winreg.num_calls < 27) {
17652 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetVersion_ndr_pack");
17653 0 : return NULL;
17654 : }
17655 0 : call = &ndr_table_winreg.calls[26];
17656 :
17657 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
17658 0 : if (push == NULL) {
17659 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17660 0 : return NULL;
17661 : }
17662 :
17663 0 : push->flags |= ndr_push_flags;
17664 :
17665 0 : err = call->ndr_push(push, ndr_inout_flags, object);
17666 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17667 0 : TALLOC_FREE(push);
17668 0 : PyErr_SetNdrError(err);
17669 0 : return NULL;
17670 : }
17671 0 : blob = ndr_push_blob(push);
17672 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
17673 0 : TALLOC_FREE(push);
17674 0 : return ret;
17675 : }
17676 :
17677 0 : static PyObject *py_winreg_GetVersion_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17678 : {
17679 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17680 0 : PyObject *bigendian_obj = NULL;
17681 0 : PyObject *ndr64_obj = NULL;
17682 0 : uint32_t ndr_push_flags = 0;
17683 :
17684 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
17685 : discard_const_p(char *, kwnames),
17686 : &bigendian_obj,
17687 : &ndr64_obj)) {
17688 0 : return NULL;
17689 : }
17690 :
17691 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17692 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17693 : }
17694 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17695 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17696 : }
17697 :
17698 0 : return py_winreg_GetVersion_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
17699 : }
17700 :
17701 0 : static PyObject *py_winreg_GetVersion_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17702 : {
17703 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
17704 0 : PyObject *bigendian_obj = NULL;
17705 0 : PyObject *ndr64_obj = NULL;
17706 0 : uint32_t ndr_push_flags = 0;
17707 :
17708 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
17709 : discard_const_p(char *, kwnames),
17710 : &bigendian_obj,
17711 : &ndr64_obj)) {
17712 0 : return NULL;
17713 : }
17714 :
17715 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17716 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
17717 : }
17718 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17719 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
17720 : }
17721 :
17722 0 : return py_winreg_GetVersion_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
17723 : }
17724 :
17725 0 : static PyObject *py_winreg_GetVersion_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
17726 : {
17727 0 : const struct ndr_interface_call *call = NULL;
17728 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(py_obj);
17729 0 : struct ndr_pull *pull = NULL;
17730 : enum ndr_err_code err;
17731 :
17732 0 : if (ndr_table_winreg.num_calls < 27) {
17733 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetVersion_ndr_unpack");
17734 0 : return NULL;
17735 : }
17736 0 : call = &ndr_table_winreg.calls[26];
17737 :
17738 0 : pull = ndr_pull_init_blob(blob, object);
17739 0 : if (pull == NULL) {
17740 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
17741 0 : return NULL;
17742 : }
17743 :
17744 0 : pull->flags |= ndr_pull_flags;
17745 :
17746 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
17747 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
17748 0 : TALLOC_FREE(pull);
17749 0 : PyErr_SetNdrError(err);
17750 0 : return NULL;
17751 : }
17752 0 : if (!allow_remaining) {
17753 : uint32_t highest_ofs;
17754 :
17755 0 : if (pull->offset > pull->relative_highest_offset) {
17756 0 : highest_ofs = pull->offset;
17757 : } else {
17758 0 : highest_ofs = pull->relative_highest_offset;
17759 : }
17760 0 : if (highest_ofs < pull->data_size) {
17761 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
17762 : "not all bytes consumed ofs[%u] size[%u]",
17763 : highest_ofs, pull->data_size);
17764 0 : TALLOC_FREE(pull);
17765 0 : PyErr_SetNdrError(err);
17766 0 : return NULL;
17767 : }
17768 : }
17769 :
17770 0 : TALLOC_FREE(pull);
17771 0 : Py_RETURN_NONE;
17772 : }
17773 :
17774 0 : static PyObject *py_winreg_GetVersion_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17775 : {
17776 : DATA_BLOB blob;
17777 0 : Py_ssize_t blob_length = 0;
17778 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17779 0 : PyObject *bigendian_obj = NULL;
17780 0 : PyObject *ndr64_obj = NULL;
17781 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17782 0 : PyObject *allow_remaining_obj = NULL;
17783 0 : bool allow_remaining = false;
17784 :
17785 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
17786 : discard_const_p(char *, kwnames),
17787 : &blob.data, &blob_length,
17788 : &bigendian_obj,
17789 : &ndr64_obj,
17790 : &allow_remaining_obj)) {
17791 0 : return NULL;
17792 : }
17793 0 : blob.length = blob_length;
17794 :
17795 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17796 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17797 : }
17798 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17799 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17800 : }
17801 :
17802 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17803 0 : allow_remaining = true;
17804 : }
17805 :
17806 0 : return py_winreg_GetVersion_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
17807 : }
17808 :
17809 0 : static PyObject *py_winreg_GetVersion_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
17810 : {
17811 : DATA_BLOB blob;
17812 0 : Py_ssize_t blob_length = 0;
17813 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
17814 0 : PyObject *bigendian_obj = NULL;
17815 0 : PyObject *ndr64_obj = NULL;
17816 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
17817 0 : PyObject *allow_remaining_obj = NULL;
17818 0 : bool allow_remaining = false;
17819 :
17820 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
17821 : discard_const_p(char *, kwnames),
17822 : &blob.data, &blob_length,
17823 : &bigendian_obj,
17824 : &ndr64_obj,
17825 : &allow_remaining_obj)) {
17826 0 : return NULL;
17827 : }
17828 0 : blob.length = blob_length;
17829 :
17830 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
17831 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
17832 : }
17833 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
17834 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
17835 : }
17836 :
17837 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
17838 0 : allow_remaining = true;
17839 : }
17840 :
17841 0 : return py_winreg_GetVersion_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
17842 : }
17843 :
17844 0 : static PyObject *py_winreg_GetVersion_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
17845 : {
17846 0 : const struct ndr_interface_call *call = NULL;
17847 0 : struct winreg_GetVersion *object = (struct winreg_GetVersion *)pytalloc_get_ptr(py_obj);
17848 : PyObject *ret;
17849 : char *retstr;
17850 :
17851 0 : if (ndr_table_winreg.num_calls < 27) {
17852 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_GetVersion_ndr_print");
17853 0 : return NULL;
17854 : }
17855 0 : call = &ndr_table_winreg.calls[26];
17856 :
17857 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
17858 0 : ret = PyUnicode_FromString(retstr);
17859 0 : TALLOC_FREE(retstr);
17860 :
17861 0 : return ret;
17862 : }
17863 :
17864 0 : static PyObject *py_winreg_GetVersion_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17865 : {
17866 0 : return py_winreg_GetVersion_ndr_print(py_obj, "winreg_GetVersion_in", NDR_IN);
17867 : }
17868 :
17869 0 : static PyObject *py_winreg_GetVersion_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
17870 : {
17871 0 : return py_winreg_GetVersion_ndr_print(py_obj, "winreg_GetVersion_out", NDR_OUT);
17872 : }
17873 :
17874 : static PyMethodDef py_winreg_GetVersion_methods[] = {
17875 : { "opnum", (PyCFunction)py_winreg_GetVersion_ndr_opnum, METH_NOARGS|METH_CLASS,
17876 : "winreg.GetVersion.opnum() -> 26 (0x1a) " },
17877 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
17878 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
17879 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
17880 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
17881 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
17882 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
17883 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_GetVersion_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
17884 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
17885 : { "__ndr_print_in__", (PyCFunction)py_winreg_GetVersion_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
17886 : { "__ndr_print_out__", (PyCFunction)py_winreg_GetVersion_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
17887 : { NULL, NULL, 0, NULL }
17888 : };
17889 :
17890 :
17891 : static PyTypeObject winreg_GetVersion_Type = {
17892 : PyVarObject_HEAD_INIT(NULL, 0)
17893 : .tp_name = "winreg.GetVersion",
17894 : .tp_getset = py_winreg_GetVersion_getsetters,
17895 : .tp_methods = py_winreg_GetVersion_methods,
17896 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
17897 : .tp_new = py_winreg_GetVersion_new,
17898 : };
17899 :
17900 1 : static bool pack_py_winreg_GetVersion_args_in(PyObject *args, PyObject *kwargs, struct winreg_GetVersion *r)
17901 : {
17902 : PyObject *py_handle;
17903 1 : const char *kwnames[] = {
17904 : "handle", NULL
17905 : };
17906 :
17907 1 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winreg_GetVersion", discard_const_p(char *, kwnames), &py_handle)) {
17908 0 : return false;
17909 : }
17910 :
17911 1 : if (py_handle == NULL) {
17912 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
17913 0 : return false;
17914 : }
17915 1 : r->in.handle = talloc_ptrtype(r, r->in.handle);
17916 1 : if (r->in.handle == NULL) {
17917 0 : PyErr_NoMemory();
17918 0 : return false;
17919 : }
17920 1 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
17921 1 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
17922 0 : PyErr_NoMemory();
17923 0 : return false;
17924 : }
17925 1 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
17926 1 : return true;
17927 : }
17928 :
17929 1 : static PyObject *unpack_py_winreg_GetVersion_args_out(struct winreg_GetVersion *r)
17930 : {
17931 : PyObject *result;
17932 : PyObject *py_version;
17933 1 : py_version = PyLong_FromUnsignedLongLong((uint32_t)*r->out.version);
17934 1 : result = py_version;
17935 1 : if (!W_ERROR_IS_OK(r->out.result)) {
17936 0 : PyErr_SetWERROR(r->out.result);
17937 0 : return NULL;
17938 : }
17939 :
17940 1 : return result;
17941 : }
17942 :
17943 :
17944 0 : static PyObject *py_winreg_OpenHKCC_in_get_system_name(PyObject *obj, void *closure)
17945 : {
17946 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(obj);
17947 : PyObject *py_system_name;
17948 0 : if (object->in.system_name == NULL) {
17949 0 : Py_RETURN_NONE;
17950 : }
17951 0 : if (object->in.system_name == NULL) {
17952 0 : py_system_name = Py_None;
17953 0 : Py_INCREF(py_system_name);
17954 : } else {
17955 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
17956 : }
17957 0 : return py_system_name;
17958 : }
17959 :
17960 0 : static int py_winreg_OpenHKCC_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
17961 : {
17962 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(py_obj);
17963 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
17964 0 : if (value == NULL) {
17965 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
17966 0 : return -1;
17967 : }
17968 0 : if (value == Py_None) {
17969 0 : object->in.system_name = NULL;
17970 : } else {
17971 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
17972 0 : if (object->in.system_name == NULL) {
17973 0 : PyErr_NoMemory();
17974 0 : return -1;
17975 : }
17976 : {
17977 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
17978 0 : if (PyLong_Check(value)) {
17979 : unsigned long long test_var;
17980 0 : test_var = PyLong_AsUnsignedLongLong(value);
17981 0 : if (PyErr_Occurred() != NULL) {
17982 0 : return -1;
17983 : }
17984 0 : if (test_var > uint_max) {
17985 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
17986 : PyLong_Type.tp_name, uint_max, test_var);
17987 0 : return -1;
17988 : }
17989 0 : *object->in.system_name = test_var;
17990 : } else {
17991 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
17992 : PyLong_Type.tp_name);
17993 0 : return -1;
17994 : }
17995 : }
17996 : }
17997 0 : return 0;
17998 : }
17999 :
18000 0 : static PyObject *py_winreg_OpenHKCC_in_get_access_mask(PyObject *obj, void *closure)
18001 : {
18002 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(obj);
18003 : PyObject *py_access_mask;
18004 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
18005 0 : return py_access_mask;
18006 : }
18007 :
18008 0 : static int py_winreg_OpenHKCC_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
18009 : {
18010 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(py_obj);
18011 0 : if (value == NULL) {
18012 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
18013 0 : return -1;
18014 : }
18015 : {
18016 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
18017 0 : if (PyLong_Check(value)) {
18018 : unsigned long long test_var;
18019 0 : test_var = PyLong_AsUnsignedLongLong(value);
18020 0 : if (PyErr_Occurred() != NULL) {
18021 0 : return -1;
18022 : }
18023 0 : if (test_var > uint_max) {
18024 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18025 : PyLong_Type.tp_name, uint_max, test_var);
18026 0 : return -1;
18027 : }
18028 0 : object->in.access_mask = test_var;
18029 : } else {
18030 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18031 : PyLong_Type.tp_name);
18032 0 : return -1;
18033 : }
18034 : }
18035 0 : return 0;
18036 : }
18037 :
18038 0 : static PyObject *py_winreg_OpenHKCC_out_get_handle(PyObject *obj, void *closure)
18039 : {
18040 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(obj);
18041 : PyObject *py_handle;
18042 0 : if (object->out.handle == NULL) {
18043 0 : Py_RETURN_NONE;
18044 : }
18045 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
18046 0 : return py_handle;
18047 : }
18048 :
18049 0 : static int py_winreg_OpenHKCC_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
18050 : {
18051 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(py_obj);
18052 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
18053 0 : if (value == NULL) {
18054 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
18055 0 : return -1;
18056 : }
18057 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
18058 0 : if (object->out.handle == NULL) {
18059 0 : PyErr_NoMemory();
18060 0 : return -1;
18061 : }
18062 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
18063 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
18064 0 : PyErr_NoMemory();
18065 0 : return -1;
18066 : }
18067 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
18068 0 : return 0;
18069 : }
18070 :
18071 0 : static PyObject *py_winreg_OpenHKCC_get_result(PyObject *obj, void *closure)
18072 : {
18073 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(obj);
18074 : PyObject *py_result;
18075 0 : py_result = PyErr_FromWERROR(object->out.result);
18076 0 : return py_result;
18077 : }
18078 :
18079 0 : static int py_winreg_OpenHKCC_set_result(PyObject *py_obj, PyObject *value, void *closure)
18080 : {
18081 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(py_obj);
18082 0 : if (value == NULL) {
18083 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
18084 0 : return -1;
18085 : }
18086 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
18087 0 : return 0;
18088 : }
18089 :
18090 : static PyGetSetDef py_winreg_OpenHKCC_getsetters[] = {
18091 : {
18092 : .name = discard_const_p(char, "in_system_name"),
18093 : .get = py_winreg_OpenHKCC_in_get_system_name,
18094 : .set = py_winreg_OpenHKCC_in_set_system_name,
18095 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
18096 : },
18097 : {
18098 : .name = discard_const_p(char, "in_access_mask"),
18099 : .get = py_winreg_OpenHKCC_in_get_access_mask,
18100 : .set = py_winreg_OpenHKCC_in_set_access_mask,
18101 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
18102 : },
18103 : {
18104 : .name = discard_const_p(char, "out_handle"),
18105 : .get = py_winreg_OpenHKCC_out_get_handle,
18106 : .set = py_winreg_OpenHKCC_out_set_handle,
18107 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
18108 : },
18109 : {
18110 : .name = discard_const_p(char, "result"),
18111 : .get = py_winreg_OpenHKCC_get_result,
18112 : .set = py_winreg_OpenHKCC_set_result,
18113 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
18114 : },
18115 : { .name = NULL }
18116 : };
18117 :
18118 0 : static PyObject *py_winreg_OpenHKCC_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
18119 : {
18120 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKCC, type);
18121 0 : struct winreg_OpenHKCC *_self = (struct winreg_OpenHKCC *)pytalloc_get_ptr(self);
18122 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
18123 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
18124 0 : return self;
18125 : }
18126 :
18127 0 : static PyObject *py_winreg_OpenHKCC_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
18128 : {
18129 :
18130 :
18131 0 : return PyLong_FromLong(27);
18132 : }
18133 :
18134 0 : static PyObject *py_winreg_OpenHKCC_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
18135 : {
18136 0 : const struct ndr_interface_call *call = NULL;
18137 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(py_obj);
18138 0 : PyObject *ret = NULL;
18139 0 : struct ndr_push *push = NULL;
18140 : DATA_BLOB blob;
18141 : enum ndr_err_code err;
18142 :
18143 0 : if (ndr_table_winreg.num_calls < 28) {
18144 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCC_ndr_pack");
18145 0 : return NULL;
18146 : }
18147 0 : call = &ndr_table_winreg.calls[27];
18148 :
18149 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
18150 0 : if (push == NULL) {
18151 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18152 0 : return NULL;
18153 : }
18154 :
18155 0 : push->flags |= ndr_push_flags;
18156 :
18157 0 : err = call->ndr_push(push, ndr_inout_flags, object);
18158 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18159 0 : TALLOC_FREE(push);
18160 0 : PyErr_SetNdrError(err);
18161 0 : return NULL;
18162 : }
18163 0 : blob = ndr_push_blob(push);
18164 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
18165 0 : TALLOC_FREE(push);
18166 0 : return ret;
18167 : }
18168 :
18169 0 : static PyObject *py_winreg_OpenHKCC_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18170 : {
18171 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18172 0 : PyObject *bigendian_obj = NULL;
18173 0 : PyObject *ndr64_obj = NULL;
18174 0 : uint32_t ndr_push_flags = 0;
18175 :
18176 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
18177 : discard_const_p(char *, kwnames),
18178 : &bigendian_obj,
18179 : &ndr64_obj)) {
18180 0 : return NULL;
18181 : }
18182 :
18183 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18184 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18185 : }
18186 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18187 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18188 : }
18189 :
18190 0 : return py_winreg_OpenHKCC_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
18191 : }
18192 :
18193 0 : static PyObject *py_winreg_OpenHKCC_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18194 : {
18195 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18196 0 : PyObject *bigendian_obj = NULL;
18197 0 : PyObject *ndr64_obj = NULL;
18198 0 : uint32_t ndr_push_flags = 0;
18199 :
18200 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
18201 : discard_const_p(char *, kwnames),
18202 : &bigendian_obj,
18203 : &ndr64_obj)) {
18204 0 : return NULL;
18205 : }
18206 :
18207 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18208 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18209 : }
18210 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18211 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18212 : }
18213 :
18214 0 : return py_winreg_OpenHKCC_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
18215 : }
18216 :
18217 0 : static PyObject *py_winreg_OpenHKCC_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
18218 : {
18219 0 : const struct ndr_interface_call *call = NULL;
18220 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(py_obj);
18221 0 : struct ndr_pull *pull = NULL;
18222 : enum ndr_err_code err;
18223 :
18224 0 : if (ndr_table_winreg.num_calls < 28) {
18225 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCC_ndr_unpack");
18226 0 : return NULL;
18227 : }
18228 0 : call = &ndr_table_winreg.calls[27];
18229 :
18230 0 : pull = ndr_pull_init_blob(blob, object);
18231 0 : if (pull == NULL) {
18232 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18233 0 : return NULL;
18234 : }
18235 :
18236 0 : pull->flags |= ndr_pull_flags;
18237 :
18238 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
18239 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18240 0 : TALLOC_FREE(pull);
18241 0 : PyErr_SetNdrError(err);
18242 0 : return NULL;
18243 : }
18244 0 : if (!allow_remaining) {
18245 : uint32_t highest_ofs;
18246 :
18247 0 : if (pull->offset > pull->relative_highest_offset) {
18248 0 : highest_ofs = pull->offset;
18249 : } else {
18250 0 : highest_ofs = pull->relative_highest_offset;
18251 : }
18252 0 : if (highest_ofs < pull->data_size) {
18253 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
18254 : "not all bytes consumed ofs[%u] size[%u]",
18255 : highest_ofs, pull->data_size);
18256 0 : TALLOC_FREE(pull);
18257 0 : PyErr_SetNdrError(err);
18258 0 : return NULL;
18259 : }
18260 : }
18261 :
18262 0 : TALLOC_FREE(pull);
18263 0 : Py_RETURN_NONE;
18264 : }
18265 :
18266 0 : static PyObject *py_winreg_OpenHKCC_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18267 : {
18268 : DATA_BLOB blob;
18269 0 : Py_ssize_t blob_length = 0;
18270 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18271 0 : PyObject *bigendian_obj = NULL;
18272 0 : PyObject *ndr64_obj = NULL;
18273 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18274 0 : PyObject *allow_remaining_obj = NULL;
18275 0 : bool allow_remaining = false;
18276 :
18277 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
18278 : discard_const_p(char *, kwnames),
18279 : &blob.data, &blob_length,
18280 : &bigendian_obj,
18281 : &ndr64_obj,
18282 : &allow_remaining_obj)) {
18283 0 : return NULL;
18284 : }
18285 0 : blob.length = blob_length;
18286 :
18287 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18288 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18289 : }
18290 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18291 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18292 : }
18293 :
18294 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18295 0 : allow_remaining = true;
18296 : }
18297 :
18298 0 : return py_winreg_OpenHKCC_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
18299 : }
18300 :
18301 0 : static PyObject *py_winreg_OpenHKCC_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18302 : {
18303 : DATA_BLOB blob;
18304 0 : Py_ssize_t blob_length = 0;
18305 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18306 0 : PyObject *bigendian_obj = NULL;
18307 0 : PyObject *ndr64_obj = NULL;
18308 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18309 0 : PyObject *allow_remaining_obj = NULL;
18310 0 : bool allow_remaining = false;
18311 :
18312 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
18313 : discard_const_p(char *, kwnames),
18314 : &blob.data, &blob_length,
18315 : &bigendian_obj,
18316 : &ndr64_obj,
18317 : &allow_remaining_obj)) {
18318 0 : return NULL;
18319 : }
18320 0 : blob.length = blob_length;
18321 :
18322 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18323 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18324 : }
18325 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18326 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18327 : }
18328 :
18329 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18330 0 : allow_remaining = true;
18331 : }
18332 :
18333 0 : return py_winreg_OpenHKCC_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
18334 : }
18335 :
18336 0 : static PyObject *py_winreg_OpenHKCC_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
18337 : {
18338 0 : const struct ndr_interface_call *call = NULL;
18339 0 : struct winreg_OpenHKCC *object = (struct winreg_OpenHKCC *)pytalloc_get_ptr(py_obj);
18340 : PyObject *ret;
18341 : char *retstr;
18342 :
18343 0 : if (ndr_table_winreg.num_calls < 28) {
18344 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKCC_ndr_print");
18345 0 : return NULL;
18346 : }
18347 0 : call = &ndr_table_winreg.calls[27];
18348 :
18349 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
18350 0 : ret = PyUnicode_FromString(retstr);
18351 0 : TALLOC_FREE(retstr);
18352 :
18353 0 : return ret;
18354 : }
18355 :
18356 0 : static PyObject *py_winreg_OpenHKCC_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18357 : {
18358 0 : return py_winreg_OpenHKCC_ndr_print(py_obj, "winreg_OpenHKCC_in", NDR_IN);
18359 : }
18360 :
18361 0 : static PyObject *py_winreg_OpenHKCC_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18362 : {
18363 0 : return py_winreg_OpenHKCC_ndr_print(py_obj, "winreg_OpenHKCC_out", NDR_OUT);
18364 : }
18365 :
18366 : static PyMethodDef py_winreg_OpenHKCC_methods[] = {
18367 : { "opnum", (PyCFunction)py_winreg_OpenHKCC_ndr_opnum, METH_NOARGS|METH_CLASS,
18368 : "winreg.OpenHKCC.opnum() -> 27 (0x1b) " },
18369 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
18370 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
18371 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
18372 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
18373 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
18374 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
18375 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKCC_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
18376 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
18377 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKCC_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
18378 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKCC_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
18379 : { NULL, NULL, 0, NULL }
18380 : };
18381 :
18382 :
18383 : static PyTypeObject winreg_OpenHKCC_Type = {
18384 : PyVarObject_HEAD_INIT(NULL, 0)
18385 : .tp_name = "winreg.OpenHKCC",
18386 : .tp_getset = py_winreg_OpenHKCC_getsetters,
18387 : .tp_methods = py_winreg_OpenHKCC_methods,
18388 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
18389 : .tp_new = py_winreg_OpenHKCC_new,
18390 : };
18391 :
18392 0 : static bool pack_py_winreg_OpenHKCC_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKCC *r)
18393 : {
18394 : PyObject *py_system_name;
18395 : PyObject *py_access_mask;
18396 0 : const char *kwnames[] = {
18397 : "system_name", "access_mask", NULL
18398 : };
18399 :
18400 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKCC", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
18401 0 : return false;
18402 : }
18403 :
18404 0 : if (py_system_name == NULL) {
18405 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
18406 0 : return false;
18407 : }
18408 0 : if (py_system_name == Py_None) {
18409 0 : r->in.system_name = NULL;
18410 : } else {
18411 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
18412 0 : if (r->in.system_name == NULL) {
18413 0 : PyErr_NoMemory();
18414 0 : return false;
18415 : }
18416 : {
18417 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
18418 0 : if (PyLong_Check(py_system_name)) {
18419 : unsigned long long test_var;
18420 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
18421 0 : if (PyErr_Occurred() != NULL) {
18422 0 : return false;
18423 : }
18424 0 : if (test_var > uint_max) {
18425 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18426 : PyLong_Type.tp_name, uint_max, test_var);
18427 0 : return false;
18428 : }
18429 0 : *r->in.system_name = test_var;
18430 : } else {
18431 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18432 : PyLong_Type.tp_name);
18433 0 : return false;
18434 : }
18435 : }
18436 : }
18437 0 : if (py_access_mask == NULL) {
18438 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
18439 0 : return false;
18440 : }
18441 : {
18442 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
18443 0 : if (PyLong_Check(py_access_mask)) {
18444 : unsigned long long test_var;
18445 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
18446 0 : if (PyErr_Occurred() != NULL) {
18447 0 : return false;
18448 : }
18449 0 : if (test_var > uint_max) {
18450 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18451 : PyLong_Type.tp_name, uint_max, test_var);
18452 0 : return false;
18453 : }
18454 0 : r->in.access_mask = test_var;
18455 : } else {
18456 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18457 : PyLong_Type.tp_name);
18458 0 : return false;
18459 : }
18460 : }
18461 0 : return true;
18462 : }
18463 :
18464 0 : static PyObject *unpack_py_winreg_OpenHKCC_args_out(struct winreg_OpenHKCC *r)
18465 : {
18466 : PyObject *result;
18467 : PyObject *py_handle;
18468 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
18469 0 : result = py_handle;
18470 0 : if (!W_ERROR_IS_OK(r->out.result)) {
18471 0 : PyErr_SetWERROR(r->out.result);
18472 0 : return NULL;
18473 : }
18474 :
18475 0 : return result;
18476 : }
18477 :
18478 :
18479 0 : static PyObject *py_winreg_OpenHKDD_in_get_system_name(PyObject *obj, void *closure)
18480 : {
18481 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(obj);
18482 : PyObject *py_system_name;
18483 0 : if (object->in.system_name == NULL) {
18484 0 : Py_RETURN_NONE;
18485 : }
18486 0 : if (object->in.system_name == NULL) {
18487 0 : py_system_name = Py_None;
18488 0 : Py_INCREF(py_system_name);
18489 : } else {
18490 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
18491 : }
18492 0 : return py_system_name;
18493 : }
18494 :
18495 0 : static int py_winreg_OpenHKDD_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
18496 : {
18497 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(py_obj);
18498 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
18499 0 : if (value == NULL) {
18500 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
18501 0 : return -1;
18502 : }
18503 0 : if (value == Py_None) {
18504 0 : object->in.system_name = NULL;
18505 : } else {
18506 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
18507 0 : if (object->in.system_name == NULL) {
18508 0 : PyErr_NoMemory();
18509 0 : return -1;
18510 : }
18511 : {
18512 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
18513 0 : if (PyLong_Check(value)) {
18514 : unsigned long long test_var;
18515 0 : test_var = PyLong_AsUnsignedLongLong(value);
18516 0 : if (PyErr_Occurred() != NULL) {
18517 0 : return -1;
18518 : }
18519 0 : if (test_var > uint_max) {
18520 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18521 : PyLong_Type.tp_name, uint_max, test_var);
18522 0 : return -1;
18523 : }
18524 0 : *object->in.system_name = test_var;
18525 : } else {
18526 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18527 : PyLong_Type.tp_name);
18528 0 : return -1;
18529 : }
18530 : }
18531 : }
18532 0 : return 0;
18533 : }
18534 :
18535 0 : static PyObject *py_winreg_OpenHKDD_in_get_access_mask(PyObject *obj, void *closure)
18536 : {
18537 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(obj);
18538 : PyObject *py_access_mask;
18539 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
18540 0 : return py_access_mask;
18541 : }
18542 :
18543 0 : static int py_winreg_OpenHKDD_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
18544 : {
18545 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(py_obj);
18546 0 : if (value == NULL) {
18547 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
18548 0 : return -1;
18549 : }
18550 : {
18551 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
18552 0 : if (PyLong_Check(value)) {
18553 : unsigned long long test_var;
18554 0 : test_var = PyLong_AsUnsignedLongLong(value);
18555 0 : if (PyErr_Occurred() != NULL) {
18556 0 : return -1;
18557 : }
18558 0 : if (test_var > uint_max) {
18559 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18560 : PyLong_Type.tp_name, uint_max, test_var);
18561 0 : return -1;
18562 : }
18563 0 : object->in.access_mask = test_var;
18564 : } else {
18565 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18566 : PyLong_Type.tp_name);
18567 0 : return -1;
18568 : }
18569 : }
18570 0 : return 0;
18571 : }
18572 :
18573 0 : static PyObject *py_winreg_OpenHKDD_out_get_handle(PyObject *obj, void *closure)
18574 : {
18575 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(obj);
18576 : PyObject *py_handle;
18577 0 : if (object->out.handle == NULL) {
18578 0 : Py_RETURN_NONE;
18579 : }
18580 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
18581 0 : return py_handle;
18582 : }
18583 :
18584 0 : static int py_winreg_OpenHKDD_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
18585 : {
18586 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(py_obj);
18587 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
18588 0 : if (value == NULL) {
18589 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
18590 0 : return -1;
18591 : }
18592 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
18593 0 : if (object->out.handle == NULL) {
18594 0 : PyErr_NoMemory();
18595 0 : return -1;
18596 : }
18597 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
18598 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
18599 0 : PyErr_NoMemory();
18600 0 : return -1;
18601 : }
18602 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
18603 0 : return 0;
18604 : }
18605 :
18606 0 : static PyObject *py_winreg_OpenHKDD_get_result(PyObject *obj, void *closure)
18607 : {
18608 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(obj);
18609 : PyObject *py_result;
18610 0 : py_result = PyErr_FromWERROR(object->out.result);
18611 0 : return py_result;
18612 : }
18613 :
18614 0 : static int py_winreg_OpenHKDD_set_result(PyObject *py_obj, PyObject *value, void *closure)
18615 : {
18616 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(py_obj);
18617 0 : if (value == NULL) {
18618 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
18619 0 : return -1;
18620 : }
18621 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
18622 0 : return 0;
18623 : }
18624 :
18625 : static PyGetSetDef py_winreg_OpenHKDD_getsetters[] = {
18626 : {
18627 : .name = discard_const_p(char, "in_system_name"),
18628 : .get = py_winreg_OpenHKDD_in_get_system_name,
18629 : .set = py_winreg_OpenHKDD_in_set_system_name,
18630 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
18631 : },
18632 : {
18633 : .name = discard_const_p(char, "in_access_mask"),
18634 : .get = py_winreg_OpenHKDD_in_get_access_mask,
18635 : .set = py_winreg_OpenHKDD_in_set_access_mask,
18636 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
18637 : },
18638 : {
18639 : .name = discard_const_p(char, "out_handle"),
18640 : .get = py_winreg_OpenHKDD_out_get_handle,
18641 : .set = py_winreg_OpenHKDD_out_set_handle,
18642 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
18643 : },
18644 : {
18645 : .name = discard_const_p(char, "result"),
18646 : .get = py_winreg_OpenHKDD_get_result,
18647 : .set = py_winreg_OpenHKDD_set_result,
18648 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
18649 : },
18650 : { .name = NULL }
18651 : };
18652 :
18653 0 : static PyObject *py_winreg_OpenHKDD_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
18654 : {
18655 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKDD, type);
18656 0 : struct winreg_OpenHKDD *_self = (struct winreg_OpenHKDD *)pytalloc_get_ptr(self);
18657 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
18658 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
18659 0 : return self;
18660 : }
18661 :
18662 0 : static PyObject *py_winreg_OpenHKDD_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
18663 : {
18664 :
18665 :
18666 0 : return PyLong_FromLong(28);
18667 : }
18668 :
18669 0 : static PyObject *py_winreg_OpenHKDD_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
18670 : {
18671 0 : const struct ndr_interface_call *call = NULL;
18672 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(py_obj);
18673 0 : PyObject *ret = NULL;
18674 0 : struct ndr_push *push = NULL;
18675 : DATA_BLOB blob;
18676 : enum ndr_err_code err;
18677 :
18678 0 : if (ndr_table_winreg.num_calls < 29) {
18679 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKDD_ndr_pack");
18680 0 : return NULL;
18681 : }
18682 0 : call = &ndr_table_winreg.calls[28];
18683 :
18684 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
18685 0 : if (push == NULL) {
18686 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18687 0 : return NULL;
18688 : }
18689 :
18690 0 : push->flags |= ndr_push_flags;
18691 :
18692 0 : err = call->ndr_push(push, ndr_inout_flags, object);
18693 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18694 0 : TALLOC_FREE(push);
18695 0 : PyErr_SetNdrError(err);
18696 0 : return NULL;
18697 : }
18698 0 : blob = ndr_push_blob(push);
18699 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
18700 0 : TALLOC_FREE(push);
18701 0 : return ret;
18702 : }
18703 :
18704 0 : static PyObject *py_winreg_OpenHKDD_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18705 : {
18706 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18707 0 : PyObject *bigendian_obj = NULL;
18708 0 : PyObject *ndr64_obj = NULL;
18709 0 : uint32_t ndr_push_flags = 0;
18710 :
18711 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
18712 : discard_const_p(char *, kwnames),
18713 : &bigendian_obj,
18714 : &ndr64_obj)) {
18715 0 : return NULL;
18716 : }
18717 :
18718 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18719 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18720 : }
18721 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18722 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18723 : }
18724 :
18725 0 : return py_winreg_OpenHKDD_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
18726 : }
18727 :
18728 0 : static PyObject *py_winreg_OpenHKDD_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18729 : {
18730 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
18731 0 : PyObject *bigendian_obj = NULL;
18732 0 : PyObject *ndr64_obj = NULL;
18733 0 : uint32_t ndr_push_flags = 0;
18734 :
18735 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
18736 : discard_const_p(char *, kwnames),
18737 : &bigendian_obj,
18738 : &ndr64_obj)) {
18739 0 : return NULL;
18740 : }
18741 :
18742 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18743 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
18744 : }
18745 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18746 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
18747 : }
18748 :
18749 0 : return py_winreg_OpenHKDD_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
18750 : }
18751 :
18752 0 : static PyObject *py_winreg_OpenHKDD_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
18753 : {
18754 0 : const struct ndr_interface_call *call = NULL;
18755 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(py_obj);
18756 0 : struct ndr_pull *pull = NULL;
18757 : enum ndr_err_code err;
18758 :
18759 0 : if (ndr_table_winreg.num_calls < 29) {
18760 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKDD_ndr_unpack");
18761 0 : return NULL;
18762 : }
18763 0 : call = &ndr_table_winreg.calls[28];
18764 :
18765 0 : pull = ndr_pull_init_blob(blob, object);
18766 0 : if (pull == NULL) {
18767 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
18768 0 : return NULL;
18769 : }
18770 :
18771 0 : pull->flags |= ndr_pull_flags;
18772 :
18773 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
18774 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
18775 0 : TALLOC_FREE(pull);
18776 0 : PyErr_SetNdrError(err);
18777 0 : return NULL;
18778 : }
18779 0 : if (!allow_remaining) {
18780 : uint32_t highest_ofs;
18781 :
18782 0 : if (pull->offset > pull->relative_highest_offset) {
18783 0 : highest_ofs = pull->offset;
18784 : } else {
18785 0 : highest_ofs = pull->relative_highest_offset;
18786 : }
18787 0 : if (highest_ofs < pull->data_size) {
18788 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
18789 : "not all bytes consumed ofs[%u] size[%u]",
18790 : highest_ofs, pull->data_size);
18791 0 : TALLOC_FREE(pull);
18792 0 : PyErr_SetNdrError(err);
18793 0 : return NULL;
18794 : }
18795 : }
18796 :
18797 0 : TALLOC_FREE(pull);
18798 0 : Py_RETURN_NONE;
18799 : }
18800 :
18801 0 : static PyObject *py_winreg_OpenHKDD_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18802 : {
18803 : DATA_BLOB blob;
18804 0 : Py_ssize_t blob_length = 0;
18805 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18806 0 : PyObject *bigendian_obj = NULL;
18807 0 : PyObject *ndr64_obj = NULL;
18808 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18809 0 : PyObject *allow_remaining_obj = NULL;
18810 0 : bool allow_remaining = false;
18811 :
18812 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
18813 : discard_const_p(char *, kwnames),
18814 : &blob.data, &blob_length,
18815 : &bigendian_obj,
18816 : &ndr64_obj,
18817 : &allow_remaining_obj)) {
18818 0 : return NULL;
18819 : }
18820 0 : blob.length = blob_length;
18821 :
18822 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18823 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18824 : }
18825 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18826 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18827 : }
18828 :
18829 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18830 0 : allow_remaining = true;
18831 : }
18832 :
18833 0 : return py_winreg_OpenHKDD_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
18834 : }
18835 :
18836 0 : static PyObject *py_winreg_OpenHKDD_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
18837 : {
18838 : DATA_BLOB blob;
18839 0 : Py_ssize_t blob_length = 0;
18840 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
18841 0 : PyObject *bigendian_obj = NULL;
18842 0 : PyObject *ndr64_obj = NULL;
18843 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
18844 0 : PyObject *allow_remaining_obj = NULL;
18845 0 : bool allow_remaining = false;
18846 :
18847 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
18848 : discard_const_p(char *, kwnames),
18849 : &blob.data, &blob_length,
18850 : &bigendian_obj,
18851 : &ndr64_obj,
18852 : &allow_remaining_obj)) {
18853 0 : return NULL;
18854 : }
18855 0 : blob.length = blob_length;
18856 :
18857 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
18858 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
18859 : }
18860 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
18861 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
18862 : }
18863 :
18864 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
18865 0 : allow_remaining = true;
18866 : }
18867 :
18868 0 : return py_winreg_OpenHKDD_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
18869 : }
18870 :
18871 0 : static PyObject *py_winreg_OpenHKDD_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
18872 : {
18873 0 : const struct ndr_interface_call *call = NULL;
18874 0 : struct winreg_OpenHKDD *object = (struct winreg_OpenHKDD *)pytalloc_get_ptr(py_obj);
18875 : PyObject *ret;
18876 : char *retstr;
18877 :
18878 0 : if (ndr_table_winreg.num_calls < 29) {
18879 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKDD_ndr_print");
18880 0 : return NULL;
18881 : }
18882 0 : call = &ndr_table_winreg.calls[28];
18883 :
18884 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
18885 0 : ret = PyUnicode_FromString(retstr);
18886 0 : TALLOC_FREE(retstr);
18887 :
18888 0 : return ret;
18889 : }
18890 :
18891 0 : static PyObject *py_winreg_OpenHKDD_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18892 : {
18893 0 : return py_winreg_OpenHKDD_ndr_print(py_obj, "winreg_OpenHKDD_in", NDR_IN);
18894 : }
18895 :
18896 0 : static PyObject *py_winreg_OpenHKDD_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
18897 : {
18898 0 : return py_winreg_OpenHKDD_ndr_print(py_obj, "winreg_OpenHKDD_out", NDR_OUT);
18899 : }
18900 :
18901 : static PyMethodDef py_winreg_OpenHKDD_methods[] = {
18902 : { "opnum", (PyCFunction)py_winreg_OpenHKDD_ndr_opnum, METH_NOARGS|METH_CLASS,
18903 : "winreg.OpenHKDD.opnum() -> 28 (0x1c) " },
18904 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
18905 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
18906 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
18907 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
18908 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
18909 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
18910 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKDD_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
18911 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
18912 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKDD_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
18913 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKDD_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
18914 : { NULL, NULL, 0, NULL }
18915 : };
18916 :
18917 :
18918 : static PyTypeObject winreg_OpenHKDD_Type = {
18919 : PyVarObject_HEAD_INIT(NULL, 0)
18920 : .tp_name = "winreg.OpenHKDD",
18921 : .tp_getset = py_winreg_OpenHKDD_getsetters,
18922 : .tp_methods = py_winreg_OpenHKDD_methods,
18923 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
18924 : .tp_new = py_winreg_OpenHKDD_new,
18925 : };
18926 :
18927 0 : static bool pack_py_winreg_OpenHKDD_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKDD *r)
18928 : {
18929 : PyObject *py_system_name;
18930 : PyObject *py_access_mask;
18931 0 : const char *kwnames[] = {
18932 : "system_name", "access_mask", NULL
18933 : };
18934 :
18935 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKDD", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
18936 0 : return false;
18937 : }
18938 :
18939 0 : if (py_system_name == NULL) {
18940 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
18941 0 : return false;
18942 : }
18943 0 : if (py_system_name == Py_None) {
18944 0 : r->in.system_name = NULL;
18945 : } else {
18946 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
18947 0 : if (r->in.system_name == NULL) {
18948 0 : PyErr_NoMemory();
18949 0 : return false;
18950 : }
18951 : {
18952 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
18953 0 : if (PyLong_Check(py_system_name)) {
18954 : unsigned long long test_var;
18955 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
18956 0 : if (PyErr_Occurred() != NULL) {
18957 0 : return false;
18958 : }
18959 0 : if (test_var > uint_max) {
18960 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18961 : PyLong_Type.tp_name, uint_max, test_var);
18962 0 : return false;
18963 : }
18964 0 : *r->in.system_name = test_var;
18965 : } else {
18966 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18967 : PyLong_Type.tp_name);
18968 0 : return false;
18969 : }
18970 : }
18971 : }
18972 0 : if (py_access_mask == NULL) {
18973 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
18974 0 : return false;
18975 : }
18976 : {
18977 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
18978 0 : if (PyLong_Check(py_access_mask)) {
18979 : unsigned long long test_var;
18980 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
18981 0 : if (PyErr_Occurred() != NULL) {
18982 0 : return false;
18983 : }
18984 0 : if (test_var > uint_max) {
18985 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
18986 : PyLong_Type.tp_name, uint_max, test_var);
18987 0 : return false;
18988 : }
18989 0 : r->in.access_mask = test_var;
18990 : } else {
18991 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
18992 : PyLong_Type.tp_name);
18993 0 : return false;
18994 : }
18995 : }
18996 0 : return true;
18997 : }
18998 :
18999 0 : static PyObject *unpack_py_winreg_OpenHKDD_args_out(struct winreg_OpenHKDD *r)
19000 : {
19001 : PyObject *result;
19002 : PyObject *py_handle;
19003 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
19004 0 : result = py_handle;
19005 0 : if (!W_ERROR_IS_OK(r->out.result)) {
19006 0 : PyErr_SetWERROR(r->out.result);
19007 0 : return NULL;
19008 : }
19009 :
19010 0 : return result;
19011 : }
19012 :
19013 :
19014 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_key_handle(PyObject *obj, void *closure)
19015 : {
19016 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19017 : PyObject *py_key_handle;
19018 0 : if (object->in.key_handle == NULL) {
19019 0 : Py_RETURN_NONE;
19020 : }
19021 0 : py_key_handle = pytalloc_reference_ex(policy_handle_Type, object->in.key_handle, object->in.key_handle);
19022 0 : return py_key_handle;
19023 : }
19024 :
19025 0 : static int py_winreg_QueryMultipleValues_in_set_key_handle(PyObject *py_obj, PyObject *value, void *closure)
19026 : {
19027 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19028 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.key_handle));
19029 0 : if (value == NULL) {
19030 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.key_handle");
19031 0 : return -1;
19032 : }
19033 0 : object->in.key_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.key_handle);
19034 0 : if (object->in.key_handle == NULL) {
19035 0 : PyErr_NoMemory();
19036 0 : return -1;
19037 : }
19038 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
19039 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
19040 0 : PyErr_NoMemory();
19041 0 : return -1;
19042 : }
19043 0 : object->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(value);
19044 0 : return 0;
19045 : }
19046 :
19047 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_values_in(PyObject *obj, void *closure)
19048 : {
19049 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19050 : PyObject *py_values_in;
19051 0 : if (object->in.values_in == NULL) {
19052 0 : Py_RETURN_NONE;
19053 : }
19054 0 : py_values_in = PyList_New(object->in.num_values);
19055 0 : if (py_values_in == NULL) {
19056 0 : return NULL;
19057 : }
19058 : {
19059 : int values_in_cntr_1;
19060 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < (object->in.num_values); values_in_cntr_1++) {
19061 : PyObject *py_values_in_1;
19062 0 : py_values_in_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->in.values_in, &object->in.values_in[values_in_cntr_1]);
19063 0 : PyList_SetItem(py_values_in, values_in_cntr_1, py_values_in_1);
19064 : }
19065 : }
19066 0 : return py_values_in;
19067 : }
19068 :
19069 0 : static int py_winreg_QueryMultipleValues_in_set_values_in(PyObject *py_obj, PyObject *value, void *closure)
19070 : {
19071 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19072 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.values_in));
19073 0 : if (value == NULL) {
19074 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.values_in");
19075 0 : return -1;
19076 : }
19077 0 : object->in.values_in = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in);
19078 0 : if (object->in.values_in == NULL) {
19079 0 : PyErr_NoMemory();
19080 0 : return -1;
19081 : }
19082 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19083 : {
19084 : int values_in_cntr_1;
19085 0 : object->in.values_in = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in, PyList_GET_SIZE(value));
19086 0 : if (!object->in.values_in) { return -1;; }
19087 0 : talloc_set_name_const(object->in.values_in, "ARRAY: object->in.values_in");
19088 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(value); values_in_cntr_1++) {
19089 0 : if (PyList_GET_ITEM(value, values_in_cntr_1) == NULL) {
19090 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.values_in[values_in_cntr_1]");
19091 0 : return -1;
19092 : }
19093 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_in_cntr_1), return -1;);
19094 0 : if (talloc_reference(object->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_in_cntr_1))) == NULL) {
19095 0 : PyErr_NoMemory();
19096 0 : return -1;
19097 : }
19098 0 : object->in.values_in[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_in_cntr_1));
19099 : }
19100 : }
19101 0 : return 0;
19102 : }
19103 :
19104 0 : static PyObject *py_winreg_QueryMultipleValues_out_get_values_out(PyObject *obj, void *closure)
19105 : {
19106 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19107 : PyObject *py_values_out;
19108 0 : if (object->out.values_out == NULL) {
19109 0 : Py_RETURN_NONE;
19110 : }
19111 0 : py_values_out = PyList_New(object->in.num_values);
19112 0 : if (py_values_out == NULL) {
19113 0 : return NULL;
19114 : }
19115 : {
19116 : int values_out_cntr_1;
19117 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (object->in.num_values); values_out_cntr_1++) {
19118 : PyObject *py_values_out_1;
19119 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->out.values_out, &object->out.values_out[values_out_cntr_1]);
19120 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
19121 : }
19122 : }
19123 0 : return py_values_out;
19124 : }
19125 :
19126 0 : static int py_winreg_QueryMultipleValues_out_set_values_out(PyObject *py_obj, PyObject *value, void *closure)
19127 : {
19128 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19129 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.values_out));
19130 0 : if (value == NULL) {
19131 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.values_out");
19132 0 : return -1;
19133 : }
19134 0 : object->out.values_out = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out);
19135 0 : if (object->out.values_out == NULL) {
19136 0 : PyErr_NoMemory();
19137 0 : return -1;
19138 : }
19139 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19140 : {
19141 : int values_out_cntr_1;
19142 0 : object->out.values_out = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out, PyList_GET_SIZE(value));
19143 0 : if (!object->out.values_out) { return -1;; }
19144 0 : talloc_set_name_const(object->out.values_out, "ARRAY: object->out.values_out");
19145 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < PyList_GET_SIZE(value); values_out_cntr_1++) {
19146 0 : if (PyList_GET_ITEM(value, values_out_cntr_1) == NULL) {
19147 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.values_out[values_out_cntr_1]");
19148 0 : return -1;
19149 : }
19150 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_out_cntr_1), return -1;);
19151 0 : if (talloc_reference(object->out.values_out, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_out_cntr_1))) == NULL) {
19152 0 : PyErr_NoMemory();
19153 0 : return -1;
19154 : }
19155 0 : object->out.values_out[values_out_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_out_cntr_1));
19156 : }
19157 : }
19158 0 : return 0;
19159 : }
19160 :
19161 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_num_values(PyObject *obj, void *closure)
19162 : {
19163 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19164 : PyObject *py_num_values;
19165 0 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)object->in.num_values);
19166 0 : return py_num_values;
19167 : }
19168 :
19169 0 : static int py_winreg_QueryMultipleValues_in_set_num_values(PyObject *py_obj, PyObject *value, void *closure)
19170 : {
19171 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19172 0 : if (value == NULL) {
19173 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.num_values");
19174 0 : return -1;
19175 : }
19176 : {
19177 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.num_values));
19178 0 : if (PyLong_Check(value)) {
19179 : unsigned long long test_var;
19180 0 : test_var = PyLong_AsUnsignedLongLong(value);
19181 0 : if (PyErr_Occurred() != NULL) {
19182 0 : return -1;
19183 : }
19184 0 : if (test_var > uint_max) {
19185 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19186 : PyLong_Type.tp_name, uint_max, test_var);
19187 0 : return -1;
19188 : }
19189 0 : object->in.num_values = test_var;
19190 : } else {
19191 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19192 : PyLong_Type.tp_name);
19193 0 : return -1;
19194 : }
19195 : }
19196 0 : return 0;
19197 : }
19198 :
19199 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_buffer(PyObject *obj, void *closure)
19200 : {
19201 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19202 : PyObject *py_buffer;
19203 0 : if (object->in.buffer == NULL) {
19204 0 : Py_RETURN_NONE;
19205 : }
19206 0 : if (object->in.buffer == NULL) {
19207 0 : py_buffer = Py_None;
19208 0 : Py_INCREF(py_buffer);
19209 : } else {
19210 0 : py_buffer = PyList_New(*object->in.buffer_size);
19211 0 : if (py_buffer == NULL) {
19212 0 : return NULL;
19213 : }
19214 : {
19215 : int buffer_cntr_1;
19216 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->in.buffer_size); buffer_cntr_1++) {
19217 : PyObject *py_buffer_1;
19218 0 : py_buffer_1 = PyLong_FromLong((uint16_t)object->in.buffer[buffer_cntr_1]);
19219 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
19220 : }
19221 : }
19222 : }
19223 0 : return py_buffer;
19224 : }
19225 :
19226 0 : static int py_winreg_QueryMultipleValues_in_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
19227 : {
19228 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19229 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer));
19230 0 : if (value == NULL) {
19231 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer");
19232 0 : return -1;
19233 : }
19234 0 : if (value == Py_None) {
19235 0 : object->in.buffer = NULL;
19236 : } else {
19237 0 : object->in.buffer = NULL;
19238 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19239 : {
19240 : int buffer_cntr_1;
19241 0 : object->in.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer, PyList_GET_SIZE(value));
19242 0 : if (!object->in.buffer) { return -1;; }
19243 0 : talloc_set_name_const(object->in.buffer, "ARRAY: object->in.buffer");
19244 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
19245 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
19246 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer[buffer_cntr_1]");
19247 0 : return -1;
19248 : }
19249 : {
19250 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.buffer[buffer_cntr_1]));
19251 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
19252 : unsigned long long test_var;
19253 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
19254 0 : if (PyErr_Occurred() != NULL) {
19255 0 : return -1;
19256 : }
19257 0 : if (test_var > uint_max) {
19258 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19259 : PyLong_Type.tp_name, uint_max, test_var);
19260 0 : return -1;
19261 : }
19262 0 : object->in.buffer[buffer_cntr_1] = test_var;
19263 : } else {
19264 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19265 : PyLong_Type.tp_name);
19266 0 : return -1;
19267 : }
19268 : }
19269 : }
19270 : }
19271 : }
19272 0 : return 0;
19273 : }
19274 :
19275 0 : static PyObject *py_winreg_QueryMultipleValues_out_get_buffer(PyObject *obj, void *closure)
19276 : {
19277 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19278 : PyObject *py_buffer;
19279 0 : if (object->out.buffer == NULL) {
19280 0 : Py_RETURN_NONE;
19281 : }
19282 0 : if (object->out.buffer == NULL) {
19283 0 : py_buffer = Py_None;
19284 0 : Py_INCREF(py_buffer);
19285 : } else {
19286 0 : py_buffer = PyList_New(*object->out.buffer_size);
19287 0 : if (py_buffer == NULL) {
19288 0 : return NULL;
19289 : }
19290 : {
19291 : int buffer_cntr_1;
19292 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->out.buffer_size); buffer_cntr_1++) {
19293 : PyObject *py_buffer_1;
19294 0 : py_buffer_1 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_1]);
19295 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
19296 : }
19297 : }
19298 : }
19299 0 : return py_buffer;
19300 : }
19301 :
19302 0 : static int py_winreg_QueryMultipleValues_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
19303 : {
19304 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19305 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer));
19306 0 : if (value == NULL) {
19307 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer");
19308 0 : return -1;
19309 : }
19310 0 : if (value == Py_None) {
19311 0 : object->out.buffer = NULL;
19312 : } else {
19313 0 : object->out.buffer = NULL;
19314 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
19315 : {
19316 : int buffer_cntr_1;
19317 0 : object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value));
19318 0 : if (!object->out.buffer) { return -1;; }
19319 0 : talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer");
19320 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
19321 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
19322 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_1]");
19323 0 : return -1;
19324 : }
19325 : {
19326 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_1]));
19327 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
19328 : unsigned long long test_var;
19329 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
19330 0 : if (PyErr_Occurred() != NULL) {
19331 0 : return -1;
19332 : }
19333 0 : if (test_var > uint_max) {
19334 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19335 : PyLong_Type.tp_name, uint_max, test_var);
19336 0 : return -1;
19337 : }
19338 0 : object->out.buffer[buffer_cntr_1] = test_var;
19339 : } else {
19340 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19341 : PyLong_Type.tp_name);
19342 0 : return -1;
19343 : }
19344 : }
19345 : }
19346 : }
19347 : }
19348 0 : return 0;
19349 : }
19350 :
19351 0 : static PyObject *py_winreg_QueryMultipleValues_in_get_buffer_size(PyObject *obj, void *closure)
19352 : {
19353 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19354 : PyObject *py_buffer_size;
19355 0 : if (object->in.buffer_size == NULL) {
19356 0 : Py_RETURN_NONE;
19357 : }
19358 0 : py_buffer_size = PyLong_FromUnsignedLongLong((uint32_t)*object->in.buffer_size);
19359 0 : return py_buffer_size;
19360 : }
19361 :
19362 0 : static int py_winreg_QueryMultipleValues_in_set_buffer_size(PyObject *py_obj, PyObject *value, void *closure)
19363 : {
19364 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19365 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer_size));
19366 0 : if (value == NULL) {
19367 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer_size");
19368 0 : return -1;
19369 : }
19370 0 : object->in.buffer_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer_size);
19371 0 : if (object->in.buffer_size == NULL) {
19372 0 : PyErr_NoMemory();
19373 0 : return -1;
19374 : }
19375 : {
19376 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.buffer_size));
19377 0 : if (PyLong_Check(value)) {
19378 : unsigned long long test_var;
19379 0 : test_var = PyLong_AsUnsignedLongLong(value);
19380 0 : if (PyErr_Occurred() != NULL) {
19381 0 : return -1;
19382 : }
19383 0 : if (test_var > uint_max) {
19384 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19385 : PyLong_Type.tp_name, uint_max, test_var);
19386 0 : return -1;
19387 : }
19388 0 : *object->in.buffer_size = test_var;
19389 : } else {
19390 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19391 : PyLong_Type.tp_name);
19392 0 : return -1;
19393 : }
19394 : }
19395 0 : return 0;
19396 : }
19397 :
19398 0 : static PyObject *py_winreg_QueryMultipleValues_out_get_buffer_size(PyObject *obj, void *closure)
19399 : {
19400 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19401 : PyObject *py_buffer_size;
19402 0 : if (object->out.buffer_size == NULL) {
19403 0 : Py_RETURN_NONE;
19404 : }
19405 0 : py_buffer_size = PyLong_FromUnsignedLongLong((uint32_t)*object->out.buffer_size);
19406 0 : return py_buffer_size;
19407 : }
19408 :
19409 0 : static int py_winreg_QueryMultipleValues_out_set_buffer_size(PyObject *py_obj, PyObject *value, void *closure)
19410 : {
19411 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19412 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer_size));
19413 0 : if (value == NULL) {
19414 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer_size");
19415 0 : return -1;
19416 : }
19417 0 : object->out.buffer_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer_size);
19418 0 : if (object->out.buffer_size == NULL) {
19419 0 : PyErr_NoMemory();
19420 0 : return -1;
19421 : }
19422 : {
19423 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.buffer_size));
19424 0 : if (PyLong_Check(value)) {
19425 : unsigned long long test_var;
19426 0 : test_var = PyLong_AsUnsignedLongLong(value);
19427 0 : if (PyErr_Occurred() != NULL) {
19428 0 : return -1;
19429 : }
19430 0 : if (test_var > uint_max) {
19431 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19432 : PyLong_Type.tp_name, uint_max, test_var);
19433 0 : return -1;
19434 : }
19435 0 : *object->out.buffer_size = test_var;
19436 : } else {
19437 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19438 : PyLong_Type.tp_name);
19439 0 : return -1;
19440 : }
19441 : }
19442 0 : return 0;
19443 : }
19444 :
19445 0 : static PyObject *py_winreg_QueryMultipleValues_get_result(PyObject *obj, void *closure)
19446 : {
19447 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(obj);
19448 : PyObject *py_result;
19449 0 : py_result = PyErr_FromWERROR(object->out.result);
19450 0 : return py_result;
19451 : }
19452 :
19453 0 : static int py_winreg_QueryMultipleValues_set_result(PyObject *py_obj, PyObject *value, void *closure)
19454 : {
19455 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19456 0 : if (value == NULL) {
19457 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
19458 0 : return -1;
19459 : }
19460 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
19461 0 : return 0;
19462 : }
19463 :
19464 : static PyGetSetDef py_winreg_QueryMultipleValues_getsetters[] = {
19465 : {
19466 : .name = discard_const_p(char, "in_key_handle"),
19467 : .get = py_winreg_QueryMultipleValues_in_get_key_handle,
19468 : .set = py_winreg_QueryMultipleValues_in_set_key_handle,
19469 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
19470 : },
19471 : {
19472 : .name = discard_const_p(char, "in_values_in"),
19473 : .get = py_winreg_QueryMultipleValues_in_get_values_in,
19474 : .set = py_winreg_QueryMultipleValues_in_set_values_in,
19475 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
19476 : },
19477 : {
19478 : .name = discard_const_p(char, "out_values_out"),
19479 : .get = py_winreg_QueryMultipleValues_out_get_values_out,
19480 : .set = py_winreg_QueryMultipleValues_out_set_values_out,
19481 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
19482 : },
19483 : {
19484 : .name = discard_const_p(char, "in_num_values"),
19485 : .get = py_winreg_QueryMultipleValues_in_get_num_values,
19486 : .set = py_winreg_QueryMultipleValues_in_set_num_values,
19487 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
19488 : },
19489 : {
19490 : .name = discard_const_p(char, "in_buffer"),
19491 : .get = py_winreg_QueryMultipleValues_in_get_buffer,
19492 : .set = py_winreg_QueryMultipleValues_in_set_buffer,
19493 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
19494 : },
19495 : {
19496 : .name = discard_const_p(char, "out_buffer"),
19497 : .get = py_winreg_QueryMultipleValues_out_get_buffer,
19498 : .set = py_winreg_QueryMultipleValues_out_set_buffer,
19499 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
19500 : },
19501 : {
19502 : .name = discard_const_p(char, "in_buffer_size"),
19503 : .get = py_winreg_QueryMultipleValues_in_get_buffer_size,
19504 : .set = py_winreg_QueryMultipleValues_in_set_buffer_size,
19505 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
19506 : },
19507 : {
19508 : .name = discard_const_p(char, "out_buffer_size"),
19509 : .get = py_winreg_QueryMultipleValues_out_get_buffer_size,
19510 : .set = py_winreg_QueryMultipleValues_out_set_buffer_size,
19511 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
19512 : },
19513 : {
19514 : .name = discard_const_p(char, "result"),
19515 : .get = py_winreg_QueryMultipleValues_get_result,
19516 : .set = py_winreg_QueryMultipleValues_set_result,
19517 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
19518 : },
19519 : { .name = NULL }
19520 : };
19521 :
19522 0 : static PyObject *py_winreg_QueryMultipleValues_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
19523 : {
19524 0 : PyObject *self = pytalloc_new(struct winreg_QueryMultipleValues, type);
19525 0 : struct winreg_QueryMultipleValues *_self = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(self);
19526 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
19527 0 : _self->in.key_handle = talloc_zero(mem_ctx, struct policy_handle);
19528 0 : _self->in.values_in = talloc_zero(mem_ctx, struct QueryMultipleValue);
19529 0 : _self->out.values_out = talloc_zero(mem_ctx, struct QueryMultipleValue);
19530 0 : _self->in.buffer_size = talloc_zero(mem_ctx, uint32_t);
19531 0 : _self->out.buffer_size = talloc_zero(mem_ctx, uint32_t);
19532 0 : return self;
19533 : }
19534 :
19535 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
19536 : {
19537 :
19538 :
19539 0 : return PyLong_FromLong(29);
19540 : }
19541 :
19542 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
19543 : {
19544 0 : const struct ndr_interface_call *call = NULL;
19545 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19546 0 : PyObject *ret = NULL;
19547 0 : struct ndr_push *push = NULL;
19548 : DATA_BLOB blob;
19549 : enum ndr_err_code err;
19550 :
19551 0 : if (ndr_table_winreg.num_calls < 30) {
19552 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues_ndr_pack");
19553 0 : return NULL;
19554 : }
19555 0 : call = &ndr_table_winreg.calls[29];
19556 :
19557 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
19558 0 : if (push == NULL) {
19559 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
19560 0 : return NULL;
19561 : }
19562 :
19563 0 : push->flags |= ndr_push_flags;
19564 :
19565 0 : err = call->ndr_push(push, ndr_inout_flags, object);
19566 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
19567 0 : TALLOC_FREE(push);
19568 0 : PyErr_SetNdrError(err);
19569 0 : return NULL;
19570 : }
19571 0 : blob = ndr_push_blob(push);
19572 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
19573 0 : TALLOC_FREE(push);
19574 0 : return ret;
19575 : }
19576 :
19577 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19578 : {
19579 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
19580 0 : PyObject *bigendian_obj = NULL;
19581 0 : PyObject *ndr64_obj = NULL;
19582 0 : uint32_t ndr_push_flags = 0;
19583 :
19584 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
19585 : discard_const_p(char *, kwnames),
19586 : &bigendian_obj,
19587 : &ndr64_obj)) {
19588 0 : return NULL;
19589 : }
19590 :
19591 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19592 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
19593 : }
19594 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19595 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
19596 : }
19597 :
19598 0 : return py_winreg_QueryMultipleValues_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
19599 : }
19600 :
19601 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19602 : {
19603 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
19604 0 : PyObject *bigendian_obj = NULL;
19605 0 : PyObject *ndr64_obj = NULL;
19606 0 : uint32_t ndr_push_flags = 0;
19607 :
19608 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
19609 : discard_const_p(char *, kwnames),
19610 : &bigendian_obj,
19611 : &ndr64_obj)) {
19612 0 : return NULL;
19613 : }
19614 :
19615 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19616 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
19617 : }
19618 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19619 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
19620 : }
19621 :
19622 0 : return py_winreg_QueryMultipleValues_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
19623 : }
19624 :
19625 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
19626 : {
19627 0 : const struct ndr_interface_call *call = NULL;
19628 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19629 0 : struct ndr_pull *pull = NULL;
19630 : enum ndr_err_code err;
19631 :
19632 0 : if (ndr_table_winreg.num_calls < 30) {
19633 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues_ndr_unpack");
19634 0 : return NULL;
19635 : }
19636 0 : call = &ndr_table_winreg.calls[29];
19637 :
19638 0 : pull = ndr_pull_init_blob(blob, object);
19639 0 : if (pull == NULL) {
19640 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
19641 0 : return NULL;
19642 : }
19643 :
19644 0 : pull->flags |= ndr_pull_flags;
19645 :
19646 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
19647 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
19648 0 : TALLOC_FREE(pull);
19649 0 : PyErr_SetNdrError(err);
19650 0 : return NULL;
19651 : }
19652 0 : if (!allow_remaining) {
19653 : uint32_t highest_ofs;
19654 :
19655 0 : if (pull->offset > pull->relative_highest_offset) {
19656 0 : highest_ofs = pull->offset;
19657 : } else {
19658 0 : highest_ofs = pull->relative_highest_offset;
19659 : }
19660 0 : if (highest_ofs < pull->data_size) {
19661 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
19662 : "not all bytes consumed ofs[%u] size[%u]",
19663 : highest_ofs, pull->data_size);
19664 0 : TALLOC_FREE(pull);
19665 0 : PyErr_SetNdrError(err);
19666 0 : return NULL;
19667 : }
19668 : }
19669 :
19670 0 : TALLOC_FREE(pull);
19671 0 : Py_RETURN_NONE;
19672 : }
19673 :
19674 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19675 : {
19676 : DATA_BLOB blob;
19677 0 : Py_ssize_t blob_length = 0;
19678 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
19679 0 : PyObject *bigendian_obj = NULL;
19680 0 : PyObject *ndr64_obj = NULL;
19681 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
19682 0 : PyObject *allow_remaining_obj = NULL;
19683 0 : bool allow_remaining = false;
19684 :
19685 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
19686 : discard_const_p(char *, kwnames),
19687 : &blob.data, &blob_length,
19688 : &bigendian_obj,
19689 : &ndr64_obj,
19690 : &allow_remaining_obj)) {
19691 0 : return NULL;
19692 : }
19693 0 : blob.length = blob_length;
19694 :
19695 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19696 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
19697 : }
19698 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19699 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
19700 : }
19701 :
19702 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
19703 0 : allow_remaining = true;
19704 : }
19705 :
19706 0 : return py_winreg_QueryMultipleValues_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
19707 : }
19708 :
19709 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
19710 : {
19711 : DATA_BLOB blob;
19712 0 : Py_ssize_t blob_length = 0;
19713 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
19714 0 : PyObject *bigendian_obj = NULL;
19715 0 : PyObject *ndr64_obj = NULL;
19716 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
19717 0 : PyObject *allow_remaining_obj = NULL;
19718 0 : bool allow_remaining = false;
19719 :
19720 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
19721 : discard_const_p(char *, kwnames),
19722 : &blob.data, &blob_length,
19723 : &bigendian_obj,
19724 : &ndr64_obj,
19725 : &allow_remaining_obj)) {
19726 0 : return NULL;
19727 : }
19728 0 : blob.length = blob_length;
19729 :
19730 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
19731 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
19732 : }
19733 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
19734 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
19735 : }
19736 :
19737 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
19738 0 : allow_remaining = true;
19739 : }
19740 :
19741 0 : return py_winreg_QueryMultipleValues_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
19742 : }
19743 :
19744 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
19745 : {
19746 0 : const struct ndr_interface_call *call = NULL;
19747 0 : struct winreg_QueryMultipleValues *object = (struct winreg_QueryMultipleValues *)pytalloc_get_ptr(py_obj);
19748 : PyObject *ret;
19749 : char *retstr;
19750 :
19751 0 : if (ndr_table_winreg.num_calls < 30) {
19752 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues_ndr_print");
19753 0 : return NULL;
19754 : }
19755 0 : call = &ndr_table_winreg.calls[29];
19756 :
19757 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
19758 0 : ret = PyUnicode_FromString(retstr);
19759 0 : TALLOC_FREE(retstr);
19760 :
19761 0 : return ret;
19762 : }
19763 :
19764 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
19765 : {
19766 0 : return py_winreg_QueryMultipleValues_ndr_print(py_obj, "winreg_QueryMultipleValues_in", NDR_IN);
19767 : }
19768 :
19769 0 : static PyObject *py_winreg_QueryMultipleValues_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
19770 : {
19771 0 : return py_winreg_QueryMultipleValues_ndr_print(py_obj, "winreg_QueryMultipleValues_out", NDR_OUT);
19772 : }
19773 :
19774 : static PyMethodDef py_winreg_QueryMultipleValues_methods[] = {
19775 : { "opnum", (PyCFunction)py_winreg_QueryMultipleValues_ndr_opnum, METH_NOARGS|METH_CLASS,
19776 : "winreg.QueryMultipleValues.opnum() -> 29 (0x1d) " },
19777 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
19778 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
19779 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
19780 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
19781 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
19782 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
19783 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
19784 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
19785 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryMultipleValues_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
19786 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryMultipleValues_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
19787 : { NULL, NULL, 0, NULL }
19788 : };
19789 :
19790 :
19791 : static PyTypeObject winreg_QueryMultipleValues_Type = {
19792 : PyVarObject_HEAD_INIT(NULL, 0)
19793 : .tp_name = "winreg.QueryMultipleValues",
19794 : .tp_getset = py_winreg_QueryMultipleValues_getsetters,
19795 : .tp_methods = py_winreg_QueryMultipleValues_methods,
19796 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
19797 : .tp_new = py_winreg_QueryMultipleValues_new,
19798 : };
19799 :
19800 0 : static bool pack_py_winreg_QueryMultipleValues_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryMultipleValues *r)
19801 : {
19802 : PyObject *py_key_handle;
19803 : PyObject *py_values_in;
19804 : PyObject *py_buffer;
19805 0 : const char *kwnames[] = {
19806 : "key_handle", "values_in", "buffer", NULL
19807 : };
19808 :
19809 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_QueryMultipleValues", discard_const_p(char *, kwnames), &py_key_handle, &py_values_in, &py_buffer)) {
19810 0 : return false;
19811 : }
19812 :
19813 0 : if (py_key_handle == NULL) {
19814 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.key_handle");
19815 0 : return false;
19816 : }
19817 0 : r->in.key_handle = talloc_ptrtype(r, r->in.key_handle);
19818 0 : if (r->in.key_handle == NULL) {
19819 0 : PyErr_NoMemory();
19820 0 : return false;
19821 : }
19822 0 : PY_CHECK_TYPE(policy_handle_Type, py_key_handle, return false;);
19823 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key_handle)) == NULL) {
19824 0 : PyErr_NoMemory();
19825 0 : return false;
19826 : }
19827 0 : r->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(py_key_handle);
19828 0 : if (py_values_in == NULL) {
19829 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.values_in");
19830 0 : return false;
19831 : }
19832 0 : r->in.values_in = talloc_ptrtype(r, r->in.values_in);
19833 0 : if (r->in.values_in == NULL) {
19834 0 : PyErr_NoMemory();
19835 0 : return false;
19836 : }
19837 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
19838 : {
19839 : int values_in_cntr_1;
19840 0 : r->in.values_in = talloc_array_ptrtype(r, r->in.values_in, PyList_GET_SIZE(py_values_in));
19841 0 : if (!r->in.values_in) { return false;; }
19842 0 : talloc_set_name_const(r->in.values_in, "ARRAY: r->in.values_in");
19843 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(py_values_in); values_in_cntr_1++) {
19844 0 : if (PyList_GET_ITEM(py_values_in, values_in_cntr_1) == NULL) {
19845 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.values_in[values_in_cntr_1]");
19846 0 : return false;
19847 : }
19848 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(py_values_in, values_in_cntr_1), return false;);
19849 0 : if (talloc_reference(r->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(py_values_in, values_in_cntr_1))) == NULL) {
19850 0 : PyErr_NoMemory();
19851 0 : return false;
19852 : }
19853 0 : r->in.values_in[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(py_values_in, values_in_cntr_1));
19854 : }
19855 : }
19856 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
19857 0 : r->in.num_values = PyList_GET_SIZE(py_values_in);
19858 0 : if (py_buffer == NULL) {
19859 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.buffer");
19860 0 : return false;
19861 : }
19862 0 : if (py_buffer == Py_None) {
19863 0 : r->in.buffer = NULL;
19864 : } else {
19865 0 : r->in.buffer = NULL;
19866 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
19867 : {
19868 : int buffer_cntr_1;
19869 0 : r->in.buffer = talloc_array_ptrtype(r, r->in.buffer, PyList_GET_SIZE(py_buffer));
19870 0 : if (!r->in.buffer) { return false;; }
19871 0 : talloc_set_name_const(r->in.buffer, "ARRAY: r->in.buffer");
19872 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(py_buffer); buffer_cntr_1++) {
19873 0 : if (PyList_GET_ITEM(py_buffer, buffer_cntr_1) == NULL) {
19874 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.buffer[buffer_cntr_1]");
19875 0 : return false;
19876 : }
19877 : {
19878 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.buffer[buffer_cntr_1]));
19879 0 : if (PyLong_Check(PyList_GET_ITEM(py_buffer, buffer_cntr_1))) {
19880 : unsigned long long test_var;
19881 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_buffer, buffer_cntr_1));
19882 0 : if (PyErr_Occurred() != NULL) {
19883 0 : return false;
19884 : }
19885 0 : if (test_var > uint_max) {
19886 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19887 : PyLong_Type.tp_name, uint_max, test_var);
19888 0 : return false;
19889 : }
19890 0 : r->in.buffer[buffer_cntr_1] = test_var;
19891 : } else {
19892 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
19893 : PyLong_Type.tp_name);
19894 0 : return false;
19895 : }
19896 : }
19897 : }
19898 : }
19899 : }
19900 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
19901 0 : r->in.buffer_size = talloc_ptrtype(r, r->in.buffer_size);
19902 0 : if (r->in.buffer_size == NULL) {
19903 0 : PyErr_NoMemory();
19904 0 : return false;
19905 : }
19906 0 : *r->in.buffer_size = PyList_GET_SIZE(py_buffer);
19907 0 : return true;
19908 : }
19909 :
19910 0 : static PyObject *unpack_py_winreg_QueryMultipleValues_args_out(struct winreg_QueryMultipleValues *r)
19911 : {
19912 : PyObject *result;
19913 : PyObject *py_values_out;
19914 : PyObject *py_buffer;
19915 0 : result = PyTuple_New(2);
19916 0 : py_values_out = PyList_New(r->in.num_values);
19917 0 : if (py_values_out == NULL) {
19918 0 : return NULL;
19919 : }
19920 : {
19921 : int values_out_cntr_1;
19922 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (r->in.num_values); values_out_cntr_1++) {
19923 : PyObject *py_values_out_1;
19924 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, r->out.values_out, &r->out.values_out[values_out_cntr_1]);
19925 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
19926 : }
19927 : }
19928 0 : PyTuple_SetItem(result, 0, py_values_out);
19929 0 : if (r->out.buffer == NULL) {
19930 0 : py_buffer = Py_None;
19931 0 : Py_INCREF(py_buffer);
19932 : } else {
19933 0 : py_buffer = PyList_New(*r->out.buffer_size);
19934 0 : if (py_buffer == NULL) {
19935 0 : return NULL;
19936 : }
19937 : {
19938 : int buffer_cntr_1;
19939 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*r->out.buffer_size); buffer_cntr_1++) {
19940 : PyObject *py_buffer_1;
19941 0 : py_buffer_1 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_1]);
19942 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
19943 : }
19944 : }
19945 : }
19946 0 : PyTuple_SetItem(result, 1, py_buffer);
19947 0 : if (!W_ERROR_IS_OK(r->out.result)) {
19948 0 : PyErr_SetWERROR(r->out.result);
19949 0 : return NULL;
19950 : }
19951 :
19952 0 : return result;
19953 : }
19954 :
19955 :
19956 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_hostname(PyObject *obj, void *closure)
19957 : {
19958 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(obj);
19959 : PyObject *py_hostname;
19960 0 : if (object->in.hostname == NULL) {
19961 0 : Py_RETURN_NONE;
19962 : }
19963 0 : if (object->in.hostname == NULL) {
19964 0 : py_hostname = Py_None;
19965 0 : Py_INCREF(py_hostname);
19966 : } else {
19967 0 : py_hostname = PyLong_FromLong((uint16_t)*object->in.hostname);
19968 : }
19969 0 : return py_hostname;
19970 : }
19971 :
19972 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_hostname(PyObject *py_obj, PyObject *value, void *closure)
19973 : {
19974 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
19975 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.hostname));
19976 0 : if (value == NULL) {
19977 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hostname");
19978 0 : return -1;
19979 : }
19980 0 : if (value == Py_None) {
19981 0 : object->in.hostname = NULL;
19982 : } else {
19983 0 : object->in.hostname = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.hostname);
19984 0 : if (object->in.hostname == NULL) {
19985 0 : PyErr_NoMemory();
19986 0 : return -1;
19987 : }
19988 : {
19989 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.hostname));
19990 0 : if (PyLong_Check(value)) {
19991 : unsigned long long test_var;
19992 0 : test_var = PyLong_AsUnsignedLongLong(value);
19993 0 : if (PyErr_Occurred() != NULL) {
19994 0 : return -1;
19995 : }
19996 0 : if (test_var > uint_max) {
19997 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
19998 : PyLong_Type.tp_name, uint_max, test_var);
19999 0 : return -1;
20000 : }
20001 0 : *object->in.hostname = test_var;
20002 : } else {
20003 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20004 : PyLong_Type.tp_name);
20005 0 : return -1;
20006 : }
20007 : }
20008 : }
20009 0 : return 0;
20010 : }
20011 :
20012 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_message(PyObject *obj, void *closure)
20013 : {
20014 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(obj);
20015 : PyObject *py_message;
20016 0 : if (object->in.message == NULL) {
20017 0 : Py_RETURN_NONE;
20018 : }
20019 0 : if (object->in.message == NULL) {
20020 0 : py_message = Py_None;
20021 0 : Py_INCREF(py_message);
20022 : } else {
20023 0 : py_message = pytalloc_reference_ex(lsa_StringLarge_Type, object->in.message, object->in.message);
20024 : }
20025 0 : return py_message;
20026 : }
20027 :
20028 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_message(PyObject *py_obj, PyObject *value, void *closure)
20029 : {
20030 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20031 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.message));
20032 0 : if (value == NULL) {
20033 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.message");
20034 0 : return -1;
20035 : }
20036 0 : if (value == Py_None) {
20037 0 : object->in.message = NULL;
20038 : } else {
20039 0 : object->in.message = NULL;
20040 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, value, return -1;);
20041 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20042 0 : PyErr_NoMemory();
20043 0 : return -1;
20044 : }
20045 0 : object->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(value);
20046 : }
20047 0 : return 0;
20048 : }
20049 :
20050 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_timeout(PyObject *obj, void *closure)
20051 : {
20052 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(obj);
20053 : PyObject *py_timeout;
20054 0 : py_timeout = PyLong_FromUnsignedLongLong((uint32_t)object->in.timeout);
20055 0 : return py_timeout;
20056 : }
20057 :
20058 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_timeout(PyObject *py_obj, PyObject *value, void *closure)
20059 : {
20060 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20061 0 : if (value == NULL) {
20062 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.timeout");
20063 0 : return -1;
20064 : }
20065 : {
20066 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.timeout));
20067 0 : if (PyLong_Check(value)) {
20068 : unsigned long long test_var;
20069 0 : test_var = PyLong_AsUnsignedLongLong(value);
20070 0 : if (PyErr_Occurred() != NULL) {
20071 0 : return -1;
20072 : }
20073 0 : if (test_var > uint_max) {
20074 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20075 : PyLong_Type.tp_name, uint_max, test_var);
20076 0 : return -1;
20077 : }
20078 0 : object->in.timeout = test_var;
20079 : } else {
20080 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20081 : PyLong_Type.tp_name);
20082 0 : return -1;
20083 : }
20084 : }
20085 0 : return 0;
20086 : }
20087 :
20088 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_force_apps(PyObject *obj, void *closure)
20089 : {
20090 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(obj);
20091 : PyObject *py_force_apps;
20092 0 : py_force_apps = PyLong_FromLong((uint16_t)object->in.force_apps);
20093 0 : return py_force_apps;
20094 : }
20095 :
20096 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_force_apps(PyObject *py_obj, PyObject *value, void *closure)
20097 : {
20098 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20099 0 : if (value == NULL) {
20100 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.force_apps");
20101 0 : return -1;
20102 : }
20103 : {
20104 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.force_apps));
20105 0 : if (PyLong_Check(value)) {
20106 : unsigned long long test_var;
20107 0 : test_var = PyLong_AsUnsignedLongLong(value);
20108 0 : if (PyErr_Occurred() != NULL) {
20109 0 : return -1;
20110 : }
20111 0 : if (test_var > uint_max) {
20112 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20113 : PyLong_Type.tp_name, uint_max, test_var);
20114 0 : return -1;
20115 : }
20116 0 : object->in.force_apps = test_var;
20117 : } else {
20118 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20119 : PyLong_Type.tp_name);
20120 0 : return -1;
20121 : }
20122 : }
20123 0 : return 0;
20124 : }
20125 :
20126 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_do_reboot(PyObject *obj, void *closure)
20127 : {
20128 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(obj);
20129 : PyObject *py_do_reboot;
20130 0 : py_do_reboot = PyLong_FromLong((uint16_t)object->in.do_reboot);
20131 0 : return py_do_reboot;
20132 : }
20133 :
20134 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_do_reboot(PyObject *py_obj, PyObject *value, void *closure)
20135 : {
20136 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20137 0 : if (value == NULL) {
20138 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.do_reboot");
20139 0 : return -1;
20140 : }
20141 : {
20142 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.do_reboot));
20143 0 : if (PyLong_Check(value)) {
20144 : unsigned long long test_var;
20145 0 : test_var = PyLong_AsUnsignedLongLong(value);
20146 0 : if (PyErr_Occurred() != NULL) {
20147 0 : return -1;
20148 : }
20149 0 : if (test_var > uint_max) {
20150 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20151 : PyLong_Type.tp_name, uint_max, test_var);
20152 0 : return -1;
20153 : }
20154 0 : object->in.do_reboot = test_var;
20155 : } else {
20156 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20157 : PyLong_Type.tp_name);
20158 0 : return -1;
20159 : }
20160 : }
20161 0 : return 0;
20162 : }
20163 :
20164 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_in_get_reason(PyObject *obj, void *closure)
20165 : {
20166 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(obj);
20167 : PyObject *py_reason;
20168 0 : py_reason = PyLong_FromUnsignedLongLong((uint32_t)object->in.reason);
20169 0 : return py_reason;
20170 : }
20171 :
20172 0 : static int py_winreg_InitiateSystemShutdownEx_in_set_reason(PyObject *py_obj, PyObject *value, void *closure)
20173 : {
20174 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20175 0 : if (value == NULL) {
20176 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.reason");
20177 0 : return -1;
20178 : }
20179 : {
20180 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.reason));
20181 0 : if (PyLong_Check(value)) {
20182 : unsigned long long test_var;
20183 0 : test_var = PyLong_AsUnsignedLongLong(value);
20184 0 : if (PyErr_Occurred() != NULL) {
20185 0 : return -1;
20186 : }
20187 0 : if (test_var > uint_max) {
20188 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20189 : PyLong_Type.tp_name, uint_max, test_var);
20190 0 : return -1;
20191 : }
20192 0 : object->in.reason = test_var;
20193 : } else {
20194 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20195 : PyLong_Type.tp_name);
20196 0 : return -1;
20197 : }
20198 : }
20199 0 : return 0;
20200 : }
20201 :
20202 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_get_result(PyObject *obj, void *closure)
20203 : {
20204 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(obj);
20205 : PyObject *py_result;
20206 0 : py_result = PyErr_FromWERROR(object->out.result);
20207 0 : return py_result;
20208 : }
20209 :
20210 0 : static int py_winreg_InitiateSystemShutdownEx_set_result(PyObject *py_obj, PyObject *value, void *closure)
20211 : {
20212 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20213 0 : if (value == NULL) {
20214 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
20215 0 : return -1;
20216 : }
20217 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
20218 0 : return 0;
20219 : }
20220 :
20221 : static PyGetSetDef py_winreg_InitiateSystemShutdownEx_getsetters[] = {
20222 : {
20223 : .name = discard_const_p(char, "in_hostname"),
20224 : .get = py_winreg_InitiateSystemShutdownEx_in_get_hostname,
20225 : .set = py_winreg_InitiateSystemShutdownEx_in_set_hostname,
20226 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
20227 : },
20228 : {
20229 : .name = discard_const_p(char, "in_message"),
20230 : .get = py_winreg_InitiateSystemShutdownEx_in_get_message,
20231 : .set = py_winreg_InitiateSystemShutdownEx_in_set_message,
20232 : .doc = discard_const_p(char, "PIDL-generated element of base type lsa_StringLarge")
20233 : },
20234 : {
20235 : .name = discard_const_p(char, "in_timeout"),
20236 : .get = py_winreg_InitiateSystemShutdownEx_in_get_timeout,
20237 : .set = py_winreg_InitiateSystemShutdownEx_in_set_timeout,
20238 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
20239 : },
20240 : {
20241 : .name = discard_const_p(char, "in_force_apps"),
20242 : .get = py_winreg_InitiateSystemShutdownEx_in_get_force_apps,
20243 : .set = py_winreg_InitiateSystemShutdownEx_in_set_force_apps,
20244 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
20245 : },
20246 : {
20247 : .name = discard_const_p(char, "in_do_reboot"),
20248 : .get = py_winreg_InitiateSystemShutdownEx_in_get_do_reboot,
20249 : .set = py_winreg_InitiateSystemShutdownEx_in_set_do_reboot,
20250 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
20251 : },
20252 : {
20253 : .name = discard_const_p(char, "in_reason"),
20254 : .get = py_winreg_InitiateSystemShutdownEx_in_get_reason,
20255 : .set = py_winreg_InitiateSystemShutdownEx_in_set_reason,
20256 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
20257 : },
20258 : {
20259 : .name = discard_const_p(char, "result"),
20260 : .get = py_winreg_InitiateSystemShutdownEx_get_result,
20261 : .set = py_winreg_InitiateSystemShutdownEx_set_result,
20262 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
20263 : },
20264 : { .name = NULL }
20265 : };
20266 :
20267 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
20268 : {
20269 0 : PyObject *self = pytalloc_new(struct winreg_InitiateSystemShutdownEx, type);
20270 0 : return self;
20271 : }
20272 :
20273 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
20274 : {
20275 :
20276 :
20277 0 : return PyLong_FromLong(30);
20278 : }
20279 :
20280 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
20281 : {
20282 0 : const struct ndr_interface_call *call = NULL;
20283 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20284 0 : PyObject *ret = NULL;
20285 0 : struct ndr_push *push = NULL;
20286 : DATA_BLOB blob;
20287 : enum ndr_err_code err;
20288 :
20289 0 : if (ndr_table_winreg.num_calls < 31) {
20290 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdownEx_ndr_pack");
20291 0 : return NULL;
20292 : }
20293 0 : call = &ndr_table_winreg.calls[30];
20294 :
20295 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
20296 0 : if (push == NULL) {
20297 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
20298 0 : return NULL;
20299 : }
20300 :
20301 0 : push->flags |= ndr_push_flags;
20302 :
20303 0 : err = call->ndr_push(push, ndr_inout_flags, object);
20304 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
20305 0 : TALLOC_FREE(push);
20306 0 : PyErr_SetNdrError(err);
20307 0 : return NULL;
20308 : }
20309 0 : blob = ndr_push_blob(push);
20310 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
20311 0 : TALLOC_FREE(push);
20312 0 : return ret;
20313 : }
20314 :
20315 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20316 : {
20317 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20318 0 : PyObject *bigendian_obj = NULL;
20319 0 : PyObject *ndr64_obj = NULL;
20320 0 : uint32_t ndr_push_flags = 0;
20321 :
20322 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
20323 : discard_const_p(char *, kwnames),
20324 : &bigendian_obj,
20325 : &ndr64_obj)) {
20326 0 : return NULL;
20327 : }
20328 :
20329 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20330 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
20331 : }
20332 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20333 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
20334 : }
20335 :
20336 0 : return py_winreg_InitiateSystemShutdownEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
20337 : }
20338 :
20339 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20340 : {
20341 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20342 0 : PyObject *bigendian_obj = NULL;
20343 0 : PyObject *ndr64_obj = NULL;
20344 0 : uint32_t ndr_push_flags = 0;
20345 :
20346 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
20347 : discard_const_p(char *, kwnames),
20348 : &bigendian_obj,
20349 : &ndr64_obj)) {
20350 0 : return NULL;
20351 : }
20352 :
20353 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20354 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
20355 : }
20356 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20357 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
20358 : }
20359 :
20360 0 : return py_winreg_InitiateSystemShutdownEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
20361 : }
20362 :
20363 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
20364 : {
20365 0 : const struct ndr_interface_call *call = NULL;
20366 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20367 0 : struct ndr_pull *pull = NULL;
20368 : enum ndr_err_code err;
20369 :
20370 0 : if (ndr_table_winreg.num_calls < 31) {
20371 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdownEx_ndr_unpack");
20372 0 : return NULL;
20373 : }
20374 0 : call = &ndr_table_winreg.calls[30];
20375 :
20376 0 : pull = ndr_pull_init_blob(blob, object);
20377 0 : if (pull == NULL) {
20378 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
20379 0 : return NULL;
20380 : }
20381 :
20382 0 : pull->flags |= ndr_pull_flags;
20383 :
20384 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
20385 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
20386 0 : TALLOC_FREE(pull);
20387 0 : PyErr_SetNdrError(err);
20388 0 : return NULL;
20389 : }
20390 0 : if (!allow_remaining) {
20391 : uint32_t highest_ofs;
20392 :
20393 0 : if (pull->offset > pull->relative_highest_offset) {
20394 0 : highest_ofs = pull->offset;
20395 : } else {
20396 0 : highest_ofs = pull->relative_highest_offset;
20397 : }
20398 0 : if (highest_ofs < pull->data_size) {
20399 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
20400 : "not all bytes consumed ofs[%u] size[%u]",
20401 : highest_ofs, pull->data_size);
20402 0 : TALLOC_FREE(pull);
20403 0 : PyErr_SetNdrError(err);
20404 0 : return NULL;
20405 : }
20406 : }
20407 :
20408 0 : TALLOC_FREE(pull);
20409 0 : Py_RETURN_NONE;
20410 : }
20411 :
20412 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20413 : {
20414 : DATA_BLOB blob;
20415 0 : Py_ssize_t blob_length = 0;
20416 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
20417 0 : PyObject *bigendian_obj = NULL;
20418 0 : PyObject *ndr64_obj = NULL;
20419 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
20420 0 : PyObject *allow_remaining_obj = NULL;
20421 0 : bool allow_remaining = false;
20422 :
20423 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
20424 : discard_const_p(char *, kwnames),
20425 : &blob.data, &blob_length,
20426 : &bigendian_obj,
20427 : &ndr64_obj,
20428 : &allow_remaining_obj)) {
20429 0 : return NULL;
20430 : }
20431 0 : blob.length = blob_length;
20432 :
20433 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20434 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
20435 : }
20436 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20437 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
20438 : }
20439 :
20440 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
20441 0 : allow_remaining = true;
20442 : }
20443 :
20444 0 : return py_winreg_InitiateSystemShutdownEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
20445 : }
20446 :
20447 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20448 : {
20449 : DATA_BLOB blob;
20450 0 : Py_ssize_t blob_length = 0;
20451 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
20452 0 : PyObject *bigendian_obj = NULL;
20453 0 : PyObject *ndr64_obj = NULL;
20454 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
20455 0 : PyObject *allow_remaining_obj = NULL;
20456 0 : bool allow_remaining = false;
20457 :
20458 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
20459 : discard_const_p(char *, kwnames),
20460 : &blob.data, &blob_length,
20461 : &bigendian_obj,
20462 : &ndr64_obj,
20463 : &allow_remaining_obj)) {
20464 0 : return NULL;
20465 : }
20466 0 : blob.length = blob_length;
20467 :
20468 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20469 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
20470 : }
20471 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20472 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
20473 : }
20474 :
20475 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
20476 0 : allow_remaining = true;
20477 : }
20478 :
20479 0 : return py_winreg_InitiateSystemShutdownEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
20480 : }
20481 :
20482 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
20483 : {
20484 0 : const struct ndr_interface_call *call = NULL;
20485 0 : struct winreg_InitiateSystemShutdownEx *object = (struct winreg_InitiateSystemShutdownEx *)pytalloc_get_ptr(py_obj);
20486 : PyObject *ret;
20487 : char *retstr;
20488 :
20489 0 : if (ndr_table_winreg.num_calls < 31) {
20490 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_InitiateSystemShutdownEx_ndr_print");
20491 0 : return NULL;
20492 : }
20493 0 : call = &ndr_table_winreg.calls[30];
20494 :
20495 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
20496 0 : ret = PyUnicode_FromString(retstr);
20497 0 : TALLOC_FREE(retstr);
20498 :
20499 0 : return ret;
20500 : }
20501 :
20502 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
20503 : {
20504 0 : return py_winreg_InitiateSystemShutdownEx_ndr_print(py_obj, "winreg_InitiateSystemShutdownEx_in", NDR_IN);
20505 : }
20506 :
20507 0 : static PyObject *py_winreg_InitiateSystemShutdownEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
20508 : {
20509 0 : return py_winreg_InitiateSystemShutdownEx_ndr_print(py_obj, "winreg_InitiateSystemShutdownEx_out", NDR_OUT);
20510 : }
20511 :
20512 : static PyMethodDef py_winreg_InitiateSystemShutdownEx_methods[] = {
20513 : { "opnum", (PyCFunction)py_winreg_InitiateSystemShutdownEx_ndr_opnum, METH_NOARGS|METH_CLASS,
20514 : "winreg.InitiateSystemShutdownEx.opnum() -> 30 (0x1e) " },
20515 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
20516 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
20517 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
20518 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
20519 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
20520 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
20521 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_InitiateSystemShutdownEx_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
20522 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
20523 : { "__ndr_print_in__", (PyCFunction)py_winreg_InitiateSystemShutdownEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
20524 : { "__ndr_print_out__", (PyCFunction)py_winreg_InitiateSystemShutdownEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
20525 : { NULL, NULL, 0, NULL }
20526 : };
20527 :
20528 :
20529 : static PyTypeObject winreg_InitiateSystemShutdownEx_Type = {
20530 : PyVarObject_HEAD_INIT(NULL, 0)
20531 : .tp_name = "winreg.InitiateSystemShutdownEx",
20532 : .tp_getset = py_winreg_InitiateSystemShutdownEx_getsetters,
20533 : .tp_methods = py_winreg_InitiateSystemShutdownEx_methods,
20534 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
20535 : .tp_new = py_winreg_InitiateSystemShutdownEx_new,
20536 : };
20537 :
20538 0 : static bool pack_py_winreg_InitiateSystemShutdownEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_InitiateSystemShutdownEx *r)
20539 : {
20540 : PyObject *py_hostname;
20541 : PyObject *py_message;
20542 : PyObject *py_timeout;
20543 : PyObject *py_force_apps;
20544 : PyObject *py_do_reboot;
20545 : PyObject *py_reason;
20546 0 : const char *kwnames[] = {
20547 : "hostname", "message", "timeout", "force_apps", "do_reboot", "reason", NULL
20548 : };
20549 :
20550 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)) {
20551 0 : return false;
20552 : }
20553 :
20554 0 : if (py_hostname == NULL) {
20555 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hostname");
20556 0 : return false;
20557 : }
20558 0 : if (py_hostname == Py_None) {
20559 0 : r->in.hostname = NULL;
20560 : } else {
20561 0 : r->in.hostname = talloc_ptrtype(r, r->in.hostname);
20562 0 : if (r->in.hostname == NULL) {
20563 0 : PyErr_NoMemory();
20564 0 : return false;
20565 : }
20566 : {
20567 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.hostname));
20568 0 : if (PyLong_Check(py_hostname)) {
20569 : unsigned long long test_var;
20570 0 : test_var = PyLong_AsUnsignedLongLong(py_hostname);
20571 0 : if (PyErr_Occurred() != NULL) {
20572 0 : return false;
20573 : }
20574 0 : if (test_var > uint_max) {
20575 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20576 : PyLong_Type.tp_name, uint_max, test_var);
20577 0 : return false;
20578 : }
20579 0 : *r->in.hostname = test_var;
20580 : } else {
20581 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20582 : PyLong_Type.tp_name);
20583 0 : return false;
20584 : }
20585 : }
20586 : }
20587 0 : if (py_message == NULL) {
20588 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.message");
20589 0 : return false;
20590 : }
20591 0 : if (py_message == Py_None) {
20592 0 : r->in.message = NULL;
20593 : } else {
20594 0 : r->in.message = NULL;
20595 0 : PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
20596 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_message)) == NULL) {
20597 0 : PyErr_NoMemory();
20598 0 : return false;
20599 : }
20600 0 : r->in.message = (struct lsa_StringLarge *)pytalloc_get_ptr(py_message);
20601 : }
20602 0 : if (py_timeout == NULL) {
20603 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.timeout");
20604 0 : return false;
20605 : }
20606 : {
20607 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.timeout));
20608 0 : if (PyLong_Check(py_timeout)) {
20609 : unsigned long long test_var;
20610 0 : test_var = PyLong_AsUnsignedLongLong(py_timeout);
20611 0 : if (PyErr_Occurred() != NULL) {
20612 0 : return false;
20613 : }
20614 0 : if (test_var > uint_max) {
20615 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20616 : PyLong_Type.tp_name, uint_max, test_var);
20617 0 : return false;
20618 : }
20619 0 : r->in.timeout = test_var;
20620 : } else {
20621 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20622 : PyLong_Type.tp_name);
20623 0 : return false;
20624 : }
20625 : }
20626 0 : if (py_force_apps == NULL) {
20627 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.force_apps");
20628 0 : return false;
20629 : }
20630 : {
20631 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.force_apps));
20632 0 : if (PyLong_Check(py_force_apps)) {
20633 : unsigned long long test_var;
20634 0 : test_var = PyLong_AsUnsignedLongLong(py_force_apps);
20635 0 : if (PyErr_Occurred() != NULL) {
20636 0 : return false;
20637 : }
20638 0 : if (test_var > uint_max) {
20639 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20640 : PyLong_Type.tp_name, uint_max, test_var);
20641 0 : return false;
20642 : }
20643 0 : r->in.force_apps = test_var;
20644 : } else {
20645 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20646 : PyLong_Type.tp_name);
20647 0 : return false;
20648 : }
20649 : }
20650 0 : if (py_do_reboot == NULL) {
20651 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.do_reboot");
20652 0 : return false;
20653 : }
20654 : {
20655 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.do_reboot));
20656 0 : if (PyLong_Check(py_do_reboot)) {
20657 : unsigned long long test_var;
20658 0 : test_var = PyLong_AsUnsignedLongLong(py_do_reboot);
20659 0 : if (PyErr_Occurred() != NULL) {
20660 0 : return false;
20661 : }
20662 0 : if (test_var > uint_max) {
20663 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20664 : PyLong_Type.tp_name, uint_max, test_var);
20665 0 : return false;
20666 : }
20667 0 : r->in.do_reboot = test_var;
20668 : } else {
20669 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20670 : PyLong_Type.tp_name);
20671 0 : return false;
20672 : }
20673 : }
20674 0 : if (py_reason == NULL) {
20675 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.reason");
20676 0 : return false;
20677 : }
20678 : {
20679 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.reason));
20680 0 : if (PyLong_Check(py_reason)) {
20681 : unsigned long long test_var;
20682 0 : test_var = PyLong_AsUnsignedLongLong(py_reason);
20683 0 : if (PyErr_Occurred() != NULL) {
20684 0 : return false;
20685 : }
20686 0 : if (test_var > uint_max) {
20687 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20688 : PyLong_Type.tp_name, uint_max, test_var);
20689 0 : return false;
20690 : }
20691 0 : r->in.reason = test_var;
20692 : } else {
20693 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20694 : PyLong_Type.tp_name);
20695 0 : return false;
20696 : }
20697 : }
20698 0 : return true;
20699 : }
20700 :
20701 0 : static PyObject *unpack_py_winreg_InitiateSystemShutdownEx_args_out(struct winreg_InitiateSystemShutdownEx *r)
20702 : {
20703 : PyObject *result;
20704 0 : result = Py_None;
20705 0 : Py_INCREF(result);
20706 0 : if (!W_ERROR_IS_OK(r->out.result)) {
20707 0 : PyErr_SetWERROR(r->out.result);
20708 0 : return NULL;
20709 : }
20710 :
20711 0 : return result;
20712 : }
20713 :
20714 :
20715 0 : static PyObject *py_winreg_SaveKeyEx_in_get_handle(PyObject *obj, void *closure)
20716 : {
20717 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(obj);
20718 : PyObject *py_handle;
20719 0 : if (object->in.handle == NULL) {
20720 0 : Py_RETURN_NONE;
20721 : }
20722 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
20723 0 : return py_handle;
20724 : }
20725 :
20726 0 : static int py_winreg_SaveKeyEx_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
20727 : {
20728 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
20729 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
20730 0 : if (value == NULL) {
20731 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
20732 0 : return -1;
20733 : }
20734 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
20735 0 : if (object->in.handle == NULL) {
20736 0 : PyErr_NoMemory();
20737 0 : return -1;
20738 : }
20739 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
20740 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20741 0 : PyErr_NoMemory();
20742 0 : return -1;
20743 : }
20744 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
20745 0 : return 0;
20746 : }
20747 :
20748 0 : static PyObject *py_winreg_SaveKeyEx_in_get_filename(PyObject *obj, void *closure)
20749 : {
20750 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(obj);
20751 : PyObject *py_filename;
20752 0 : if (object->in.filename == NULL) {
20753 0 : Py_RETURN_NONE;
20754 : }
20755 0 : py_filename = pytalloc_reference_ex(&winreg_String_Type, object->in.filename, object->in.filename);
20756 0 : return py_filename;
20757 : }
20758 :
20759 0 : static int py_winreg_SaveKeyEx_in_set_filename(PyObject *py_obj, PyObject *value, void *closure)
20760 : {
20761 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
20762 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.filename));
20763 0 : if (value == NULL) {
20764 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.filename");
20765 0 : return -1;
20766 : }
20767 0 : object->in.filename = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.filename);
20768 0 : if (object->in.filename == NULL) {
20769 0 : PyErr_NoMemory();
20770 0 : return -1;
20771 : }
20772 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
20773 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20774 0 : PyErr_NoMemory();
20775 0 : return -1;
20776 : }
20777 0 : object->in.filename = (struct winreg_String *)pytalloc_get_ptr(value);
20778 0 : return 0;
20779 : }
20780 :
20781 0 : static PyObject *py_winreg_SaveKeyEx_in_get_sec_attrib(PyObject *obj, void *closure)
20782 : {
20783 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(obj);
20784 : PyObject *py_sec_attrib;
20785 0 : if (object->in.sec_attrib == NULL) {
20786 0 : Py_RETURN_NONE;
20787 : }
20788 0 : if (object->in.sec_attrib == NULL) {
20789 0 : py_sec_attrib = Py_None;
20790 0 : Py_INCREF(py_sec_attrib);
20791 : } else {
20792 0 : py_sec_attrib = pytalloc_reference_ex(&KeySecurityAttribute_Type, object->in.sec_attrib, object->in.sec_attrib);
20793 : }
20794 0 : return py_sec_attrib;
20795 : }
20796 :
20797 0 : static int py_winreg_SaveKeyEx_in_set_sec_attrib(PyObject *py_obj, PyObject *value, void *closure)
20798 : {
20799 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
20800 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.sec_attrib));
20801 0 : if (value == NULL) {
20802 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sec_attrib");
20803 0 : return -1;
20804 : }
20805 0 : if (value == Py_None) {
20806 0 : object->in.sec_attrib = NULL;
20807 : } else {
20808 0 : object->in.sec_attrib = NULL;
20809 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, value, return -1;);
20810 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
20811 0 : PyErr_NoMemory();
20812 0 : return -1;
20813 : }
20814 0 : object->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(value);
20815 : }
20816 0 : return 0;
20817 : }
20818 :
20819 0 : static PyObject *py_winreg_SaveKeyEx_in_get_flags(PyObject *obj, void *closure)
20820 : {
20821 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(obj);
20822 : PyObject *py_flags;
20823 0 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags);
20824 0 : return py_flags;
20825 : }
20826 :
20827 0 : static int py_winreg_SaveKeyEx_in_set_flags(PyObject *py_obj, PyObject *value, void *closure)
20828 : {
20829 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
20830 0 : if (value == NULL) {
20831 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags");
20832 0 : return -1;
20833 : }
20834 : {
20835 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags));
20836 0 : if (PyLong_Check(value)) {
20837 : unsigned long long test_var;
20838 0 : test_var = PyLong_AsUnsignedLongLong(value);
20839 0 : if (PyErr_Occurred() != NULL) {
20840 0 : return -1;
20841 : }
20842 0 : if (test_var > uint_max) {
20843 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
20844 : PyLong_Type.tp_name, uint_max, test_var);
20845 0 : return -1;
20846 : }
20847 0 : object->in.flags = test_var;
20848 : } else {
20849 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
20850 : PyLong_Type.tp_name);
20851 0 : return -1;
20852 : }
20853 : }
20854 0 : return 0;
20855 : }
20856 :
20857 0 : static PyObject *py_winreg_SaveKeyEx_get_result(PyObject *obj, void *closure)
20858 : {
20859 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(obj);
20860 : PyObject *py_result;
20861 0 : py_result = PyErr_FromWERROR(object->out.result);
20862 0 : return py_result;
20863 : }
20864 :
20865 0 : static int py_winreg_SaveKeyEx_set_result(PyObject *py_obj, PyObject *value, void *closure)
20866 : {
20867 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
20868 0 : if (value == NULL) {
20869 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
20870 0 : return -1;
20871 : }
20872 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
20873 0 : return 0;
20874 : }
20875 :
20876 : static PyGetSetDef py_winreg_SaveKeyEx_getsetters[] = {
20877 : {
20878 : .name = discard_const_p(char, "in_handle"),
20879 : .get = py_winreg_SaveKeyEx_in_get_handle,
20880 : .set = py_winreg_SaveKeyEx_in_set_handle,
20881 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
20882 : },
20883 : {
20884 : .name = discard_const_p(char, "in_filename"),
20885 : .get = py_winreg_SaveKeyEx_in_get_filename,
20886 : .set = py_winreg_SaveKeyEx_in_set_filename,
20887 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
20888 : },
20889 : {
20890 : .name = discard_const_p(char, "in_sec_attrib"),
20891 : .get = py_winreg_SaveKeyEx_in_get_sec_attrib,
20892 : .set = py_winreg_SaveKeyEx_in_set_sec_attrib,
20893 : .doc = discard_const_p(char, "PIDL-generated element of base type KeySecurityAttribute")
20894 : },
20895 : {
20896 : .name = discard_const_p(char, "in_flags"),
20897 : .get = py_winreg_SaveKeyEx_in_get_flags,
20898 : .set = py_winreg_SaveKeyEx_in_set_flags,
20899 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
20900 : },
20901 : {
20902 : .name = discard_const_p(char, "result"),
20903 : .get = py_winreg_SaveKeyEx_get_result,
20904 : .set = py_winreg_SaveKeyEx_set_result,
20905 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
20906 : },
20907 : { .name = NULL }
20908 : };
20909 :
20910 0 : static PyObject *py_winreg_SaveKeyEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
20911 : {
20912 0 : PyObject *self = pytalloc_new(struct winreg_SaveKeyEx, type);
20913 0 : struct winreg_SaveKeyEx *_self = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(self);
20914 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
20915 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
20916 0 : _self->in.filename = talloc_zero(mem_ctx, struct winreg_String);
20917 0 : return self;
20918 : }
20919 :
20920 0 : static PyObject *py_winreg_SaveKeyEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
20921 : {
20922 :
20923 :
20924 0 : return PyLong_FromLong(31);
20925 : }
20926 :
20927 0 : static PyObject *py_winreg_SaveKeyEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
20928 : {
20929 0 : const struct ndr_interface_call *call = NULL;
20930 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
20931 0 : PyObject *ret = NULL;
20932 0 : struct ndr_push *push = NULL;
20933 : DATA_BLOB blob;
20934 : enum ndr_err_code err;
20935 :
20936 0 : if (ndr_table_winreg.num_calls < 32) {
20937 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKeyEx_ndr_pack");
20938 0 : return NULL;
20939 : }
20940 0 : call = &ndr_table_winreg.calls[31];
20941 :
20942 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
20943 0 : if (push == NULL) {
20944 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
20945 0 : return NULL;
20946 : }
20947 :
20948 0 : push->flags |= ndr_push_flags;
20949 :
20950 0 : err = call->ndr_push(push, ndr_inout_flags, object);
20951 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
20952 0 : TALLOC_FREE(push);
20953 0 : PyErr_SetNdrError(err);
20954 0 : return NULL;
20955 : }
20956 0 : blob = ndr_push_blob(push);
20957 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
20958 0 : TALLOC_FREE(push);
20959 0 : return ret;
20960 : }
20961 :
20962 0 : static PyObject *py_winreg_SaveKeyEx_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20963 : {
20964 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20965 0 : PyObject *bigendian_obj = NULL;
20966 0 : PyObject *ndr64_obj = NULL;
20967 0 : uint32_t ndr_push_flags = 0;
20968 :
20969 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
20970 : discard_const_p(char *, kwnames),
20971 : &bigendian_obj,
20972 : &ndr64_obj)) {
20973 0 : return NULL;
20974 : }
20975 :
20976 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
20977 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
20978 : }
20979 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
20980 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
20981 : }
20982 :
20983 0 : return py_winreg_SaveKeyEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
20984 : }
20985 :
20986 0 : static PyObject *py_winreg_SaveKeyEx_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
20987 : {
20988 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
20989 0 : PyObject *bigendian_obj = NULL;
20990 0 : PyObject *ndr64_obj = NULL;
20991 0 : uint32_t ndr_push_flags = 0;
20992 :
20993 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
20994 : discard_const_p(char *, kwnames),
20995 : &bigendian_obj,
20996 : &ndr64_obj)) {
20997 0 : return NULL;
20998 : }
20999 :
21000 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21001 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
21002 : }
21003 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21004 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
21005 : }
21006 :
21007 0 : return py_winreg_SaveKeyEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
21008 : }
21009 :
21010 0 : static PyObject *py_winreg_SaveKeyEx_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
21011 : {
21012 0 : const struct ndr_interface_call *call = NULL;
21013 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
21014 0 : struct ndr_pull *pull = NULL;
21015 : enum ndr_err_code err;
21016 :
21017 0 : if (ndr_table_winreg.num_calls < 32) {
21018 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKeyEx_ndr_unpack");
21019 0 : return NULL;
21020 : }
21021 0 : call = &ndr_table_winreg.calls[31];
21022 :
21023 0 : pull = ndr_pull_init_blob(blob, object);
21024 0 : if (pull == NULL) {
21025 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
21026 0 : return NULL;
21027 : }
21028 :
21029 0 : pull->flags |= ndr_pull_flags;
21030 :
21031 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
21032 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
21033 0 : TALLOC_FREE(pull);
21034 0 : PyErr_SetNdrError(err);
21035 0 : return NULL;
21036 : }
21037 0 : if (!allow_remaining) {
21038 : uint32_t highest_ofs;
21039 :
21040 0 : if (pull->offset > pull->relative_highest_offset) {
21041 0 : highest_ofs = pull->offset;
21042 : } else {
21043 0 : highest_ofs = pull->relative_highest_offset;
21044 : }
21045 0 : if (highest_ofs < pull->data_size) {
21046 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
21047 : "not all bytes consumed ofs[%u] size[%u]",
21048 : highest_ofs, pull->data_size);
21049 0 : TALLOC_FREE(pull);
21050 0 : PyErr_SetNdrError(err);
21051 0 : return NULL;
21052 : }
21053 : }
21054 :
21055 0 : TALLOC_FREE(pull);
21056 0 : Py_RETURN_NONE;
21057 : }
21058 :
21059 0 : static PyObject *py_winreg_SaveKeyEx_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21060 : {
21061 : DATA_BLOB blob;
21062 0 : Py_ssize_t blob_length = 0;
21063 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21064 0 : PyObject *bigendian_obj = NULL;
21065 0 : PyObject *ndr64_obj = NULL;
21066 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21067 0 : PyObject *allow_remaining_obj = NULL;
21068 0 : bool allow_remaining = false;
21069 :
21070 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
21071 : discard_const_p(char *, kwnames),
21072 : &blob.data, &blob_length,
21073 : &bigendian_obj,
21074 : &ndr64_obj,
21075 : &allow_remaining_obj)) {
21076 0 : return NULL;
21077 : }
21078 0 : blob.length = blob_length;
21079 :
21080 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21081 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21082 : }
21083 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21084 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21085 : }
21086 :
21087 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21088 0 : allow_remaining = true;
21089 : }
21090 :
21091 0 : return py_winreg_SaveKeyEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
21092 : }
21093 :
21094 0 : static PyObject *py_winreg_SaveKeyEx_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21095 : {
21096 : DATA_BLOB blob;
21097 0 : Py_ssize_t blob_length = 0;
21098 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21099 0 : PyObject *bigendian_obj = NULL;
21100 0 : PyObject *ndr64_obj = NULL;
21101 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21102 0 : PyObject *allow_remaining_obj = NULL;
21103 0 : bool allow_remaining = false;
21104 :
21105 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
21106 : discard_const_p(char *, kwnames),
21107 : &blob.data, &blob_length,
21108 : &bigendian_obj,
21109 : &ndr64_obj,
21110 : &allow_remaining_obj)) {
21111 0 : return NULL;
21112 : }
21113 0 : blob.length = blob_length;
21114 :
21115 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21116 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21117 : }
21118 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21119 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21120 : }
21121 :
21122 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21123 0 : allow_remaining = true;
21124 : }
21125 :
21126 0 : return py_winreg_SaveKeyEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
21127 : }
21128 :
21129 0 : static PyObject *py_winreg_SaveKeyEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
21130 : {
21131 0 : const struct ndr_interface_call *call = NULL;
21132 0 : struct winreg_SaveKeyEx *object = (struct winreg_SaveKeyEx *)pytalloc_get_ptr(py_obj);
21133 : PyObject *ret;
21134 : char *retstr;
21135 :
21136 0 : if (ndr_table_winreg.num_calls < 32) {
21137 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_SaveKeyEx_ndr_print");
21138 0 : return NULL;
21139 : }
21140 0 : call = &ndr_table_winreg.calls[31];
21141 :
21142 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
21143 0 : ret = PyUnicode_FromString(retstr);
21144 0 : TALLOC_FREE(retstr);
21145 :
21146 0 : return ret;
21147 : }
21148 :
21149 0 : static PyObject *py_winreg_SaveKeyEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21150 : {
21151 0 : return py_winreg_SaveKeyEx_ndr_print(py_obj, "winreg_SaveKeyEx_in", NDR_IN);
21152 : }
21153 :
21154 0 : static PyObject *py_winreg_SaveKeyEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21155 : {
21156 0 : return py_winreg_SaveKeyEx_ndr_print(py_obj, "winreg_SaveKeyEx_out", NDR_OUT);
21157 : }
21158 :
21159 : static PyMethodDef py_winreg_SaveKeyEx_methods[] = {
21160 : { "opnum", (PyCFunction)py_winreg_SaveKeyEx_ndr_opnum, METH_NOARGS|METH_CLASS,
21161 : "winreg.SaveKeyEx.opnum() -> 31 (0x1f) " },
21162 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
21163 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
21164 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
21165 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
21166 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
21167 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
21168 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_SaveKeyEx_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
21169 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
21170 : { "__ndr_print_in__", (PyCFunction)py_winreg_SaveKeyEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
21171 : { "__ndr_print_out__", (PyCFunction)py_winreg_SaveKeyEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
21172 : { NULL, NULL, 0, NULL }
21173 : };
21174 :
21175 :
21176 : static PyTypeObject winreg_SaveKeyEx_Type = {
21177 : PyVarObject_HEAD_INIT(NULL, 0)
21178 : .tp_name = "winreg.SaveKeyEx",
21179 : .tp_getset = py_winreg_SaveKeyEx_getsetters,
21180 : .tp_methods = py_winreg_SaveKeyEx_methods,
21181 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
21182 : .tp_new = py_winreg_SaveKeyEx_new,
21183 : };
21184 :
21185 0 : static bool pack_py_winreg_SaveKeyEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_SaveKeyEx *r)
21186 : {
21187 : PyObject *py_handle;
21188 : PyObject *py_filename;
21189 : PyObject *py_sec_attrib;
21190 : PyObject *py_flags;
21191 0 : const char *kwnames[] = {
21192 : "handle", "filename", "sec_attrib", "flags", NULL
21193 : };
21194 :
21195 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_SaveKeyEx", discard_const_p(char *, kwnames), &py_handle, &py_filename, &py_sec_attrib, &py_flags)) {
21196 0 : return false;
21197 : }
21198 :
21199 0 : if (py_handle == NULL) {
21200 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
21201 0 : return false;
21202 : }
21203 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
21204 0 : if (r->in.handle == NULL) {
21205 0 : PyErr_NoMemory();
21206 0 : return false;
21207 : }
21208 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
21209 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
21210 0 : PyErr_NoMemory();
21211 0 : return false;
21212 : }
21213 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
21214 0 : if (py_filename == NULL) {
21215 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.filename");
21216 0 : return false;
21217 : }
21218 0 : r->in.filename = talloc_ptrtype(r, r->in.filename);
21219 0 : if (r->in.filename == NULL) {
21220 0 : PyErr_NoMemory();
21221 0 : return false;
21222 : }
21223 0 : PY_CHECK_TYPE(&winreg_String_Type, py_filename, return false;);
21224 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_filename)) == NULL) {
21225 0 : PyErr_NoMemory();
21226 0 : return false;
21227 : }
21228 0 : r->in.filename = (struct winreg_String *)pytalloc_get_ptr(py_filename);
21229 0 : if (py_sec_attrib == NULL) {
21230 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sec_attrib");
21231 0 : return false;
21232 : }
21233 0 : if (py_sec_attrib == Py_None) {
21234 0 : r->in.sec_attrib = NULL;
21235 : } else {
21236 0 : r->in.sec_attrib = NULL;
21237 0 : PY_CHECK_TYPE(&KeySecurityAttribute_Type, py_sec_attrib, return false;);
21238 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_sec_attrib)) == NULL) {
21239 0 : PyErr_NoMemory();
21240 0 : return false;
21241 : }
21242 0 : r->in.sec_attrib = (struct KeySecurityAttribute *)pytalloc_get_ptr(py_sec_attrib);
21243 : }
21244 0 : if (py_flags == NULL) {
21245 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags");
21246 0 : return false;
21247 : }
21248 : {
21249 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags));
21250 0 : if (PyLong_Check(py_flags)) {
21251 : unsigned long long test_var;
21252 0 : test_var = PyLong_AsUnsignedLongLong(py_flags);
21253 0 : if (PyErr_Occurred() != NULL) {
21254 0 : return false;
21255 : }
21256 0 : if (test_var > uint_max) {
21257 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21258 : PyLong_Type.tp_name, uint_max, test_var);
21259 0 : return false;
21260 : }
21261 0 : r->in.flags = test_var;
21262 : } else {
21263 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21264 : PyLong_Type.tp_name);
21265 0 : return false;
21266 : }
21267 : }
21268 0 : return true;
21269 : }
21270 :
21271 0 : static PyObject *unpack_py_winreg_SaveKeyEx_args_out(struct winreg_SaveKeyEx *r)
21272 : {
21273 : PyObject *result;
21274 0 : result = Py_None;
21275 0 : Py_INCREF(result);
21276 0 : if (!W_ERROR_IS_OK(r->out.result)) {
21277 0 : PyErr_SetWERROR(r->out.result);
21278 0 : return NULL;
21279 : }
21280 :
21281 0 : return result;
21282 : }
21283 :
21284 :
21285 0 : static PyObject *py_winreg_OpenHKPT_in_get_system_name(PyObject *obj, void *closure)
21286 : {
21287 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(obj);
21288 : PyObject *py_system_name;
21289 0 : if (object->in.system_name == NULL) {
21290 0 : Py_RETURN_NONE;
21291 : }
21292 0 : if (object->in.system_name == NULL) {
21293 0 : py_system_name = Py_None;
21294 0 : Py_INCREF(py_system_name);
21295 : } else {
21296 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
21297 : }
21298 0 : return py_system_name;
21299 : }
21300 :
21301 0 : static int py_winreg_OpenHKPT_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
21302 : {
21303 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(py_obj);
21304 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
21305 0 : if (value == NULL) {
21306 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
21307 0 : return -1;
21308 : }
21309 0 : if (value == Py_None) {
21310 0 : object->in.system_name = NULL;
21311 : } else {
21312 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
21313 0 : if (object->in.system_name == NULL) {
21314 0 : PyErr_NoMemory();
21315 0 : return -1;
21316 : }
21317 : {
21318 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
21319 0 : if (PyLong_Check(value)) {
21320 : unsigned long long test_var;
21321 0 : test_var = PyLong_AsUnsignedLongLong(value);
21322 0 : if (PyErr_Occurred() != NULL) {
21323 0 : return -1;
21324 : }
21325 0 : if (test_var > uint_max) {
21326 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21327 : PyLong_Type.tp_name, uint_max, test_var);
21328 0 : return -1;
21329 : }
21330 0 : *object->in.system_name = test_var;
21331 : } else {
21332 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21333 : PyLong_Type.tp_name);
21334 0 : return -1;
21335 : }
21336 : }
21337 : }
21338 0 : return 0;
21339 : }
21340 :
21341 0 : static PyObject *py_winreg_OpenHKPT_in_get_access_mask(PyObject *obj, void *closure)
21342 : {
21343 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(obj);
21344 : PyObject *py_access_mask;
21345 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
21346 0 : return py_access_mask;
21347 : }
21348 :
21349 0 : static int py_winreg_OpenHKPT_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
21350 : {
21351 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(py_obj);
21352 0 : if (value == NULL) {
21353 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
21354 0 : return -1;
21355 : }
21356 : {
21357 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
21358 0 : if (PyLong_Check(value)) {
21359 : unsigned long long test_var;
21360 0 : test_var = PyLong_AsUnsignedLongLong(value);
21361 0 : if (PyErr_Occurred() != NULL) {
21362 0 : return -1;
21363 : }
21364 0 : if (test_var > uint_max) {
21365 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21366 : PyLong_Type.tp_name, uint_max, test_var);
21367 0 : return -1;
21368 : }
21369 0 : object->in.access_mask = test_var;
21370 : } else {
21371 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21372 : PyLong_Type.tp_name);
21373 0 : return -1;
21374 : }
21375 : }
21376 0 : return 0;
21377 : }
21378 :
21379 0 : static PyObject *py_winreg_OpenHKPT_out_get_handle(PyObject *obj, void *closure)
21380 : {
21381 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(obj);
21382 : PyObject *py_handle;
21383 0 : if (object->out.handle == NULL) {
21384 0 : Py_RETURN_NONE;
21385 : }
21386 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
21387 0 : return py_handle;
21388 : }
21389 :
21390 0 : static int py_winreg_OpenHKPT_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
21391 : {
21392 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(py_obj);
21393 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
21394 0 : if (value == NULL) {
21395 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
21396 0 : return -1;
21397 : }
21398 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
21399 0 : if (object->out.handle == NULL) {
21400 0 : PyErr_NoMemory();
21401 0 : return -1;
21402 : }
21403 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
21404 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
21405 0 : PyErr_NoMemory();
21406 0 : return -1;
21407 : }
21408 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
21409 0 : return 0;
21410 : }
21411 :
21412 0 : static PyObject *py_winreg_OpenHKPT_get_result(PyObject *obj, void *closure)
21413 : {
21414 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(obj);
21415 : PyObject *py_result;
21416 0 : py_result = PyErr_FromWERROR(object->out.result);
21417 0 : return py_result;
21418 : }
21419 :
21420 0 : static int py_winreg_OpenHKPT_set_result(PyObject *py_obj, PyObject *value, void *closure)
21421 : {
21422 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(py_obj);
21423 0 : if (value == NULL) {
21424 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
21425 0 : return -1;
21426 : }
21427 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
21428 0 : return 0;
21429 : }
21430 :
21431 : static PyGetSetDef py_winreg_OpenHKPT_getsetters[] = {
21432 : {
21433 : .name = discard_const_p(char, "in_system_name"),
21434 : .get = py_winreg_OpenHKPT_in_get_system_name,
21435 : .set = py_winreg_OpenHKPT_in_set_system_name,
21436 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
21437 : },
21438 : {
21439 : .name = discard_const_p(char, "in_access_mask"),
21440 : .get = py_winreg_OpenHKPT_in_get_access_mask,
21441 : .set = py_winreg_OpenHKPT_in_set_access_mask,
21442 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
21443 : },
21444 : {
21445 : .name = discard_const_p(char, "out_handle"),
21446 : .get = py_winreg_OpenHKPT_out_get_handle,
21447 : .set = py_winreg_OpenHKPT_out_set_handle,
21448 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
21449 : },
21450 : {
21451 : .name = discard_const_p(char, "result"),
21452 : .get = py_winreg_OpenHKPT_get_result,
21453 : .set = py_winreg_OpenHKPT_set_result,
21454 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
21455 : },
21456 : { .name = NULL }
21457 : };
21458 :
21459 0 : static PyObject *py_winreg_OpenHKPT_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
21460 : {
21461 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKPT, type);
21462 0 : struct winreg_OpenHKPT *_self = (struct winreg_OpenHKPT *)pytalloc_get_ptr(self);
21463 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
21464 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
21465 0 : return self;
21466 : }
21467 :
21468 0 : static PyObject *py_winreg_OpenHKPT_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
21469 : {
21470 :
21471 :
21472 0 : return PyLong_FromLong(32);
21473 : }
21474 :
21475 0 : static PyObject *py_winreg_OpenHKPT_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
21476 : {
21477 0 : const struct ndr_interface_call *call = NULL;
21478 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(py_obj);
21479 0 : PyObject *ret = NULL;
21480 0 : struct ndr_push *push = NULL;
21481 : DATA_BLOB blob;
21482 : enum ndr_err_code err;
21483 :
21484 0 : if (ndr_table_winreg.num_calls < 33) {
21485 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPT_ndr_pack");
21486 0 : return NULL;
21487 : }
21488 0 : call = &ndr_table_winreg.calls[32];
21489 :
21490 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
21491 0 : if (push == NULL) {
21492 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
21493 0 : return NULL;
21494 : }
21495 :
21496 0 : push->flags |= ndr_push_flags;
21497 :
21498 0 : err = call->ndr_push(push, ndr_inout_flags, object);
21499 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
21500 0 : TALLOC_FREE(push);
21501 0 : PyErr_SetNdrError(err);
21502 0 : return NULL;
21503 : }
21504 0 : blob = ndr_push_blob(push);
21505 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
21506 0 : TALLOC_FREE(push);
21507 0 : return ret;
21508 : }
21509 :
21510 0 : static PyObject *py_winreg_OpenHKPT_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21511 : {
21512 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
21513 0 : PyObject *bigendian_obj = NULL;
21514 0 : PyObject *ndr64_obj = NULL;
21515 0 : uint32_t ndr_push_flags = 0;
21516 :
21517 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
21518 : discard_const_p(char *, kwnames),
21519 : &bigendian_obj,
21520 : &ndr64_obj)) {
21521 0 : return NULL;
21522 : }
21523 :
21524 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21525 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
21526 : }
21527 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21528 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
21529 : }
21530 :
21531 0 : return py_winreg_OpenHKPT_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
21532 : }
21533 :
21534 0 : static PyObject *py_winreg_OpenHKPT_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21535 : {
21536 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
21537 0 : PyObject *bigendian_obj = NULL;
21538 0 : PyObject *ndr64_obj = NULL;
21539 0 : uint32_t ndr_push_flags = 0;
21540 :
21541 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
21542 : discard_const_p(char *, kwnames),
21543 : &bigendian_obj,
21544 : &ndr64_obj)) {
21545 0 : return NULL;
21546 : }
21547 :
21548 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21549 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
21550 : }
21551 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21552 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
21553 : }
21554 :
21555 0 : return py_winreg_OpenHKPT_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
21556 : }
21557 :
21558 0 : static PyObject *py_winreg_OpenHKPT_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
21559 : {
21560 0 : const struct ndr_interface_call *call = NULL;
21561 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(py_obj);
21562 0 : struct ndr_pull *pull = NULL;
21563 : enum ndr_err_code err;
21564 :
21565 0 : if (ndr_table_winreg.num_calls < 33) {
21566 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPT_ndr_unpack");
21567 0 : return NULL;
21568 : }
21569 0 : call = &ndr_table_winreg.calls[32];
21570 :
21571 0 : pull = ndr_pull_init_blob(blob, object);
21572 0 : if (pull == NULL) {
21573 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
21574 0 : return NULL;
21575 : }
21576 :
21577 0 : pull->flags |= ndr_pull_flags;
21578 :
21579 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
21580 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
21581 0 : TALLOC_FREE(pull);
21582 0 : PyErr_SetNdrError(err);
21583 0 : return NULL;
21584 : }
21585 0 : if (!allow_remaining) {
21586 : uint32_t highest_ofs;
21587 :
21588 0 : if (pull->offset > pull->relative_highest_offset) {
21589 0 : highest_ofs = pull->offset;
21590 : } else {
21591 0 : highest_ofs = pull->relative_highest_offset;
21592 : }
21593 0 : if (highest_ofs < pull->data_size) {
21594 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
21595 : "not all bytes consumed ofs[%u] size[%u]",
21596 : highest_ofs, pull->data_size);
21597 0 : TALLOC_FREE(pull);
21598 0 : PyErr_SetNdrError(err);
21599 0 : return NULL;
21600 : }
21601 : }
21602 :
21603 0 : TALLOC_FREE(pull);
21604 0 : Py_RETURN_NONE;
21605 : }
21606 :
21607 0 : static PyObject *py_winreg_OpenHKPT_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21608 : {
21609 : DATA_BLOB blob;
21610 0 : Py_ssize_t blob_length = 0;
21611 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21612 0 : PyObject *bigendian_obj = NULL;
21613 0 : PyObject *ndr64_obj = NULL;
21614 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21615 0 : PyObject *allow_remaining_obj = NULL;
21616 0 : bool allow_remaining = false;
21617 :
21618 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
21619 : discard_const_p(char *, kwnames),
21620 : &blob.data, &blob_length,
21621 : &bigendian_obj,
21622 : &ndr64_obj,
21623 : &allow_remaining_obj)) {
21624 0 : return NULL;
21625 : }
21626 0 : blob.length = blob_length;
21627 :
21628 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21629 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21630 : }
21631 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21632 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21633 : }
21634 :
21635 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21636 0 : allow_remaining = true;
21637 : }
21638 :
21639 0 : return py_winreg_OpenHKPT_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
21640 : }
21641 :
21642 0 : static PyObject *py_winreg_OpenHKPT_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
21643 : {
21644 : DATA_BLOB blob;
21645 0 : Py_ssize_t blob_length = 0;
21646 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
21647 0 : PyObject *bigendian_obj = NULL;
21648 0 : PyObject *ndr64_obj = NULL;
21649 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
21650 0 : PyObject *allow_remaining_obj = NULL;
21651 0 : bool allow_remaining = false;
21652 :
21653 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
21654 : discard_const_p(char *, kwnames),
21655 : &blob.data, &blob_length,
21656 : &bigendian_obj,
21657 : &ndr64_obj,
21658 : &allow_remaining_obj)) {
21659 0 : return NULL;
21660 : }
21661 0 : blob.length = blob_length;
21662 :
21663 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
21664 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
21665 : }
21666 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
21667 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
21668 : }
21669 :
21670 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
21671 0 : allow_remaining = true;
21672 : }
21673 :
21674 0 : return py_winreg_OpenHKPT_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
21675 : }
21676 :
21677 0 : static PyObject *py_winreg_OpenHKPT_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
21678 : {
21679 0 : const struct ndr_interface_call *call = NULL;
21680 0 : struct winreg_OpenHKPT *object = (struct winreg_OpenHKPT *)pytalloc_get_ptr(py_obj);
21681 : PyObject *ret;
21682 : char *retstr;
21683 :
21684 0 : if (ndr_table_winreg.num_calls < 33) {
21685 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPT_ndr_print");
21686 0 : return NULL;
21687 : }
21688 0 : call = &ndr_table_winreg.calls[32];
21689 :
21690 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
21691 0 : ret = PyUnicode_FromString(retstr);
21692 0 : TALLOC_FREE(retstr);
21693 :
21694 0 : return ret;
21695 : }
21696 :
21697 0 : static PyObject *py_winreg_OpenHKPT_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21698 : {
21699 0 : return py_winreg_OpenHKPT_ndr_print(py_obj, "winreg_OpenHKPT_in", NDR_IN);
21700 : }
21701 :
21702 0 : static PyObject *py_winreg_OpenHKPT_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
21703 : {
21704 0 : return py_winreg_OpenHKPT_ndr_print(py_obj, "winreg_OpenHKPT_out", NDR_OUT);
21705 : }
21706 :
21707 : static PyMethodDef py_winreg_OpenHKPT_methods[] = {
21708 : { "opnum", (PyCFunction)py_winreg_OpenHKPT_ndr_opnum, METH_NOARGS|METH_CLASS,
21709 : "winreg.OpenHKPT.opnum() -> 32 (0x20) " },
21710 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
21711 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
21712 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
21713 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
21714 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
21715 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
21716 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPT_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
21717 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
21718 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKPT_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
21719 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKPT_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
21720 : { NULL, NULL, 0, NULL }
21721 : };
21722 :
21723 :
21724 : static PyTypeObject winreg_OpenHKPT_Type = {
21725 : PyVarObject_HEAD_INIT(NULL, 0)
21726 : .tp_name = "winreg.OpenHKPT",
21727 : .tp_getset = py_winreg_OpenHKPT_getsetters,
21728 : .tp_methods = py_winreg_OpenHKPT_methods,
21729 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
21730 : .tp_new = py_winreg_OpenHKPT_new,
21731 : };
21732 :
21733 0 : static bool pack_py_winreg_OpenHKPT_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPT *r)
21734 : {
21735 : PyObject *py_system_name;
21736 : PyObject *py_access_mask;
21737 0 : const char *kwnames[] = {
21738 : "system_name", "access_mask", NULL
21739 : };
21740 :
21741 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPT", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
21742 0 : return false;
21743 : }
21744 :
21745 0 : if (py_system_name == NULL) {
21746 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
21747 0 : return false;
21748 : }
21749 0 : if (py_system_name == Py_None) {
21750 0 : r->in.system_name = NULL;
21751 : } else {
21752 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
21753 0 : if (r->in.system_name == NULL) {
21754 0 : PyErr_NoMemory();
21755 0 : return false;
21756 : }
21757 : {
21758 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
21759 0 : if (PyLong_Check(py_system_name)) {
21760 : unsigned long long test_var;
21761 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
21762 0 : if (PyErr_Occurred() != NULL) {
21763 0 : return false;
21764 : }
21765 0 : if (test_var > uint_max) {
21766 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21767 : PyLong_Type.tp_name, uint_max, test_var);
21768 0 : return false;
21769 : }
21770 0 : *r->in.system_name = test_var;
21771 : } else {
21772 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21773 : PyLong_Type.tp_name);
21774 0 : return false;
21775 : }
21776 : }
21777 : }
21778 0 : if (py_access_mask == NULL) {
21779 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
21780 0 : return false;
21781 : }
21782 : {
21783 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
21784 0 : if (PyLong_Check(py_access_mask)) {
21785 : unsigned long long test_var;
21786 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
21787 0 : if (PyErr_Occurred() != NULL) {
21788 0 : return false;
21789 : }
21790 0 : if (test_var > uint_max) {
21791 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21792 : PyLong_Type.tp_name, uint_max, test_var);
21793 0 : return false;
21794 : }
21795 0 : r->in.access_mask = test_var;
21796 : } else {
21797 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21798 : PyLong_Type.tp_name);
21799 0 : return false;
21800 : }
21801 : }
21802 0 : return true;
21803 : }
21804 :
21805 0 : static PyObject *unpack_py_winreg_OpenHKPT_args_out(struct winreg_OpenHKPT *r)
21806 : {
21807 : PyObject *result;
21808 : PyObject *py_handle;
21809 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
21810 0 : result = py_handle;
21811 0 : if (!W_ERROR_IS_OK(r->out.result)) {
21812 0 : PyErr_SetWERROR(r->out.result);
21813 0 : return NULL;
21814 : }
21815 :
21816 0 : return result;
21817 : }
21818 :
21819 :
21820 0 : static PyObject *py_winreg_OpenHKPN_in_get_system_name(PyObject *obj, void *closure)
21821 : {
21822 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(obj);
21823 : PyObject *py_system_name;
21824 0 : if (object->in.system_name == NULL) {
21825 0 : Py_RETURN_NONE;
21826 : }
21827 0 : if (object->in.system_name == NULL) {
21828 0 : py_system_name = Py_None;
21829 0 : Py_INCREF(py_system_name);
21830 : } else {
21831 0 : py_system_name = PyLong_FromLong((uint16_t)*object->in.system_name);
21832 : }
21833 0 : return py_system_name;
21834 : }
21835 :
21836 0 : static int py_winreg_OpenHKPN_in_set_system_name(PyObject *py_obj, PyObject *value, void *closure)
21837 : {
21838 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(py_obj);
21839 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.system_name));
21840 0 : if (value == NULL) {
21841 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.system_name");
21842 0 : return -1;
21843 : }
21844 0 : if (value == Py_None) {
21845 0 : object->in.system_name = NULL;
21846 : } else {
21847 0 : object->in.system_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.system_name);
21848 0 : if (object->in.system_name == NULL) {
21849 0 : PyErr_NoMemory();
21850 0 : return -1;
21851 : }
21852 : {
21853 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.system_name));
21854 0 : if (PyLong_Check(value)) {
21855 : unsigned long long test_var;
21856 0 : test_var = PyLong_AsUnsignedLongLong(value);
21857 0 : if (PyErr_Occurred() != NULL) {
21858 0 : return -1;
21859 : }
21860 0 : if (test_var > uint_max) {
21861 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21862 : PyLong_Type.tp_name, uint_max, test_var);
21863 0 : return -1;
21864 : }
21865 0 : *object->in.system_name = test_var;
21866 : } else {
21867 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21868 : PyLong_Type.tp_name);
21869 0 : return -1;
21870 : }
21871 : }
21872 : }
21873 0 : return 0;
21874 : }
21875 :
21876 0 : static PyObject *py_winreg_OpenHKPN_in_get_access_mask(PyObject *obj, void *closure)
21877 : {
21878 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(obj);
21879 : PyObject *py_access_mask;
21880 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
21881 0 : return py_access_mask;
21882 : }
21883 :
21884 0 : static int py_winreg_OpenHKPN_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
21885 : {
21886 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(py_obj);
21887 0 : if (value == NULL) {
21888 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
21889 0 : return -1;
21890 : }
21891 : {
21892 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
21893 0 : if (PyLong_Check(value)) {
21894 : unsigned long long test_var;
21895 0 : test_var = PyLong_AsUnsignedLongLong(value);
21896 0 : if (PyErr_Occurred() != NULL) {
21897 0 : return -1;
21898 : }
21899 0 : if (test_var > uint_max) {
21900 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
21901 : PyLong_Type.tp_name, uint_max, test_var);
21902 0 : return -1;
21903 : }
21904 0 : object->in.access_mask = test_var;
21905 : } else {
21906 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
21907 : PyLong_Type.tp_name);
21908 0 : return -1;
21909 : }
21910 : }
21911 0 : return 0;
21912 : }
21913 :
21914 0 : static PyObject *py_winreg_OpenHKPN_out_get_handle(PyObject *obj, void *closure)
21915 : {
21916 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(obj);
21917 : PyObject *py_handle;
21918 0 : if (object->out.handle == NULL) {
21919 0 : Py_RETURN_NONE;
21920 : }
21921 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle);
21922 0 : return py_handle;
21923 : }
21924 :
21925 0 : static int py_winreg_OpenHKPN_out_set_handle(PyObject *py_obj, PyObject *value, void *closure)
21926 : {
21927 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(py_obj);
21928 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle));
21929 0 : if (value == NULL) {
21930 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle");
21931 0 : return -1;
21932 : }
21933 0 : object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle);
21934 0 : if (object->out.handle == NULL) {
21935 0 : PyErr_NoMemory();
21936 0 : return -1;
21937 : }
21938 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
21939 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
21940 0 : PyErr_NoMemory();
21941 0 : return -1;
21942 : }
21943 0 : object->out.handle = (struct policy_handle *)pytalloc_get_ptr(value);
21944 0 : return 0;
21945 : }
21946 :
21947 0 : static PyObject *py_winreg_OpenHKPN_get_result(PyObject *obj, void *closure)
21948 : {
21949 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(obj);
21950 : PyObject *py_result;
21951 0 : py_result = PyErr_FromWERROR(object->out.result);
21952 0 : return py_result;
21953 : }
21954 :
21955 0 : static int py_winreg_OpenHKPN_set_result(PyObject *py_obj, PyObject *value, void *closure)
21956 : {
21957 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(py_obj);
21958 0 : if (value == NULL) {
21959 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
21960 0 : return -1;
21961 : }
21962 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
21963 0 : return 0;
21964 : }
21965 :
21966 : static PyGetSetDef py_winreg_OpenHKPN_getsetters[] = {
21967 : {
21968 : .name = discard_const_p(char, "in_system_name"),
21969 : .get = py_winreg_OpenHKPN_in_get_system_name,
21970 : .set = py_winreg_OpenHKPN_in_set_system_name,
21971 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
21972 : },
21973 : {
21974 : .name = discard_const_p(char, "in_access_mask"),
21975 : .get = py_winreg_OpenHKPN_in_get_access_mask,
21976 : .set = py_winreg_OpenHKPN_in_set_access_mask,
21977 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
21978 : },
21979 : {
21980 : .name = discard_const_p(char, "out_handle"),
21981 : .get = py_winreg_OpenHKPN_out_get_handle,
21982 : .set = py_winreg_OpenHKPN_out_set_handle,
21983 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
21984 : },
21985 : {
21986 : .name = discard_const_p(char, "result"),
21987 : .get = py_winreg_OpenHKPN_get_result,
21988 : .set = py_winreg_OpenHKPN_set_result,
21989 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
21990 : },
21991 : { .name = NULL }
21992 : };
21993 :
21994 0 : static PyObject *py_winreg_OpenHKPN_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
21995 : {
21996 0 : PyObject *self = pytalloc_new(struct winreg_OpenHKPN, type);
21997 0 : struct winreg_OpenHKPN *_self = (struct winreg_OpenHKPN *)pytalloc_get_ptr(self);
21998 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
21999 0 : _self->out.handle = talloc_zero(mem_ctx, struct policy_handle);
22000 0 : return self;
22001 : }
22002 :
22003 0 : static PyObject *py_winreg_OpenHKPN_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
22004 : {
22005 :
22006 :
22007 0 : return PyLong_FromLong(33);
22008 : }
22009 :
22010 0 : static PyObject *py_winreg_OpenHKPN_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
22011 : {
22012 0 : const struct ndr_interface_call *call = NULL;
22013 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(py_obj);
22014 0 : PyObject *ret = NULL;
22015 0 : struct ndr_push *push = NULL;
22016 : DATA_BLOB blob;
22017 : enum ndr_err_code err;
22018 :
22019 0 : if (ndr_table_winreg.num_calls < 34) {
22020 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPN_ndr_pack");
22021 0 : return NULL;
22022 : }
22023 0 : call = &ndr_table_winreg.calls[33];
22024 :
22025 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
22026 0 : if (push == NULL) {
22027 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22028 0 : return NULL;
22029 : }
22030 :
22031 0 : push->flags |= ndr_push_flags;
22032 :
22033 0 : err = call->ndr_push(push, ndr_inout_flags, object);
22034 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22035 0 : TALLOC_FREE(push);
22036 0 : PyErr_SetNdrError(err);
22037 0 : return NULL;
22038 : }
22039 0 : blob = ndr_push_blob(push);
22040 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
22041 0 : TALLOC_FREE(push);
22042 0 : return ret;
22043 : }
22044 :
22045 0 : static PyObject *py_winreg_OpenHKPN_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22046 : {
22047 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22048 0 : PyObject *bigendian_obj = NULL;
22049 0 : PyObject *ndr64_obj = NULL;
22050 0 : uint32_t ndr_push_flags = 0;
22051 :
22052 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
22053 : discard_const_p(char *, kwnames),
22054 : &bigendian_obj,
22055 : &ndr64_obj)) {
22056 0 : return NULL;
22057 : }
22058 :
22059 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22060 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22061 : }
22062 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22063 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22064 : }
22065 :
22066 0 : return py_winreg_OpenHKPN_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
22067 : }
22068 :
22069 0 : static PyObject *py_winreg_OpenHKPN_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22070 : {
22071 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22072 0 : PyObject *bigendian_obj = NULL;
22073 0 : PyObject *ndr64_obj = NULL;
22074 0 : uint32_t ndr_push_flags = 0;
22075 :
22076 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
22077 : discard_const_p(char *, kwnames),
22078 : &bigendian_obj,
22079 : &ndr64_obj)) {
22080 0 : return NULL;
22081 : }
22082 :
22083 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22084 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22085 : }
22086 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22087 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22088 : }
22089 :
22090 0 : return py_winreg_OpenHKPN_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
22091 : }
22092 :
22093 0 : static PyObject *py_winreg_OpenHKPN_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
22094 : {
22095 0 : const struct ndr_interface_call *call = NULL;
22096 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(py_obj);
22097 0 : struct ndr_pull *pull = NULL;
22098 : enum ndr_err_code err;
22099 :
22100 0 : if (ndr_table_winreg.num_calls < 34) {
22101 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPN_ndr_unpack");
22102 0 : return NULL;
22103 : }
22104 0 : call = &ndr_table_winreg.calls[33];
22105 :
22106 0 : pull = ndr_pull_init_blob(blob, object);
22107 0 : if (pull == NULL) {
22108 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22109 0 : return NULL;
22110 : }
22111 :
22112 0 : pull->flags |= ndr_pull_flags;
22113 :
22114 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
22115 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22116 0 : TALLOC_FREE(pull);
22117 0 : PyErr_SetNdrError(err);
22118 0 : return NULL;
22119 : }
22120 0 : if (!allow_remaining) {
22121 : uint32_t highest_ofs;
22122 :
22123 0 : if (pull->offset > pull->relative_highest_offset) {
22124 0 : highest_ofs = pull->offset;
22125 : } else {
22126 0 : highest_ofs = pull->relative_highest_offset;
22127 : }
22128 0 : if (highest_ofs < pull->data_size) {
22129 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
22130 : "not all bytes consumed ofs[%u] size[%u]",
22131 : highest_ofs, pull->data_size);
22132 0 : TALLOC_FREE(pull);
22133 0 : PyErr_SetNdrError(err);
22134 0 : return NULL;
22135 : }
22136 : }
22137 :
22138 0 : TALLOC_FREE(pull);
22139 0 : Py_RETURN_NONE;
22140 : }
22141 :
22142 0 : static PyObject *py_winreg_OpenHKPN_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22143 : {
22144 : DATA_BLOB blob;
22145 0 : Py_ssize_t blob_length = 0;
22146 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
22147 0 : PyObject *bigendian_obj = NULL;
22148 0 : PyObject *ndr64_obj = NULL;
22149 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
22150 0 : PyObject *allow_remaining_obj = NULL;
22151 0 : bool allow_remaining = false;
22152 :
22153 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
22154 : discard_const_p(char *, kwnames),
22155 : &blob.data, &blob_length,
22156 : &bigendian_obj,
22157 : &ndr64_obj,
22158 : &allow_remaining_obj)) {
22159 0 : return NULL;
22160 : }
22161 0 : blob.length = blob_length;
22162 :
22163 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22164 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
22165 : }
22166 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22167 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
22168 : }
22169 :
22170 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
22171 0 : allow_remaining = true;
22172 : }
22173 :
22174 0 : return py_winreg_OpenHKPN_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
22175 : }
22176 :
22177 0 : static PyObject *py_winreg_OpenHKPN_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22178 : {
22179 : DATA_BLOB blob;
22180 0 : Py_ssize_t blob_length = 0;
22181 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
22182 0 : PyObject *bigendian_obj = NULL;
22183 0 : PyObject *ndr64_obj = NULL;
22184 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
22185 0 : PyObject *allow_remaining_obj = NULL;
22186 0 : bool allow_remaining = false;
22187 :
22188 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
22189 : discard_const_p(char *, kwnames),
22190 : &blob.data, &blob_length,
22191 : &bigendian_obj,
22192 : &ndr64_obj,
22193 : &allow_remaining_obj)) {
22194 0 : return NULL;
22195 : }
22196 0 : blob.length = blob_length;
22197 :
22198 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22199 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
22200 : }
22201 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22202 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
22203 : }
22204 :
22205 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
22206 0 : allow_remaining = true;
22207 : }
22208 :
22209 0 : return py_winreg_OpenHKPN_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
22210 : }
22211 :
22212 0 : static PyObject *py_winreg_OpenHKPN_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
22213 : {
22214 0 : const struct ndr_interface_call *call = NULL;
22215 0 : struct winreg_OpenHKPN *object = (struct winreg_OpenHKPN *)pytalloc_get_ptr(py_obj);
22216 : PyObject *ret;
22217 : char *retstr;
22218 :
22219 0 : if (ndr_table_winreg.num_calls < 34) {
22220 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_OpenHKPN_ndr_print");
22221 0 : return NULL;
22222 : }
22223 0 : call = &ndr_table_winreg.calls[33];
22224 :
22225 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
22226 0 : ret = PyUnicode_FromString(retstr);
22227 0 : TALLOC_FREE(retstr);
22228 :
22229 0 : return ret;
22230 : }
22231 :
22232 0 : static PyObject *py_winreg_OpenHKPN_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
22233 : {
22234 0 : return py_winreg_OpenHKPN_ndr_print(py_obj, "winreg_OpenHKPN_in", NDR_IN);
22235 : }
22236 :
22237 0 : static PyObject *py_winreg_OpenHKPN_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
22238 : {
22239 0 : return py_winreg_OpenHKPN_ndr_print(py_obj, "winreg_OpenHKPN_out", NDR_OUT);
22240 : }
22241 :
22242 : static PyMethodDef py_winreg_OpenHKPN_methods[] = {
22243 : { "opnum", (PyCFunction)py_winreg_OpenHKPN_ndr_opnum, METH_NOARGS|METH_CLASS,
22244 : "winreg.OpenHKPN.opnum() -> 33 (0x21) " },
22245 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
22246 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
22247 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
22248 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
22249 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
22250 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
22251 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_OpenHKPN_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
22252 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
22253 : { "__ndr_print_in__", (PyCFunction)py_winreg_OpenHKPN_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
22254 : { "__ndr_print_out__", (PyCFunction)py_winreg_OpenHKPN_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
22255 : { NULL, NULL, 0, NULL }
22256 : };
22257 :
22258 :
22259 : static PyTypeObject winreg_OpenHKPN_Type = {
22260 : PyVarObject_HEAD_INIT(NULL, 0)
22261 : .tp_name = "winreg.OpenHKPN",
22262 : .tp_getset = py_winreg_OpenHKPN_getsetters,
22263 : .tp_methods = py_winreg_OpenHKPN_methods,
22264 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
22265 : .tp_new = py_winreg_OpenHKPN_new,
22266 : };
22267 :
22268 0 : static bool pack_py_winreg_OpenHKPN_args_in(PyObject *args, PyObject *kwargs, struct winreg_OpenHKPN *r)
22269 : {
22270 : PyObject *py_system_name;
22271 : PyObject *py_access_mask;
22272 0 : const char *kwnames[] = {
22273 : "system_name", "access_mask", NULL
22274 : };
22275 :
22276 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winreg_OpenHKPN", discard_const_p(char *, kwnames), &py_system_name, &py_access_mask)) {
22277 0 : return false;
22278 : }
22279 :
22280 0 : if (py_system_name == NULL) {
22281 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.system_name");
22282 0 : return false;
22283 : }
22284 0 : if (py_system_name == Py_None) {
22285 0 : r->in.system_name = NULL;
22286 : } else {
22287 0 : r->in.system_name = talloc_ptrtype(r, r->in.system_name);
22288 0 : if (r->in.system_name == NULL) {
22289 0 : PyErr_NoMemory();
22290 0 : return false;
22291 : }
22292 : {
22293 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.system_name));
22294 0 : if (PyLong_Check(py_system_name)) {
22295 : unsigned long long test_var;
22296 0 : test_var = PyLong_AsUnsignedLongLong(py_system_name);
22297 0 : if (PyErr_Occurred() != NULL) {
22298 0 : return false;
22299 : }
22300 0 : if (test_var > uint_max) {
22301 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22302 : PyLong_Type.tp_name, uint_max, test_var);
22303 0 : return false;
22304 : }
22305 0 : *r->in.system_name = test_var;
22306 : } else {
22307 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22308 : PyLong_Type.tp_name);
22309 0 : return false;
22310 : }
22311 : }
22312 : }
22313 0 : if (py_access_mask == NULL) {
22314 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
22315 0 : return false;
22316 : }
22317 : {
22318 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
22319 0 : if (PyLong_Check(py_access_mask)) {
22320 : unsigned long long test_var;
22321 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
22322 0 : if (PyErr_Occurred() != NULL) {
22323 0 : return false;
22324 : }
22325 0 : if (test_var > uint_max) {
22326 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22327 : PyLong_Type.tp_name, uint_max, test_var);
22328 0 : return false;
22329 : }
22330 0 : r->in.access_mask = test_var;
22331 : } else {
22332 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22333 : PyLong_Type.tp_name);
22334 0 : return false;
22335 : }
22336 : }
22337 0 : return true;
22338 : }
22339 :
22340 0 : static PyObject *unpack_py_winreg_OpenHKPN_args_out(struct winreg_OpenHKPN *r)
22341 : {
22342 : PyObject *result;
22343 : PyObject *py_handle;
22344 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle);
22345 0 : result = py_handle;
22346 0 : if (!W_ERROR_IS_OK(r->out.result)) {
22347 0 : PyErr_SetWERROR(r->out.result);
22348 0 : return NULL;
22349 : }
22350 :
22351 0 : return result;
22352 : }
22353 :
22354 :
22355 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_key_handle(PyObject *obj, void *closure)
22356 : {
22357 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22358 : PyObject *py_key_handle;
22359 0 : if (object->in.key_handle == NULL) {
22360 0 : Py_RETURN_NONE;
22361 : }
22362 0 : py_key_handle = pytalloc_reference_ex(policy_handle_Type, object->in.key_handle, object->in.key_handle);
22363 0 : return py_key_handle;
22364 : }
22365 :
22366 0 : static int py_winreg_QueryMultipleValues2_in_set_key_handle(PyObject *py_obj, PyObject *value, void *closure)
22367 : {
22368 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22369 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.key_handle));
22370 0 : if (value == NULL) {
22371 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.key_handle");
22372 0 : return -1;
22373 : }
22374 0 : object->in.key_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.key_handle);
22375 0 : if (object->in.key_handle == NULL) {
22376 0 : PyErr_NoMemory();
22377 0 : return -1;
22378 : }
22379 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
22380 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
22381 0 : PyErr_NoMemory();
22382 0 : return -1;
22383 : }
22384 0 : object->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(value);
22385 0 : return 0;
22386 : }
22387 :
22388 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_values_in(PyObject *obj, void *closure)
22389 : {
22390 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22391 : PyObject *py_values_in;
22392 0 : if (object->in.values_in == NULL) {
22393 0 : Py_RETURN_NONE;
22394 : }
22395 0 : py_values_in = PyList_New(object->in.num_values);
22396 0 : if (py_values_in == NULL) {
22397 0 : return NULL;
22398 : }
22399 : {
22400 : int values_in_cntr_1;
22401 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < (object->in.num_values); values_in_cntr_1++) {
22402 : PyObject *py_values_in_1;
22403 0 : py_values_in_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->in.values_in, &object->in.values_in[values_in_cntr_1]);
22404 0 : PyList_SetItem(py_values_in, values_in_cntr_1, py_values_in_1);
22405 : }
22406 : }
22407 0 : return py_values_in;
22408 : }
22409 :
22410 0 : static int py_winreg_QueryMultipleValues2_in_set_values_in(PyObject *py_obj, PyObject *value, void *closure)
22411 : {
22412 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22413 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.values_in));
22414 0 : if (value == NULL) {
22415 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.values_in");
22416 0 : return -1;
22417 : }
22418 0 : object->in.values_in = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in);
22419 0 : if (object->in.values_in == NULL) {
22420 0 : PyErr_NoMemory();
22421 0 : return -1;
22422 : }
22423 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22424 : {
22425 : int values_in_cntr_1;
22426 0 : object->in.values_in = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.values_in, PyList_GET_SIZE(value));
22427 0 : if (!object->in.values_in) { return -1;; }
22428 0 : talloc_set_name_const(object->in.values_in, "ARRAY: object->in.values_in");
22429 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(value); values_in_cntr_1++) {
22430 0 : if (PyList_GET_ITEM(value, values_in_cntr_1) == NULL) {
22431 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.values_in[values_in_cntr_1]");
22432 0 : return -1;
22433 : }
22434 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_in_cntr_1), return -1;);
22435 0 : if (talloc_reference(object->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_in_cntr_1))) == NULL) {
22436 0 : PyErr_NoMemory();
22437 0 : return -1;
22438 : }
22439 0 : object->in.values_in[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_in_cntr_1));
22440 : }
22441 : }
22442 0 : return 0;
22443 : }
22444 :
22445 0 : static PyObject *py_winreg_QueryMultipleValues2_out_get_values_out(PyObject *obj, void *closure)
22446 : {
22447 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22448 : PyObject *py_values_out;
22449 0 : if (object->out.values_out == NULL) {
22450 0 : Py_RETURN_NONE;
22451 : }
22452 0 : py_values_out = PyList_New(object->in.num_values);
22453 0 : if (py_values_out == NULL) {
22454 0 : return NULL;
22455 : }
22456 : {
22457 : int values_out_cntr_1;
22458 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (object->in.num_values); values_out_cntr_1++) {
22459 : PyObject *py_values_out_1;
22460 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, object->out.values_out, &object->out.values_out[values_out_cntr_1]);
22461 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
22462 : }
22463 : }
22464 0 : return py_values_out;
22465 : }
22466 :
22467 0 : static int py_winreg_QueryMultipleValues2_out_set_values_out(PyObject *py_obj, PyObject *value, void *closure)
22468 : {
22469 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22470 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.values_out));
22471 0 : if (value == NULL) {
22472 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.values_out");
22473 0 : return -1;
22474 : }
22475 0 : object->out.values_out = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out);
22476 0 : if (object->out.values_out == NULL) {
22477 0 : PyErr_NoMemory();
22478 0 : return -1;
22479 : }
22480 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22481 : {
22482 : int values_out_cntr_1;
22483 0 : object->out.values_out = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.values_out, PyList_GET_SIZE(value));
22484 0 : if (!object->out.values_out) { return -1;; }
22485 0 : talloc_set_name_const(object->out.values_out, "ARRAY: object->out.values_out");
22486 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < PyList_GET_SIZE(value); values_out_cntr_1++) {
22487 0 : if (PyList_GET_ITEM(value, values_out_cntr_1) == NULL) {
22488 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.values_out[values_out_cntr_1]");
22489 0 : return -1;
22490 : }
22491 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(value, values_out_cntr_1), return -1;);
22492 0 : if (talloc_reference(object->out.values_out, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, values_out_cntr_1))) == NULL) {
22493 0 : PyErr_NoMemory();
22494 0 : return -1;
22495 : }
22496 0 : object->out.values_out[values_out_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(value, values_out_cntr_1));
22497 : }
22498 : }
22499 0 : return 0;
22500 : }
22501 :
22502 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_num_values(PyObject *obj, void *closure)
22503 : {
22504 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22505 : PyObject *py_num_values;
22506 0 : py_num_values = PyLong_FromUnsignedLongLong((uint32_t)object->in.num_values);
22507 0 : return py_num_values;
22508 : }
22509 :
22510 0 : static int py_winreg_QueryMultipleValues2_in_set_num_values(PyObject *py_obj, PyObject *value, void *closure)
22511 : {
22512 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22513 0 : if (value == NULL) {
22514 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.num_values");
22515 0 : return -1;
22516 : }
22517 : {
22518 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.num_values));
22519 0 : if (PyLong_Check(value)) {
22520 : unsigned long long test_var;
22521 0 : test_var = PyLong_AsUnsignedLongLong(value);
22522 0 : if (PyErr_Occurred() != NULL) {
22523 0 : return -1;
22524 : }
22525 0 : if (test_var > uint_max) {
22526 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22527 : PyLong_Type.tp_name, uint_max, test_var);
22528 0 : return -1;
22529 : }
22530 0 : object->in.num_values = test_var;
22531 : } else {
22532 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22533 : PyLong_Type.tp_name);
22534 0 : return -1;
22535 : }
22536 : }
22537 0 : return 0;
22538 : }
22539 :
22540 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_buffer(PyObject *obj, void *closure)
22541 : {
22542 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22543 : PyObject *py_buffer;
22544 0 : if (object->in.buffer == NULL) {
22545 0 : Py_RETURN_NONE;
22546 : }
22547 0 : if (object->in.buffer == NULL) {
22548 0 : py_buffer = Py_None;
22549 0 : Py_INCREF(py_buffer);
22550 : } else {
22551 0 : py_buffer = PyList_New(*object->in.offered);
22552 0 : if (py_buffer == NULL) {
22553 0 : return NULL;
22554 : }
22555 : {
22556 : int buffer_cntr_1;
22557 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->in.offered); buffer_cntr_1++) {
22558 : PyObject *py_buffer_1;
22559 0 : py_buffer_1 = PyLong_FromLong((uint16_t)object->in.buffer[buffer_cntr_1]);
22560 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
22561 : }
22562 : }
22563 : }
22564 0 : return py_buffer;
22565 : }
22566 :
22567 0 : static int py_winreg_QueryMultipleValues2_in_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
22568 : {
22569 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22570 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer));
22571 0 : if (value == NULL) {
22572 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer");
22573 0 : return -1;
22574 : }
22575 0 : if (value == Py_None) {
22576 0 : object->in.buffer = NULL;
22577 : } else {
22578 0 : object->in.buffer = NULL;
22579 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22580 : {
22581 : int buffer_cntr_1;
22582 0 : object->in.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer, PyList_GET_SIZE(value));
22583 0 : if (!object->in.buffer) { return -1;; }
22584 0 : talloc_set_name_const(object->in.buffer, "ARRAY: object->in.buffer");
22585 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
22586 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
22587 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer[buffer_cntr_1]");
22588 0 : return -1;
22589 : }
22590 : {
22591 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.buffer[buffer_cntr_1]));
22592 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
22593 : unsigned long long test_var;
22594 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
22595 0 : if (PyErr_Occurred() != NULL) {
22596 0 : return -1;
22597 : }
22598 0 : if (test_var > uint_max) {
22599 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22600 : PyLong_Type.tp_name, uint_max, test_var);
22601 0 : return -1;
22602 : }
22603 0 : object->in.buffer[buffer_cntr_1] = test_var;
22604 : } else {
22605 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22606 : PyLong_Type.tp_name);
22607 0 : return -1;
22608 : }
22609 : }
22610 : }
22611 : }
22612 : }
22613 0 : return 0;
22614 : }
22615 :
22616 0 : static PyObject *py_winreg_QueryMultipleValues2_out_get_buffer(PyObject *obj, void *closure)
22617 : {
22618 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22619 : PyObject *py_buffer;
22620 0 : if (object->out.buffer == NULL) {
22621 0 : Py_RETURN_NONE;
22622 : }
22623 0 : if (object->out.buffer == NULL) {
22624 0 : py_buffer = Py_None;
22625 0 : Py_INCREF(py_buffer);
22626 : } else {
22627 0 : py_buffer = PyList_New(*object->in.offered);
22628 0 : if (py_buffer == NULL) {
22629 0 : return NULL;
22630 : }
22631 : {
22632 : int buffer_cntr_1;
22633 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->in.offered); buffer_cntr_1++) {
22634 : PyObject *py_buffer_1;
22635 0 : py_buffer_1 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_1]);
22636 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
22637 : }
22638 : }
22639 : }
22640 0 : return py_buffer;
22641 : }
22642 :
22643 0 : static int py_winreg_QueryMultipleValues2_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure)
22644 : {
22645 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22646 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer));
22647 0 : if (value == NULL) {
22648 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer");
22649 0 : return -1;
22650 : }
22651 0 : if (value == Py_None) {
22652 0 : object->out.buffer = NULL;
22653 : } else {
22654 0 : object->out.buffer = NULL;
22655 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
22656 : {
22657 : int buffer_cntr_1;
22658 0 : object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value));
22659 0 : if (!object->out.buffer) { return -1;; }
22660 0 : talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer");
22661 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) {
22662 0 : if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) {
22663 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_1]");
22664 0 : return -1;
22665 : }
22666 : {
22667 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_1]));
22668 0 : if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) {
22669 : unsigned long long test_var;
22670 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1));
22671 0 : if (PyErr_Occurred() != NULL) {
22672 0 : return -1;
22673 : }
22674 0 : if (test_var > uint_max) {
22675 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22676 : PyLong_Type.tp_name, uint_max, test_var);
22677 0 : return -1;
22678 : }
22679 0 : object->out.buffer[buffer_cntr_1] = test_var;
22680 : } else {
22681 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22682 : PyLong_Type.tp_name);
22683 0 : return -1;
22684 : }
22685 : }
22686 : }
22687 : }
22688 : }
22689 0 : return 0;
22690 : }
22691 :
22692 0 : static PyObject *py_winreg_QueryMultipleValues2_in_get_offered(PyObject *obj, void *closure)
22693 : {
22694 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22695 : PyObject *py_offered;
22696 0 : if (object->in.offered == NULL) {
22697 0 : Py_RETURN_NONE;
22698 : }
22699 0 : py_offered = PyLong_FromUnsignedLongLong((uint32_t)*object->in.offered);
22700 0 : return py_offered;
22701 : }
22702 :
22703 0 : static int py_winreg_QueryMultipleValues2_in_set_offered(PyObject *py_obj, PyObject *value, void *closure)
22704 : {
22705 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22706 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.offered));
22707 0 : if (value == NULL) {
22708 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered");
22709 0 : return -1;
22710 : }
22711 0 : object->in.offered = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.offered);
22712 0 : if (object->in.offered == NULL) {
22713 0 : PyErr_NoMemory();
22714 0 : return -1;
22715 : }
22716 : {
22717 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.offered));
22718 0 : if (PyLong_Check(value)) {
22719 : unsigned long long test_var;
22720 0 : test_var = PyLong_AsUnsignedLongLong(value);
22721 0 : if (PyErr_Occurred() != NULL) {
22722 0 : return -1;
22723 : }
22724 0 : if (test_var > uint_max) {
22725 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22726 : PyLong_Type.tp_name, uint_max, test_var);
22727 0 : return -1;
22728 : }
22729 0 : *object->in.offered = test_var;
22730 : } else {
22731 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22732 : PyLong_Type.tp_name);
22733 0 : return -1;
22734 : }
22735 : }
22736 0 : return 0;
22737 : }
22738 :
22739 0 : static PyObject *py_winreg_QueryMultipleValues2_out_get_needed(PyObject *obj, void *closure)
22740 : {
22741 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22742 : PyObject *py_needed;
22743 0 : if (object->out.needed == NULL) {
22744 0 : Py_RETURN_NONE;
22745 : }
22746 0 : py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed);
22747 0 : return py_needed;
22748 : }
22749 :
22750 0 : static int py_winreg_QueryMultipleValues2_out_set_needed(PyObject *py_obj, PyObject *value, void *closure)
22751 : {
22752 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22753 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed));
22754 0 : if (value == NULL) {
22755 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed");
22756 0 : return -1;
22757 : }
22758 0 : object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed);
22759 0 : if (object->out.needed == NULL) {
22760 0 : PyErr_NoMemory();
22761 0 : return -1;
22762 : }
22763 : {
22764 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed));
22765 0 : if (PyLong_Check(value)) {
22766 : unsigned long long test_var;
22767 0 : test_var = PyLong_AsUnsignedLongLong(value);
22768 0 : if (PyErr_Occurred() != NULL) {
22769 0 : return -1;
22770 : }
22771 0 : if (test_var > uint_max) {
22772 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
22773 : PyLong_Type.tp_name, uint_max, test_var);
22774 0 : return -1;
22775 : }
22776 0 : *object->out.needed = test_var;
22777 : } else {
22778 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
22779 : PyLong_Type.tp_name);
22780 0 : return -1;
22781 : }
22782 : }
22783 0 : return 0;
22784 : }
22785 :
22786 0 : static PyObject *py_winreg_QueryMultipleValues2_get_result(PyObject *obj, void *closure)
22787 : {
22788 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(obj);
22789 : PyObject *py_result;
22790 0 : py_result = PyErr_FromWERROR(object->out.result);
22791 0 : return py_result;
22792 : }
22793 :
22794 0 : static int py_winreg_QueryMultipleValues2_set_result(PyObject *py_obj, PyObject *value, void *closure)
22795 : {
22796 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22797 0 : if (value == NULL) {
22798 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
22799 0 : return -1;
22800 : }
22801 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
22802 0 : return 0;
22803 : }
22804 :
22805 : static PyGetSetDef py_winreg_QueryMultipleValues2_getsetters[] = {
22806 : {
22807 : .name = discard_const_p(char, "in_key_handle"),
22808 : .get = py_winreg_QueryMultipleValues2_in_get_key_handle,
22809 : .set = py_winreg_QueryMultipleValues2_in_set_key_handle,
22810 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
22811 : },
22812 : {
22813 : .name = discard_const_p(char, "in_values_in"),
22814 : .get = py_winreg_QueryMultipleValues2_in_get_values_in,
22815 : .set = py_winreg_QueryMultipleValues2_in_set_values_in,
22816 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
22817 : },
22818 : {
22819 : .name = discard_const_p(char, "out_values_out"),
22820 : .get = py_winreg_QueryMultipleValues2_out_get_values_out,
22821 : .set = py_winreg_QueryMultipleValues2_out_set_values_out,
22822 : .doc = discard_const_p(char, "PIDL-generated element of base type QueryMultipleValue")
22823 : },
22824 : {
22825 : .name = discard_const_p(char, "in_num_values"),
22826 : .get = py_winreg_QueryMultipleValues2_in_get_num_values,
22827 : .set = py_winreg_QueryMultipleValues2_in_set_num_values,
22828 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
22829 : },
22830 : {
22831 : .name = discard_const_p(char, "in_buffer"),
22832 : .get = py_winreg_QueryMultipleValues2_in_get_buffer,
22833 : .set = py_winreg_QueryMultipleValues2_in_set_buffer,
22834 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
22835 : },
22836 : {
22837 : .name = discard_const_p(char, "out_buffer"),
22838 : .get = py_winreg_QueryMultipleValues2_out_get_buffer,
22839 : .set = py_winreg_QueryMultipleValues2_out_set_buffer,
22840 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
22841 : },
22842 : {
22843 : .name = discard_const_p(char, "in_offered"),
22844 : .get = py_winreg_QueryMultipleValues2_in_get_offered,
22845 : .set = py_winreg_QueryMultipleValues2_in_set_offered,
22846 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
22847 : },
22848 : {
22849 : .name = discard_const_p(char, "out_needed"),
22850 : .get = py_winreg_QueryMultipleValues2_out_get_needed,
22851 : .set = py_winreg_QueryMultipleValues2_out_set_needed,
22852 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
22853 : },
22854 : {
22855 : .name = discard_const_p(char, "result"),
22856 : .get = py_winreg_QueryMultipleValues2_get_result,
22857 : .set = py_winreg_QueryMultipleValues2_set_result,
22858 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
22859 : },
22860 : { .name = NULL }
22861 : };
22862 :
22863 0 : static PyObject *py_winreg_QueryMultipleValues2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
22864 : {
22865 0 : PyObject *self = pytalloc_new(struct winreg_QueryMultipleValues2, type);
22866 0 : struct winreg_QueryMultipleValues2 *_self = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(self);
22867 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
22868 0 : _self->in.key_handle = talloc_zero(mem_ctx, struct policy_handle);
22869 0 : _self->in.values_in = talloc_zero(mem_ctx, struct QueryMultipleValue);
22870 0 : _self->out.values_out = talloc_zero(mem_ctx, struct QueryMultipleValue);
22871 0 : _self->in.offered = talloc_zero(mem_ctx, uint32_t);
22872 0 : _self->out.needed = talloc_zero(mem_ctx, uint32_t);
22873 0 : return self;
22874 : }
22875 :
22876 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
22877 : {
22878 :
22879 :
22880 0 : return PyLong_FromLong(34);
22881 : }
22882 :
22883 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
22884 : {
22885 0 : const struct ndr_interface_call *call = NULL;
22886 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22887 0 : PyObject *ret = NULL;
22888 0 : struct ndr_push *push = NULL;
22889 : DATA_BLOB blob;
22890 : enum ndr_err_code err;
22891 :
22892 0 : if (ndr_table_winreg.num_calls < 35) {
22893 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues2_ndr_pack");
22894 0 : return NULL;
22895 : }
22896 0 : call = &ndr_table_winreg.calls[34];
22897 :
22898 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
22899 0 : if (push == NULL) {
22900 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22901 0 : return NULL;
22902 : }
22903 :
22904 0 : push->flags |= ndr_push_flags;
22905 :
22906 0 : err = call->ndr_push(push, ndr_inout_flags, object);
22907 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22908 0 : TALLOC_FREE(push);
22909 0 : PyErr_SetNdrError(err);
22910 0 : return NULL;
22911 : }
22912 0 : blob = ndr_push_blob(push);
22913 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
22914 0 : TALLOC_FREE(push);
22915 0 : return ret;
22916 : }
22917 :
22918 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22919 : {
22920 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22921 0 : PyObject *bigendian_obj = NULL;
22922 0 : PyObject *ndr64_obj = NULL;
22923 0 : uint32_t ndr_push_flags = 0;
22924 :
22925 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
22926 : discard_const_p(char *, kwnames),
22927 : &bigendian_obj,
22928 : &ndr64_obj)) {
22929 0 : return NULL;
22930 : }
22931 :
22932 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22933 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22934 : }
22935 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22936 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22937 : }
22938 :
22939 0 : return py_winreg_QueryMultipleValues2_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
22940 : }
22941 :
22942 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
22943 : {
22944 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
22945 0 : PyObject *bigendian_obj = NULL;
22946 0 : PyObject *ndr64_obj = NULL;
22947 0 : uint32_t ndr_push_flags = 0;
22948 :
22949 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
22950 : discard_const_p(char *, kwnames),
22951 : &bigendian_obj,
22952 : &ndr64_obj)) {
22953 0 : return NULL;
22954 : }
22955 :
22956 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
22957 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
22958 : }
22959 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
22960 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
22961 : }
22962 :
22963 0 : return py_winreg_QueryMultipleValues2_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
22964 : }
22965 :
22966 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
22967 : {
22968 0 : const struct ndr_interface_call *call = NULL;
22969 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
22970 0 : struct ndr_pull *pull = NULL;
22971 : enum ndr_err_code err;
22972 :
22973 0 : if (ndr_table_winreg.num_calls < 35) {
22974 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues2_ndr_unpack");
22975 0 : return NULL;
22976 : }
22977 0 : call = &ndr_table_winreg.calls[34];
22978 :
22979 0 : pull = ndr_pull_init_blob(blob, object);
22980 0 : if (pull == NULL) {
22981 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
22982 0 : return NULL;
22983 : }
22984 :
22985 0 : pull->flags |= ndr_pull_flags;
22986 :
22987 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
22988 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
22989 0 : TALLOC_FREE(pull);
22990 0 : PyErr_SetNdrError(err);
22991 0 : return NULL;
22992 : }
22993 0 : if (!allow_remaining) {
22994 : uint32_t highest_ofs;
22995 :
22996 0 : if (pull->offset > pull->relative_highest_offset) {
22997 0 : highest_ofs = pull->offset;
22998 : } else {
22999 0 : highest_ofs = pull->relative_highest_offset;
23000 : }
23001 0 : if (highest_ofs < pull->data_size) {
23002 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
23003 : "not all bytes consumed ofs[%u] size[%u]",
23004 : highest_ofs, pull->data_size);
23005 0 : TALLOC_FREE(pull);
23006 0 : PyErr_SetNdrError(err);
23007 0 : return NULL;
23008 : }
23009 : }
23010 :
23011 0 : TALLOC_FREE(pull);
23012 0 : Py_RETURN_NONE;
23013 : }
23014 :
23015 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23016 : {
23017 : DATA_BLOB blob;
23018 0 : Py_ssize_t blob_length = 0;
23019 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23020 0 : PyObject *bigendian_obj = NULL;
23021 0 : PyObject *ndr64_obj = NULL;
23022 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23023 0 : PyObject *allow_remaining_obj = NULL;
23024 0 : bool allow_remaining = false;
23025 :
23026 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
23027 : discard_const_p(char *, kwnames),
23028 : &blob.data, &blob_length,
23029 : &bigendian_obj,
23030 : &ndr64_obj,
23031 : &allow_remaining_obj)) {
23032 0 : return NULL;
23033 : }
23034 0 : blob.length = blob_length;
23035 :
23036 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23037 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23038 : }
23039 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23040 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23041 : }
23042 :
23043 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23044 0 : allow_remaining = true;
23045 : }
23046 :
23047 0 : return py_winreg_QueryMultipleValues2_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
23048 : }
23049 :
23050 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23051 : {
23052 : DATA_BLOB blob;
23053 0 : Py_ssize_t blob_length = 0;
23054 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23055 0 : PyObject *bigendian_obj = NULL;
23056 0 : PyObject *ndr64_obj = NULL;
23057 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23058 0 : PyObject *allow_remaining_obj = NULL;
23059 0 : bool allow_remaining = false;
23060 :
23061 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
23062 : discard_const_p(char *, kwnames),
23063 : &blob.data, &blob_length,
23064 : &bigendian_obj,
23065 : &ndr64_obj,
23066 : &allow_remaining_obj)) {
23067 0 : return NULL;
23068 : }
23069 0 : blob.length = blob_length;
23070 :
23071 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23072 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23073 : }
23074 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23075 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23076 : }
23077 :
23078 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23079 0 : allow_remaining = true;
23080 : }
23081 :
23082 0 : return py_winreg_QueryMultipleValues2_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
23083 : }
23084 :
23085 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
23086 : {
23087 0 : const struct ndr_interface_call *call = NULL;
23088 0 : struct winreg_QueryMultipleValues2 *object = (struct winreg_QueryMultipleValues2 *)pytalloc_get_ptr(py_obj);
23089 : PyObject *ret;
23090 : char *retstr;
23091 :
23092 0 : if (ndr_table_winreg.num_calls < 35) {
23093 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_QueryMultipleValues2_ndr_print");
23094 0 : return NULL;
23095 : }
23096 0 : call = &ndr_table_winreg.calls[34];
23097 :
23098 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
23099 0 : ret = PyUnicode_FromString(retstr);
23100 0 : TALLOC_FREE(retstr);
23101 :
23102 0 : return ret;
23103 : }
23104 :
23105 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23106 : {
23107 0 : return py_winreg_QueryMultipleValues2_ndr_print(py_obj, "winreg_QueryMultipleValues2_in", NDR_IN);
23108 : }
23109 :
23110 0 : static PyObject *py_winreg_QueryMultipleValues2_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23111 : {
23112 0 : return py_winreg_QueryMultipleValues2_ndr_print(py_obj, "winreg_QueryMultipleValues2_out", NDR_OUT);
23113 : }
23114 :
23115 : static PyMethodDef py_winreg_QueryMultipleValues2_methods[] = {
23116 : { "opnum", (PyCFunction)py_winreg_QueryMultipleValues2_ndr_opnum, METH_NOARGS|METH_CLASS,
23117 : "winreg.QueryMultipleValues2.opnum() -> 34 (0x22) " },
23118 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
23119 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
23120 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
23121 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
23122 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
23123 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
23124 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_QueryMultipleValues2_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
23125 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
23126 : { "__ndr_print_in__", (PyCFunction)py_winreg_QueryMultipleValues2_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
23127 : { "__ndr_print_out__", (PyCFunction)py_winreg_QueryMultipleValues2_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
23128 : { NULL, NULL, 0, NULL }
23129 : };
23130 :
23131 :
23132 : static PyTypeObject winreg_QueryMultipleValues2_Type = {
23133 : PyVarObject_HEAD_INIT(NULL, 0)
23134 : .tp_name = "winreg.QueryMultipleValues2",
23135 : .tp_getset = py_winreg_QueryMultipleValues2_getsetters,
23136 : .tp_methods = py_winreg_QueryMultipleValues2_methods,
23137 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23138 : .tp_new = py_winreg_QueryMultipleValues2_new,
23139 : };
23140 :
23141 0 : static bool pack_py_winreg_QueryMultipleValues2_args_in(PyObject *args, PyObject *kwargs, struct winreg_QueryMultipleValues2 *r)
23142 : {
23143 : PyObject *py_key_handle;
23144 : PyObject *py_values_in;
23145 : PyObject *py_buffer;
23146 0 : const char *kwnames[] = {
23147 : "key_handle", "values_in", "buffer", NULL
23148 : };
23149 :
23150 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winreg_QueryMultipleValues2", discard_const_p(char *, kwnames), &py_key_handle, &py_values_in, &py_buffer)) {
23151 0 : return false;
23152 : }
23153 :
23154 0 : if (py_key_handle == NULL) {
23155 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.key_handle");
23156 0 : return false;
23157 : }
23158 0 : r->in.key_handle = talloc_ptrtype(r, r->in.key_handle);
23159 0 : if (r->in.key_handle == NULL) {
23160 0 : PyErr_NoMemory();
23161 0 : return false;
23162 : }
23163 0 : PY_CHECK_TYPE(policy_handle_Type, py_key_handle, return false;);
23164 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key_handle)) == NULL) {
23165 0 : PyErr_NoMemory();
23166 0 : return false;
23167 : }
23168 0 : r->in.key_handle = (struct policy_handle *)pytalloc_get_ptr(py_key_handle);
23169 0 : if (py_values_in == NULL) {
23170 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.values_in");
23171 0 : return false;
23172 : }
23173 0 : r->in.values_in = talloc_ptrtype(r, r->in.values_in);
23174 0 : if (r->in.values_in == NULL) {
23175 0 : PyErr_NoMemory();
23176 0 : return false;
23177 : }
23178 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
23179 : {
23180 : int values_in_cntr_1;
23181 0 : r->in.values_in = talloc_array_ptrtype(r, r->in.values_in, PyList_GET_SIZE(py_values_in));
23182 0 : if (!r->in.values_in) { return false;; }
23183 0 : talloc_set_name_const(r->in.values_in, "ARRAY: r->in.values_in");
23184 0 : for (values_in_cntr_1 = 0; values_in_cntr_1 < PyList_GET_SIZE(py_values_in); values_in_cntr_1++) {
23185 0 : if (PyList_GET_ITEM(py_values_in, values_in_cntr_1) == NULL) {
23186 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.values_in[values_in_cntr_1]");
23187 0 : return false;
23188 : }
23189 0 : PY_CHECK_TYPE(&QueryMultipleValue_Type, PyList_GET_ITEM(py_values_in, values_in_cntr_1), return false;);
23190 0 : if (talloc_reference(r->in.values_in, pytalloc_get_mem_ctx(PyList_GET_ITEM(py_values_in, values_in_cntr_1))) == NULL) {
23191 0 : PyErr_NoMemory();
23192 0 : return false;
23193 : }
23194 0 : r->in.values_in[values_in_cntr_1] = *(struct QueryMultipleValue *)pytalloc_get_ptr(PyList_GET_ITEM(py_values_in, values_in_cntr_1));
23195 : }
23196 : }
23197 0 : PY_CHECK_TYPE(&PyList_Type, py_values_in, return false;);
23198 0 : r->in.num_values = PyList_GET_SIZE(py_values_in);
23199 0 : if (py_buffer == NULL) {
23200 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.buffer");
23201 0 : return false;
23202 : }
23203 0 : if (py_buffer == Py_None) {
23204 0 : r->in.buffer = NULL;
23205 : } else {
23206 0 : r->in.buffer = NULL;
23207 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
23208 : {
23209 : int buffer_cntr_1;
23210 0 : r->in.buffer = talloc_array_ptrtype(r, r->in.buffer, PyList_GET_SIZE(py_buffer));
23211 0 : if (!r->in.buffer) { return false;; }
23212 0 : talloc_set_name_const(r->in.buffer, "ARRAY: r->in.buffer");
23213 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(py_buffer); buffer_cntr_1++) {
23214 0 : if (PyList_GET_ITEM(py_buffer, buffer_cntr_1) == NULL) {
23215 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.buffer[buffer_cntr_1]");
23216 0 : return false;
23217 : }
23218 : {
23219 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.buffer[buffer_cntr_1]));
23220 0 : if (PyLong_Check(PyList_GET_ITEM(py_buffer, buffer_cntr_1))) {
23221 : unsigned long long test_var;
23222 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_buffer, buffer_cntr_1));
23223 0 : if (PyErr_Occurred() != NULL) {
23224 0 : return false;
23225 : }
23226 0 : if (test_var > uint_max) {
23227 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23228 : PyLong_Type.tp_name, uint_max, test_var);
23229 0 : return false;
23230 : }
23231 0 : r->in.buffer[buffer_cntr_1] = test_var;
23232 : } else {
23233 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23234 : PyLong_Type.tp_name);
23235 0 : return false;
23236 : }
23237 : }
23238 : }
23239 : }
23240 : }
23241 0 : PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;);
23242 0 : r->in.offered = talloc_ptrtype(r, r->in.offered);
23243 0 : if (r->in.offered == NULL) {
23244 0 : PyErr_NoMemory();
23245 0 : return false;
23246 : }
23247 0 : *r->in.offered = PyList_GET_SIZE(py_buffer);
23248 0 : return true;
23249 : }
23250 :
23251 0 : static PyObject *unpack_py_winreg_QueryMultipleValues2_args_out(struct winreg_QueryMultipleValues2 *r)
23252 : {
23253 : PyObject *result;
23254 : PyObject *py_values_out;
23255 : PyObject *py_buffer;
23256 : PyObject *py_needed;
23257 0 : result = PyTuple_New(3);
23258 0 : py_values_out = PyList_New(r->in.num_values);
23259 0 : if (py_values_out == NULL) {
23260 0 : return NULL;
23261 : }
23262 : {
23263 : int values_out_cntr_1;
23264 0 : for (values_out_cntr_1 = 0; values_out_cntr_1 < (r->in.num_values); values_out_cntr_1++) {
23265 : PyObject *py_values_out_1;
23266 0 : py_values_out_1 = pytalloc_reference_ex(&QueryMultipleValue_Type, r->out.values_out, &r->out.values_out[values_out_cntr_1]);
23267 0 : PyList_SetItem(py_values_out, values_out_cntr_1, py_values_out_1);
23268 : }
23269 : }
23270 0 : PyTuple_SetItem(result, 0, py_values_out);
23271 0 : if (r->out.buffer == NULL) {
23272 0 : py_buffer = Py_None;
23273 0 : Py_INCREF(py_buffer);
23274 : } else {
23275 0 : py_buffer = PyList_New(*r->in.offered);
23276 0 : if (py_buffer == NULL) {
23277 0 : return NULL;
23278 : }
23279 : {
23280 : int buffer_cntr_1;
23281 0 : for (buffer_cntr_1 = 0; buffer_cntr_1 < (*r->in.offered); buffer_cntr_1++) {
23282 : PyObject *py_buffer_1;
23283 0 : py_buffer_1 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_1]);
23284 0 : PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
23285 : }
23286 : }
23287 : }
23288 0 : PyTuple_SetItem(result, 1, py_buffer);
23289 0 : py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed);
23290 0 : PyTuple_SetItem(result, 2, py_needed);
23291 0 : if (!W_ERROR_IS_OK(r->out.result)) {
23292 0 : PyErr_SetWERROR(r->out.result);
23293 0 : return NULL;
23294 : }
23295 :
23296 0 : return result;
23297 : }
23298 :
23299 :
23300 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_handle(PyObject *obj, void *closure)
23301 : {
23302 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(obj);
23303 : PyObject *py_handle;
23304 0 : if (object->in.handle == NULL) {
23305 0 : Py_RETURN_NONE;
23306 : }
23307 0 : py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle);
23308 0 : return py_handle;
23309 : }
23310 :
23311 0 : static int py_winreg_DeleteKeyEx_in_set_handle(PyObject *py_obj, PyObject *value, void *closure)
23312 : {
23313 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23314 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle));
23315 0 : if (value == NULL) {
23316 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle");
23317 0 : return -1;
23318 : }
23319 0 : object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle);
23320 0 : if (object->in.handle == NULL) {
23321 0 : PyErr_NoMemory();
23322 0 : return -1;
23323 : }
23324 0 : PY_CHECK_TYPE(policy_handle_Type, value, return -1;);
23325 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
23326 0 : PyErr_NoMemory();
23327 0 : return -1;
23328 : }
23329 0 : object->in.handle = (struct policy_handle *)pytalloc_get_ptr(value);
23330 0 : return 0;
23331 : }
23332 :
23333 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_key(PyObject *obj, void *closure)
23334 : {
23335 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(obj);
23336 : PyObject *py_key;
23337 0 : if (object->in.key == NULL) {
23338 0 : Py_RETURN_NONE;
23339 : }
23340 0 : py_key = pytalloc_reference_ex(&winreg_String_Type, object->in.key, object->in.key);
23341 0 : return py_key;
23342 : }
23343 :
23344 0 : static int py_winreg_DeleteKeyEx_in_set_key(PyObject *py_obj, PyObject *value, void *closure)
23345 : {
23346 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23347 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.key));
23348 0 : if (value == NULL) {
23349 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.key");
23350 0 : return -1;
23351 : }
23352 0 : object->in.key = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.key);
23353 0 : if (object->in.key == NULL) {
23354 0 : PyErr_NoMemory();
23355 0 : return -1;
23356 : }
23357 0 : PY_CHECK_TYPE(&winreg_String_Type, value, return -1;);
23358 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
23359 0 : PyErr_NoMemory();
23360 0 : return -1;
23361 : }
23362 0 : object->in.key = (struct winreg_String *)pytalloc_get_ptr(value);
23363 0 : return 0;
23364 : }
23365 :
23366 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_access_mask(PyObject *obj, void *closure)
23367 : {
23368 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(obj);
23369 : PyObject *py_access_mask;
23370 0 : py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask);
23371 0 : return py_access_mask;
23372 : }
23373 :
23374 0 : static int py_winreg_DeleteKeyEx_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
23375 : {
23376 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23377 0 : if (value == NULL) {
23378 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask");
23379 0 : return -1;
23380 : }
23381 : {
23382 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask));
23383 0 : if (PyLong_Check(value)) {
23384 : unsigned long long test_var;
23385 0 : test_var = PyLong_AsUnsignedLongLong(value);
23386 0 : if (PyErr_Occurred() != NULL) {
23387 0 : return -1;
23388 : }
23389 0 : if (test_var > uint_max) {
23390 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23391 : PyLong_Type.tp_name, uint_max, test_var);
23392 0 : return -1;
23393 : }
23394 0 : object->in.access_mask = test_var;
23395 : } else {
23396 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23397 : PyLong_Type.tp_name);
23398 0 : return -1;
23399 : }
23400 : }
23401 0 : return 0;
23402 : }
23403 :
23404 0 : static PyObject *py_winreg_DeleteKeyEx_in_get_reserved(PyObject *obj, void *closure)
23405 : {
23406 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(obj);
23407 : PyObject *py_reserved;
23408 0 : py_reserved = PyLong_FromUnsignedLongLong((uint32_t)object->in.reserved);
23409 0 : return py_reserved;
23410 : }
23411 :
23412 0 : static int py_winreg_DeleteKeyEx_in_set_reserved(PyObject *py_obj, PyObject *value, void *closure)
23413 : {
23414 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23415 0 : if (value == NULL) {
23416 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.reserved");
23417 0 : return -1;
23418 : }
23419 : {
23420 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.reserved));
23421 0 : if (PyLong_Check(value)) {
23422 : unsigned long long test_var;
23423 0 : test_var = PyLong_AsUnsignedLongLong(value);
23424 0 : if (PyErr_Occurred() != NULL) {
23425 0 : return -1;
23426 : }
23427 0 : if (test_var > uint_max) {
23428 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23429 : PyLong_Type.tp_name, uint_max, test_var);
23430 0 : return -1;
23431 : }
23432 0 : object->in.reserved = test_var;
23433 : } else {
23434 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23435 : PyLong_Type.tp_name);
23436 0 : return -1;
23437 : }
23438 : }
23439 0 : return 0;
23440 : }
23441 :
23442 0 : static PyObject *py_winreg_DeleteKeyEx_get_result(PyObject *obj, void *closure)
23443 : {
23444 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(obj);
23445 : PyObject *py_result;
23446 0 : py_result = PyErr_FromWERROR(object->out.result);
23447 0 : return py_result;
23448 : }
23449 :
23450 0 : static int py_winreg_DeleteKeyEx_set_result(PyObject *py_obj, PyObject *value, void *closure)
23451 : {
23452 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23453 0 : if (value == NULL) {
23454 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
23455 0 : return -1;
23456 : }
23457 0 : object->out.result = W_ERROR(PyLong_AsLong(value));
23458 0 : return 0;
23459 : }
23460 :
23461 : static PyGetSetDef py_winreg_DeleteKeyEx_getsetters[] = {
23462 : {
23463 : .name = discard_const_p(char, "in_handle"),
23464 : .get = py_winreg_DeleteKeyEx_in_get_handle,
23465 : .set = py_winreg_DeleteKeyEx_in_set_handle,
23466 : .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle")
23467 : },
23468 : {
23469 : .name = discard_const_p(char, "in_key"),
23470 : .get = py_winreg_DeleteKeyEx_in_get_key,
23471 : .set = py_winreg_DeleteKeyEx_in_set_key,
23472 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_String")
23473 : },
23474 : {
23475 : .name = discard_const_p(char, "in_access_mask"),
23476 : .get = py_winreg_DeleteKeyEx_in_get_access_mask,
23477 : .set = py_winreg_DeleteKeyEx_in_set_access_mask,
23478 : .doc = discard_const_p(char, "PIDL-generated element of base type winreg_AccessMask")
23479 : },
23480 : {
23481 : .name = discard_const_p(char, "in_reserved"),
23482 : .get = py_winreg_DeleteKeyEx_in_get_reserved,
23483 : .set = py_winreg_DeleteKeyEx_in_set_reserved,
23484 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
23485 : },
23486 : {
23487 : .name = discard_const_p(char, "result"),
23488 : .get = py_winreg_DeleteKeyEx_get_result,
23489 : .set = py_winreg_DeleteKeyEx_set_result,
23490 : .doc = discard_const_p(char, "PIDL-generated element of type WERROR")
23491 : },
23492 : { .name = NULL }
23493 : };
23494 :
23495 0 : static PyObject *py_winreg_DeleteKeyEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23496 : {
23497 0 : PyObject *self = pytalloc_new(struct winreg_DeleteKeyEx, type);
23498 0 : struct winreg_DeleteKeyEx *_self = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(self);
23499 0 : TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
23500 0 : _self->in.handle = talloc_zero(mem_ctx, struct policy_handle);
23501 0 : _self->in.key = talloc_zero(mem_ctx, struct winreg_String);
23502 0 : return self;
23503 : }
23504 :
23505 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
23506 : {
23507 :
23508 :
23509 0 : return PyLong_FromLong(35);
23510 : }
23511 :
23512 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
23513 : {
23514 0 : const struct ndr_interface_call *call = NULL;
23515 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23516 0 : PyObject *ret = NULL;
23517 0 : struct ndr_push *push = NULL;
23518 : DATA_BLOB blob;
23519 : enum ndr_err_code err;
23520 :
23521 0 : if (ndr_table_winreg.num_calls < 36) {
23522 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKeyEx_ndr_pack");
23523 0 : return NULL;
23524 : }
23525 0 : call = &ndr_table_winreg.calls[35];
23526 :
23527 0 : push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
23528 0 : if (push == NULL) {
23529 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
23530 0 : return NULL;
23531 : }
23532 :
23533 0 : push->flags |= ndr_push_flags;
23534 :
23535 0 : err = call->ndr_push(push, ndr_inout_flags, object);
23536 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
23537 0 : TALLOC_FREE(push);
23538 0 : PyErr_SetNdrError(err);
23539 0 : return NULL;
23540 : }
23541 0 : blob = ndr_push_blob(push);
23542 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
23543 0 : TALLOC_FREE(push);
23544 0 : return ret;
23545 : }
23546 :
23547 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23548 : {
23549 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
23550 0 : PyObject *bigendian_obj = NULL;
23551 0 : PyObject *ndr64_obj = NULL;
23552 0 : uint32_t ndr_push_flags = 0;
23553 :
23554 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
23555 : discard_const_p(char *, kwnames),
23556 : &bigendian_obj,
23557 : &ndr64_obj)) {
23558 0 : return NULL;
23559 : }
23560 :
23561 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23562 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
23563 : }
23564 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23565 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
23566 : }
23567 :
23568 0 : return py_winreg_DeleteKeyEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
23569 : }
23570 :
23571 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23572 : {
23573 0 : const char * const kwnames[] = { "bigendian", "ndr64", NULL };
23574 0 : PyObject *bigendian_obj = NULL;
23575 0 : PyObject *ndr64_obj = NULL;
23576 0 : uint32_t ndr_push_flags = 0;
23577 :
23578 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
23579 : discard_const_p(char *, kwnames),
23580 : &bigendian_obj,
23581 : &ndr64_obj)) {
23582 0 : return NULL;
23583 : }
23584 :
23585 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23586 0 : ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
23587 : }
23588 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23589 0 : ndr_push_flags |= LIBNDR_FLAG_NDR64;
23590 : }
23591 :
23592 0 : return py_winreg_DeleteKeyEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
23593 : }
23594 :
23595 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
23596 : {
23597 0 : const struct ndr_interface_call *call = NULL;
23598 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23599 0 : struct ndr_pull *pull = NULL;
23600 : enum ndr_err_code err;
23601 :
23602 0 : if (ndr_table_winreg.num_calls < 36) {
23603 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKeyEx_ndr_unpack");
23604 0 : return NULL;
23605 : }
23606 0 : call = &ndr_table_winreg.calls[35];
23607 :
23608 0 : pull = ndr_pull_init_blob(blob, object);
23609 0 : if (pull == NULL) {
23610 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
23611 0 : return NULL;
23612 : }
23613 :
23614 0 : pull->flags |= ndr_pull_flags;
23615 :
23616 0 : err = call->ndr_pull(pull, ndr_inout_flags, object);
23617 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
23618 0 : TALLOC_FREE(pull);
23619 0 : PyErr_SetNdrError(err);
23620 0 : return NULL;
23621 : }
23622 0 : if (!allow_remaining) {
23623 : uint32_t highest_ofs;
23624 :
23625 0 : if (pull->offset > pull->relative_highest_offset) {
23626 0 : highest_ofs = pull->offset;
23627 : } else {
23628 0 : highest_ofs = pull->relative_highest_offset;
23629 : }
23630 0 : if (highest_ofs < pull->data_size) {
23631 0 : err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
23632 : "not all bytes consumed ofs[%u] size[%u]",
23633 : highest_ofs, pull->data_size);
23634 0 : TALLOC_FREE(pull);
23635 0 : PyErr_SetNdrError(err);
23636 0 : return NULL;
23637 : }
23638 : }
23639 :
23640 0 : TALLOC_FREE(pull);
23641 0 : Py_RETURN_NONE;
23642 : }
23643 :
23644 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23645 : {
23646 : DATA_BLOB blob;
23647 0 : Py_ssize_t blob_length = 0;
23648 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23649 0 : PyObject *bigendian_obj = NULL;
23650 0 : PyObject *ndr64_obj = NULL;
23651 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23652 0 : PyObject *allow_remaining_obj = NULL;
23653 0 : bool allow_remaining = false;
23654 :
23655 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
23656 : discard_const_p(char *, kwnames),
23657 : &blob.data, &blob_length,
23658 : &bigendian_obj,
23659 : &ndr64_obj,
23660 : &allow_remaining_obj)) {
23661 0 : return NULL;
23662 : }
23663 0 : blob.length = blob_length;
23664 :
23665 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23666 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23667 : }
23668 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23669 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23670 : }
23671 :
23672 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23673 0 : allow_remaining = true;
23674 : }
23675 :
23676 0 : return py_winreg_DeleteKeyEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
23677 : }
23678 :
23679 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
23680 : {
23681 : DATA_BLOB blob;
23682 0 : Py_ssize_t blob_length = 0;
23683 0 : const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
23684 0 : PyObject *bigendian_obj = NULL;
23685 0 : PyObject *ndr64_obj = NULL;
23686 0 : uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
23687 0 : PyObject *allow_remaining_obj = NULL;
23688 0 : bool allow_remaining = false;
23689 :
23690 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
23691 : discard_const_p(char *, kwnames),
23692 : &blob.data, &blob_length,
23693 : &bigendian_obj,
23694 : &ndr64_obj,
23695 : &allow_remaining_obj)) {
23696 0 : return NULL;
23697 : }
23698 0 : blob.length = blob_length;
23699 :
23700 0 : if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
23701 0 : ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
23702 : }
23703 0 : if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
23704 0 : ndr_pull_flags |= LIBNDR_FLAG_NDR64;
23705 : }
23706 :
23707 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
23708 0 : allow_remaining = true;
23709 : }
23710 :
23711 0 : return py_winreg_DeleteKeyEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
23712 : }
23713 :
23714 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
23715 : {
23716 0 : const struct ndr_interface_call *call = NULL;
23717 0 : struct winreg_DeleteKeyEx *object = (struct winreg_DeleteKeyEx *)pytalloc_get_ptr(py_obj);
23718 : PyObject *ret;
23719 : char *retstr;
23720 :
23721 0 : if (ndr_table_winreg.num_calls < 36) {
23722 0 : PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winreg_DeleteKeyEx_ndr_print");
23723 0 : return NULL;
23724 : }
23725 0 : call = &ndr_table_winreg.calls[35];
23726 :
23727 0 : retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
23728 0 : ret = PyUnicode_FromString(retstr);
23729 0 : TALLOC_FREE(retstr);
23730 :
23731 0 : return ret;
23732 : }
23733 :
23734 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23735 : {
23736 0 : return py_winreg_DeleteKeyEx_ndr_print(py_obj, "winreg_DeleteKeyEx_in", NDR_IN);
23737 : }
23738 :
23739 0 : static PyObject *py_winreg_DeleteKeyEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
23740 : {
23741 0 : return py_winreg_DeleteKeyEx_ndr_print(py_obj, "winreg_DeleteKeyEx_out", NDR_OUT);
23742 : }
23743 :
23744 : static PyMethodDef py_winreg_DeleteKeyEx_methods[] = {
23745 : { "opnum", (PyCFunction)py_winreg_DeleteKeyEx_ndr_opnum, METH_NOARGS|METH_CLASS,
23746 : "winreg.DeleteKeyEx.opnum() -> 35 (0x23) " },
23747 : { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
23748 : "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
23749 : { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
23750 : "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
23751 : { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
23752 : "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
23753 : { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_DeleteKeyEx_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
23754 : "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
23755 : { "__ndr_print_in__", (PyCFunction)py_winreg_DeleteKeyEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
23756 : { "__ndr_print_out__", (PyCFunction)py_winreg_DeleteKeyEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
23757 : { NULL, NULL, 0, NULL }
23758 : };
23759 :
23760 :
23761 : static PyTypeObject winreg_DeleteKeyEx_Type = {
23762 : PyVarObject_HEAD_INIT(NULL, 0)
23763 : .tp_name = "winreg.DeleteKeyEx",
23764 : .tp_getset = py_winreg_DeleteKeyEx_getsetters,
23765 : .tp_methods = py_winreg_DeleteKeyEx_methods,
23766 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23767 : .tp_new = py_winreg_DeleteKeyEx_new,
23768 : };
23769 :
23770 0 : static bool pack_py_winreg_DeleteKeyEx_args_in(PyObject *args, PyObject *kwargs, struct winreg_DeleteKeyEx *r)
23771 : {
23772 : PyObject *py_handle;
23773 : PyObject *py_key;
23774 : PyObject *py_access_mask;
23775 : PyObject *py_reserved;
23776 0 : const char *kwnames[] = {
23777 : "handle", "key", "access_mask", "reserved", NULL
23778 : };
23779 :
23780 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winreg_DeleteKeyEx", discard_const_p(char *, kwnames), &py_handle, &py_key, &py_access_mask, &py_reserved)) {
23781 0 : return false;
23782 : }
23783 :
23784 0 : if (py_handle == NULL) {
23785 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle");
23786 0 : return false;
23787 : }
23788 0 : r->in.handle = talloc_ptrtype(r, r->in.handle);
23789 0 : if (r->in.handle == NULL) {
23790 0 : PyErr_NoMemory();
23791 0 : return false;
23792 : }
23793 0 : PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;);
23794 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) {
23795 0 : PyErr_NoMemory();
23796 0 : return false;
23797 : }
23798 0 : r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle);
23799 0 : if (py_key == NULL) {
23800 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.key");
23801 0 : return false;
23802 : }
23803 0 : r->in.key = talloc_ptrtype(r, r->in.key);
23804 0 : if (r->in.key == NULL) {
23805 0 : PyErr_NoMemory();
23806 0 : return false;
23807 : }
23808 0 : PY_CHECK_TYPE(&winreg_String_Type, py_key, return false;);
23809 0 : if (talloc_reference(r, pytalloc_get_mem_ctx(py_key)) == NULL) {
23810 0 : PyErr_NoMemory();
23811 0 : return false;
23812 : }
23813 0 : r->in.key = (struct winreg_String *)pytalloc_get_ptr(py_key);
23814 0 : if (py_access_mask == NULL) {
23815 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask");
23816 0 : return false;
23817 : }
23818 : {
23819 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask));
23820 0 : if (PyLong_Check(py_access_mask)) {
23821 : unsigned long long test_var;
23822 0 : test_var = PyLong_AsUnsignedLongLong(py_access_mask);
23823 0 : if (PyErr_Occurred() != NULL) {
23824 0 : return false;
23825 : }
23826 0 : if (test_var > uint_max) {
23827 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23828 : PyLong_Type.tp_name, uint_max, test_var);
23829 0 : return false;
23830 : }
23831 0 : r->in.access_mask = test_var;
23832 : } else {
23833 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23834 : PyLong_Type.tp_name);
23835 0 : return false;
23836 : }
23837 : }
23838 0 : if (py_reserved == NULL) {
23839 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.reserved");
23840 0 : return false;
23841 : }
23842 : {
23843 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.reserved));
23844 0 : if (PyLong_Check(py_reserved)) {
23845 : unsigned long long test_var;
23846 0 : test_var = PyLong_AsUnsignedLongLong(py_reserved);
23847 0 : if (PyErr_Occurred() != NULL) {
23848 0 : return false;
23849 : }
23850 0 : if (test_var > uint_max) {
23851 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
23852 : PyLong_Type.tp_name, uint_max, test_var);
23853 0 : return false;
23854 : }
23855 0 : r->in.reserved = test_var;
23856 : } else {
23857 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
23858 : PyLong_Type.tp_name);
23859 0 : return false;
23860 : }
23861 : }
23862 0 : return true;
23863 : }
23864 :
23865 0 : static PyObject *unpack_py_winreg_DeleteKeyEx_args_out(struct winreg_DeleteKeyEx *r)
23866 : {
23867 : PyObject *result;
23868 0 : result = Py_None;
23869 0 : Py_INCREF(result);
23870 0 : if (!W_ERROR_IS_OK(r->out.result)) {
23871 0 : PyErr_SetWERROR(r->out.result);
23872 0 : return NULL;
23873 : }
23874 :
23875 0 : return result;
23876 : }
23877 :
23878 : const struct PyNdrRpcMethodDef py_ndr_winreg_methods[] = {
23879 : { "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 },
23880 : { "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 },
23881 : { "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 },
23882 : { "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 },
23883 : { "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 },
23884 : { "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 },
23885 : { "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 },
23886 : { "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 },
23887 : { "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 },
23888 : { "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 },
23889 : { "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 },
23890 : { "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 },
23891 : { "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 },
23892 : { "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 },
23893 : { "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 },
23894 : { "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 },
23895 : { "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 },
23896 : { "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 },
23897 : { "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 },
23898 : { "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 },
23899 : { "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 },
23900 : { "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 },
23901 : { "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 },
23902 : { "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 },
23903 : { "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 },
23904 : { "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 },
23905 : { "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 },
23906 : { "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 },
23907 : { "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 },
23908 : { "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 },
23909 : { "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 },
23910 : { "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 },
23911 : { "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 },
23912 : { "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 },
23913 : { "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 },
23914 : { "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 },
23915 : {0}
23916 : };
23917 :
23918 3 : static PyObject *interface_winreg_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23919 : {
23920 3 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_winreg);
23921 : }
23922 :
23923 : #define PY_DOC_WINREG "Remote Registry Service"
23924 : static PyTypeObject winreg_InterfaceType = {
23925 : PyVarObject_HEAD_INIT(NULL, 0)
23926 : .tp_name = "winreg.winreg",
23927 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
23928 : .tp_doc = "winreg(binding, lp_ctx=None, credentials=None) -> connection\n"
23929 : "\n"
23930 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
23931 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
23932 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_WINREG,
23933 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23934 : .tp_new = interface_winreg_new,
23935 : };
23936 :
23937 0 : static PyObject *syntax_winreg_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
23938 : {
23939 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_winreg.syntax_id);
23940 : }
23941 :
23942 : #define PY_DOC_WINREG_SYNTAX "Remote Registry Service"
23943 : static PyTypeObject winreg_SyntaxType = {
23944 : PyVarObject_HEAD_INIT(NULL, 0)
23945 : .tp_name = "winreg.winreg_abstract_syntax",
23946 : .tp_doc = "winreg_abstract_syntax()\n"PY_DOC_WINREG_SYNTAX,
23947 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
23948 : .tp_new = syntax_winreg_new,
23949 : };
23950 :
23951 : static PyMethodDef winreg_methods[] = {
23952 : { NULL, NULL, 0, NULL }
23953 : };
23954 :
23955 : static struct PyModuleDef moduledef = {
23956 : PyModuleDef_HEAD_INIT,
23957 : .m_name = "winreg",
23958 : .m_doc = "winreg DCE/RPC",
23959 : .m_size = -1,
23960 : .m_methods = winreg_methods,
23961 : };
23962 1 : MODULE_INIT_FUNC(winreg)
23963 : {
23964 1 : PyObject *m = NULL;
23965 1 : PyObject *dep_samba_dcerpc_lsa = NULL;
23966 1 : PyObject *dep_samba_dcerpc_security = NULL;
23967 1 : PyObject *dep_samba_dcerpc_misc = NULL;
23968 1 : PyObject *dep_talloc = NULL;
23969 1 : PyObject *dep_samba_dcerpc_base = NULL;
23970 :
23971 1 : dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
23972 1 : if (dep_samba_dcerpc_lsa == NULL)
23973 0 : goto out;
23974 :
23975 1 : dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
23976 1 : if (dep_samba_dcerpc_security == NULL)
23977 0 : goto out;
23978 :
23979 1 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
23980 1 : if (dep_samba_dcerpc_misc == NULL)
23981 0 : goto out;
23982 :
23983 1 : dep_talloc = PyImport_ImportModule("talloc");
23984 1 : if (dep_talloc == NULL)
23985 0 : goto out;
23986 :
23987 1 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
23988 1 : if (dep_samba_dcerpc_base == NULL)
23989 0 : goto out;
23990 :
23991 1 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
23992 1 : if (BaseObject_Type == NULL)
23993 0 : goto out;
23994 :
23995 1 : policy_handle_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "policy_handle");
23996 1 : if (policy_handle_Type == NULL)
23997 0 : goto out;
23998 :
23999 1 : lsa_StringLarge_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "StringLarge");
24000 1 : if (lsa_StringLarge_Type == NULL)
24001 0 : goto out;
24002 :
24003 1 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
24004 1 : if (ClientConnection_Type == NULL)
24005 0 : goto out;
24006 :
24007 1 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
24008 1 : if (ndr_syntax_id_Type == NULL)
24009 0 : goto out;
24010 :
24011 1 : winreg_String_Type.tp_base = BaseObject_Type;
24012 1 : winreg_String_Type.tp_basicsize = pytalloc_BaseObject_size();
24013 :
24014 1 : KeySecurityData_Type.tp_base = BaseObject_Type;
24015 1 : KeySecurityData_Type.tp_basicsize = pytalloc_BaseObject_size();
24016 :
24017 1 : winreg_SecBuf_Type.tp_base = BaseObject_Type;
24018 1 : winreg_SecBuf_Type.tp_basicsize = pytalloc_BaseObject_size();
24019 :
24020 1 : winreg_StringBuf_Type.tp_base = BaseObject_Type;
24021 1 : winreg_StringBuf_Type.tp_basicsize = pytalloc_BaseObject_size();
24022 :
24023 1 : winreg_ValNameBuf_Type.tp_base = BaseObject_Type;
24024 1 : winreg_ValNameBuf_Type.tp_basicsize = pytalloc_BaseObject_size();
24025 :
24026 1 : KeySecurityAttribute_Type.tp_base = BaseObject_Type;
24027 1 : KeySecurityAttribute_Type.tp_basicsize = pytalloc_BaseObject_size();
24028 :
24029 1 : QueryMultipleValue_Type.tp_base = BaseObject_Type;
24030 1 : QueryMultipleValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24031 :
24032 1 : winreg_OpenHKCR_Type.tp_base = BaseObject_Type;
24033 1 : winreg_OpenHKCR_Type.tp_basicsize = pytalloc_BaseObject_size();
24034 :
24035 1 : winreg_OpenHKCU_Type.tp_base = BaseObject_Type;
24036 1 : winreg_OpenHKCU_Type.tp_basicsize = pytalloc_BaseObject_size();
24037 :
24038 1 : winreg_OpenHKLM_Type.tp_base = BaseObject_Type;
24039 1 : winreg_OpenHKLM_Type.tp_basicsize = pytalloc_BaseObject_size();
24040 :
24041 1 : winreg_OpenHKPD_Type.tp_base = BaseObject_Type;
24042 1 : winreg_OpenHKPD_Type.tp_basicsize = pytalloc_BaseObject_size();
24043 :
24044 1 : winreg_OpenHKU_Type.tp_base = BaseObject_Type;
24045 1 : winreg_OpenHKU_Type.tp_basicsize = pytalloc_BaseObject_size();
24046 :
24047 1 : winreg_CloseKey_Type.tp_base = BaseObject_Type;
24048 1 : winreg_CloseKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24049 :
24050 1 : winreg_CreateKey_Type.tp_base = BaseObject_Type;
24051 1 : winreg_CreateKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24052 :
24053 1 : winreg_DeleteKey_Type.tp_base = BaseObject_Type;
24054 1 : winreg_DeleteKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24055 :
24056 1 : winreg_DeleteValue_Type.tp_base = BaseObject_Type;
24057 1 : winreg_DeleteValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24058 :
24059 1 : winreg_EnumKey_Type.tp_base = BaseObject_Type;
24060 1 : winreg_EnumKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24061 :
24062 1 : winreg_EnumValue_Type.tp_base = BaseObject_Type;
24063 1 : winreg_EnumValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24064 :
24065 1 : winreg_FlushKey_Type.tp_base = BaseObject_Type;
24066 1 : winreg_FlushKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24067 :
24068 1 : winreg_GetKeySecurity_Type.tp_base = BaseObject_Type;
24069 1 : winreg_GetKeySecurity_Type.tp_basicsize = pytalloc_BaseObject_size();
24070 :
24071 1 : winreg_LoadKey_Type.tp_base = BaseObject_Type;
24072 1 : winreg_LoadKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24073 :
24074 1 : winreg_NotifyChangeKeyValue_Type.tp_base = BaseObject_Type;
24075 1 : winreg_NotifyChangeKeyValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24076 :
24077 1 : winreg_OpenKey_Type.tp_base = BaseObject_Type;
24078 1 : winreg_OpenKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24079 :
24080 1 : winreg_QueryInfoKey_Type.tp_base = BaseObject_Type;
24081 1 : winreg_QueryInfoKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24082 :
24083 1 : winreg_QueryValue_Type.tp_base = BaseObject_Type;
24084 1 : winreg_QueryValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24085 :
24086 1 : winreg_ReplaceKey_Type.tp_base = BaseObject_Type;
24087 1 : winreg_ReplaceKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24088 :
24089 1 : winreg_RestoreKey_Type.tp_base = BaseObject_Type;
24090 1 : winreg_RestoreKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24091 :
24092 1 : winreg_SaveKey_Type.tp_base = BaseObject_Type;
24093 1 : winreg_SaveKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24094 :
24095 1 : winreg_SetKeySecurity_Type.tp_base = BaseObject_Type;
24096 1 : winreg_SetKeySecurity_Type.tp_basicsize = pytalloc_BaseObject_size();
24097 :
24098 1 : winreg_SetValue_Type.tp_base = BaseObject_Type;
24099 1 : winreg_SetValue_Type.tp_basicsize = pytalloc_BaseObject_size();
24100 :
24101 1 : winreg_UnLoadKey_Type.tp_base = BaseObject_Type;
24102 1 : winreg_UnLoadKey_Type.tp_basicsize = pytalloc_BaseObject_size();
24103 :
24104 1 : winreg_InitiateSystemShutdown_Type.tp_base = BaseObject_Type;
24105 1 : winreg_InitiateSystemShutdown_Type.tp_basicsize = pytalloc_BaseObject_size();
24106 :
24107 1 : winreg_AbortSystemShutdown_Type.tp_base = BaseObject_Type;
24108 1 : winreg_AbortSystemShutdown_Type.tp_basicsize = pytalloc_BaseObject_size();
24109 :
24110 1 : winreg_GetVersion_Type.tp_base = BaseObject_Type;
24111 1 : winreg_GetVersion_Type.tp_basicsize = pytalloc_BaseObject_size();
24112 :
24113 1 : winreg_OpenHKCC_Type.tp_base = BaseObject_Type;
24114 1 : winreg_OpenHKCC_Type.tp_basicsize = pytalloc_BaseObject_size();
24115 :
24116 1 : winreg_OpenHKDD_Type.tp_base = BaseObject_Type;
24117 1 : winreg_OpenHKDD_Type.tp_basicsize = pytalloc_BaseObject_size();
24118 :
24119 1 : winreg_QueryMultipleValues_Type.tp_base = BaseObject_Type;
24120 1 : winreg_QueryMultipleValues_Type.tp_basicsize = pytalloc_BaseObject_size();
24121 :
24122 1 : winreg_InitiateSystemShutdownEx_Type.tp_base = BaseObject_Type;
24123 1 : winreg_InitiateSystemShutdownEx_Type.tp_basicsize = pytalloc_BaseObject_size();
24124 :
24125 1 : winreg_SaveKeyEx_Type.tp_base = BaseObject_Type;
24126 1 : winreg_SaveKeyEx_Type.tp_basicsize = pytalloc_BaseObject_size();
24127 :
24128 1 : winreg_OpenHKPT_Type.tp_base = BaseObject_Type;
24129 1 : winreg_OpenHKPT_Type.tp_basicsize = pytalloc_BaseObject_size();
24130 :
24131 1 : winreg_OpenHKPN_Type.tp_base = BaseObject_Type;
24132 1 : winreg_OpenHKPN_Type.tp_basicsize = pytalloc_BaseObject_size();
24133 :
24134 1 : winreg_QueryMultipleValues2_Type.tp_base = BaseObject_Type;
24135 1 : winreg_QueryMultipleValues2_Type.tp_basicsize = pytalloc_BaseObject_size();
24136 :
24137 1 : winreg_DeleteKeyEx_Type.tp_base = BaseObject_Type;
24138 1 : winreg_DeleteKeyEx_Type.tp_basicsize = pytalloc_BaseObject_size();
24139 :
24140 1 : winreg_InterfaceType.tp_base = ClientConnection_Type;
24141 :
24142 1 : winreg_SyntaxType.tp_base = ndr_syntax_id_Type;
24143 1 : winreg_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
24144 :
24145 1 : if (PyType_Ready(&winreg_String_Type) < 0)
24146 0 : goto out;
24147 1 : if (PyType_Ready(&KeySecurityData_Type) < 0)
24148 0 : goto out;
24149 1 : if (PyType_Ready(&winreg_SecBuf_Type) < 0)
24150 0 : goto out;
24151 1 : if (PyType_Ready(&winreg_StringBuf_Type) < 0)
24152 0 : goto out;
24153 1 : if (PyType_Ready(&winreg_ValNameBuf_Type) < 0)
24154 0 : goto out;
24155 1 : if (PyType_Ready(&KeySecurityAttribute_Type) < 0)
24156 0 : goto out;
24157 1 : if (PyType_Ready(&QueryMultipleValue_Type) < 0)
24158 0 : goto out;
24159 1 : if (PyType_Ready(&winreg_OpenHKCR_Type) < 0)
24160 0 : goto out;
24161 1 : if (PyType_Ready(&winreg_OpenHKCU_Type) < 0)
24162 0 : goto out;
24163 1 : if (PyType_Ready(&winreg_OpenHKLM_Type) < 0)
24164 0 : goto out;
24165 1 : if (PyType_Ready(&winreg_OpenHKPD_Type) < 0)
24166 0 : goto out;
24167 1 : if (PyType_Ready(&winreg_OpenHKU_Type) < 0)
24168 0 : goto out;
24169 1 : if (PyType_Ready(&winreg_CloseKey_Type) < 0)
24170 0 : goto out;
24171 1 : if (PyType_Ready(&winreg_CreateKey_Type) < 0)
24172 0 : goto out;
24173 1 : if (PyType_Ready(&winreg_DeleteKey_Type) < 0)
24174 0 : goto out;
24175 1 : if (PyType_Ready(&winreg_DeleteValue_Type) < 0)
24176 0 : goto out;
24177 1 : if (PyType_Ready(&winreg_EnumKey_Type) < 0)
24178 0 : goto out;
24179 1 : if (PyType_Ready(&winreg_EnumValue_Type) < 0)
24180 0 : goto out;
24181 1 : if (PyType_Ready(&winreg_FlushKey_Type) < 0)
24182 0 : goto out;
24183 1 : if (PyType_Ready(&winreg_GetKeySecurity_Type) < 0)
24184 0 : goto out;
24185 1 : if (PyType_Ready(&winreg_LoadKey_Type) < 0)
24186 0 : goto out;
24187 1 : if (PyType_Ready(&winreg_NotifyChangeKeyValue_Type) < 0)
24188 0 : goto out;
24189 1 : if (PyType_Ready(&winreg_OpenKey_Type) < 0)
24190 0 : goto out;
24191 1 : if (PyType_Ready(&winreg_QueryInfoKey_Type) < 0)
24192 0 : goto out;
24193 1 : if (PyType_Ready(&winreg_QueryValue_Type) < 0)
24194 0 : goto out;
24195 1 : if (PyType_Ready(&winreg_ReplaceKey_Type) < 0)
24196 0 : goto out;
24197 1 : if (PyType_Ready(&winreg_RestoreKey_Type) < 0)
24198 0 : goto out;
24199 1 : if (PyType_Ready(&winreg_SaveKey_Type) < 0)
24200 0 : goto out;
24201 1 : if (PyType_Ready(&winreg_SetKeySecurity_Type) < 0)
24202 0 : goto out;
24203 1 : if (PyType_Ready(&winreg_SetValue_Type) < 0)
24204 0 : goto out;
24205 1 : if (PyType_Ready(&winreg_UnLoadKey_Type) < 0)
24206 0 : goto out;
24207 1 : if (PyType_Ready(&winreg_InitiateSystemShutdown_Type) < 0)
24208 0 : goto out;
24209 1 : if (PyType_Ready(&winreg_AbortSystemShutdown_Type) < 0)
24210 0 : goto out;
24211 1 : if (PyType_Ready(&winreg_GetVersion_Type) < 0)
24212 0 : goto out;
24213 1 : if (PyType_Ready(&winreg_OpenHKCC_Type) < 0)
24214 0 : goto out;
24215 1 : if (PyType_Ready(&winreg_OpenHKDD_Type) < 0)
24216 0 : goto out;
24217 1 : if (PyType_Ready(&winreg_QueryMultipleValues_Type) < 0)
24218 0 : goto out;
24219 1 : if (PyType_Ready(&winreg_InitiateSystemShutdownEx_Type) < 0)
24220 0 : goto out;
24221 1 : if (PyType_Ready(&winreg_SaveKeyEx_Type) < 0)
24222 0 : goto out;
24223 1 : if (PyType_Ready(&winreg_OpenHKPT_Type) < 0)
24224 0 : goto out;
24225 1 : if (PyType_Ready(&winreg_OpenHKPN_Type) < 0)
24226 0 : goto out;
24227 1 : if (PyType_Ready(&winreg_QueryMultipleValues2_Type) < 0)
24228 0 : goto out;
24229 1 : if (PyType_Ready(&winreg_DeleteKeyEx_Type) < 0)
24230 0 : goto out;
24231 1 : if (PyType_Ready(&winreg_InterfaceType) < 0)
24232 0 : goto out;
24233 1 : if (PyType_Ready(&winreg_SyntaxType) < 0)
24234 0 : goto out;
24235 1 : if (!PyInterface_AddNdrRpcMethods(&winreg_InterfaceType, py_ndr_winreg_methods))
24236 0 : return NULL;
24237 :
24238 : #ifdef PY_STRING_PATCH
24239 : PY_STRING_PATCH(&winreg_String_Type);
24240 : #endif
24241 : #ifdef PY_KEYSECURITYDATA_PATCH
24242 : PY_KEYSECURITYDATA_PATCH(&KeySecurityData_Type);
24243 : #endif
24244 : #ifdef PY_SECBUF_PATCH
24245 : PY_SECBUF_PATCH(&winreg_SecBuf_Type);
24246 : #endif
24247 : #ifdef PY_STRINGBUF_PATCH
24248 : PY_STRINGBUF_PATCH(&winreg_StringBuf_Type);
24249 : #endif
24250 : #ifdef PY_VALNAMEBUF_PATCH
24251 : PY_VALNAMEBUF_PATCH(&winreg_ValNameBuf_Type);
24252 : #endif
24253 : #ifdef PY_KEYSECURITYATTRIBUTE_PATCH
24254 : PY_KEYSECURITYATTRIBUTE_PATCH(&KeySecurityAttribute_Type);
24255 : #endif
24256 : #ifdef PY_QUERYMULTIPLEVALUE_PATCH
24257 : PY_QUERYMULTIPLEVALUE_PATCH(&QueryMultipleValue_Type);
24258 : #endif
24259 : #ifdef PY_OPENHKCR_PATCH
24260 : PY_OPENHKCR_PATCH(&winreg_OpenHKCR_Type);
24261 : #endif
24262 : #ifdef PY_OPENHKCU_PATCH
24263 : PY_OPENHKCU_PATCH(&winreg_OpenHKCU_Type);
24264 : #endif
24265 : #ifdef PY_OPENHKLM_PATCH
24266 : PY_OPENHKLM_PATCH(&winreg_OpenHKLM_Type);
24267 : #endif
24268 : #ifdef PY_OPENHKPD_PATCH
24269 : PY_OPENHKPD_PATCH(&winreg_OpenHKPD_Type);
24270 : #endif
24271 : #ifdef PY_OPENHKU_PATCH
24272 : PY_OPENHKU_PATCH(&winreg_OpenHKU_Type);
24273 : #endif
24274 : #ifdef PY_CLOSEKEY_PATCH
24275 : PY_CLOSEKEY_PATCH(&winreg_CloseKey_Type);
24276 : #endif
24277 : #ifdef PY_CREATEKEY_PATCH
24278 : PY_CREATEKEY_PATCH(&winreg_CreateKey_Type);
24279 : #endif
24280 : #ifdef PY_DELETEKEY_PATCH
24281 : PY_DELETEKEY_PATCH(&winreg_DeleteKey_Type);
24282 : #endif
24283 : #ifdef PY_DELETEVALUE_PATCH
24284 : PY_DELETEVALUE_PATCH(&winreg_DeleteValue_Type);
24285 : #endif
24286 : #ifdef PY_ENUMKEY_PATCH
24287 : PY_ENUMKEY_PATCH(&winreg_EnumKey_Type);
24288 : #endif
24289 : #ifdef PY_ENUMVALUE_PATCH
24290 : PY_ENUMVALUE_PATCH(&winreg_EnumValue_Type);
24291 : #endif
24292 : #ifdef PY_FLUSHKEY_PATCH
24293 : PY_FLUSHKEY_PATCH(&winreg_FlushKey_Type);
24294 : #endif
24295 : #ifdef PY_GETKEYSECURITY_PATCH
24296 : PY_GETKEYSECURITY_PATCH(&winreg_GetKeySecurity_Type);
24297 : #endif
24298 : #ifdef PY_LOADKEY_PATCH
24299 : PY_LOADKEY_PATCH(&winreg_LoadKey_Type);
24300 : #endif
24301 : #ifdef PY_NOTIFYCHANGEKEYVALUE_PATCH
24302 : PY_NOTIFYCHANGEKEYVALUE_PATCH(&winreg_NotifyChangeKeyValue_Type);
24303 : #endif
24304 : #ifdef PY_OPENKEY_PATCH
24305 : PY_OPENKEY_PATCH(&winreg_OpenKey_Type);
24306 : #endif
24307 : #ifdef PY_QUERYINFOKEY_PATCH
24308 : PY_QUERYINFOKEY_PATCH(&winreg_QueryInfoKey_Type);
24309 : #endif
24310 : #ifdef PY_QUERYVALUE_PATCH
24311 : PY_QUERYVALUE_PATCH(&winreg_QueryValue_Type);
24312 : #endif
24313 : #ifdef PY_REPLACEKEY_PATCH
24314 : PY_REPLACEKEY_PATCH(&winreg_ReplaceKey_Type);
24315 : #endif
24316 : #ifdef PY_RESTOREKEY_PATCH
24317 : PY_RESTOREKEY_PATCH(&winreg_RestoreKey_Type);
24318 : #endif
24319 : #ifdef PY_SAVEKEY_PATCH
24320 : PY_SAVEKEY_PATCH(&winreg_SaveKey_Type);
24321 : #endif
24322 : #ifdef PY_SETKEYSECURITY_PATCH
24323 : PY_SETKEYSECURITY_PATCH(&winreg_SetKeySecurity_Type);
24324 : #endif
24325 : #ifdef PY_SETVALUE_PATCH
24326 : PY_SETVALUE_PATCH(&winreg_SetValue_Type);
24327 : #endif
24328 : #ifdef PY_UNLOADKEY_PATCH
24329 : PY_UNLOADKEY_PATCH(&winreg_UnLoadKey_Type);
24330 : #endif
24331 : #ifdef PY_INITIATESYSTEMSHUTDOWN_PATCH
24332 : PY_INITIATESYSTEMSHUTDOWN_PATCH(&winreg_InitiateSystemShutdown_Type);
24333 : #endif
24334 : #ifdef PY_ABORTSYSTEMSHUTDOWN_PATCH
24335 : PY_ABORTSYSTEMSHUTDOWN_PATCH(&winreg_AbortSystemShutdown_Type);
24336 : #endif
24337 : #ifdef PY_GETVERSION_PATCH
24338 : PY_GETVERSION_PATCH(&winreg_GetVersion_Type);
24339 : #endif
24340 : #ifdef PY_OPENHKCC_PATCH
24341 : PY_OPENHKCC_PATCH(&winreg_OpenHKCC_Type);
24342 : #endif
24343 : #ifdef PY_OPENHKDD_PATCH
24344 : PY_OPENHKDD_PATCH(&winreg_OpenHKDD_Type);
24345 : #endif
24346 : #ifdef PY_QUERYMULTIPLEVALUES_PATCH
24347 : PY_QUERYMULTIPLEVALUES_PATCH(&winreg_QueryMultipleValues_Type);
24348 : #endif
24349 : #ifdef PY_INITIATESYSTEMSHUTDOWNEX_PATCH
24350 : PY_INITIATESYSTEMSHUTDOWNEX_PATCH(&winreg_InitiateSystemShutdownEx_Type);
24351 : #endif
24352 : #ifdef PY_SAVEKEYEX_PATCH
24353 : PY_SAVEKEYEX_PATCH(&winreg_SaveKeyEx_Type);
24354 : #endif
24355 : #ifdef PY_OPENHKPT_PATCH
24356 : PY_OPENHKPT_PATCH(&winreg_OpenHKPT_Type);
24357 : #endif
24358 : #ifdef PY_OPENHKPN_PATCH
24359 : PY_OPENHKPN_PATCH(&winreg_OpenHKPN_Type);
24360 : #endif
24361 : #ifdef PY_QUERYMULTIPLEVALUES2_PATCH
24362 : PY_QUERYMULTIPLEVALUES2_PATCH(&winreg_QueryMultipleValues2_Type);
24363 : #endif
24364 : #ifdef PY_DELETEKEYEX_PATCH
24365 : PY_DELETEKEYEX_PATCH(&winreg_DeleteKeyEx_Type);
24366 : #endif
24367 : #ifdef PY_WINREG_PATCH
24368 : PY_WINREG_PATCH(&winreg_InterfaceType);
24369 : #endif
24370 : #ifdef PY_WINREG_ABSTRACT_SYNTAX_PATCH
24371 : PY_WINREG_ABSTRACT_SYNTAX_PATCH(&winreg_SyntaxType);
24372 : #endif
24373 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
24374 : PY_ABSTRACT_SYNTAX_PATCH(&winreg_SyntaxType);
24375 : #endif
24376 :
24377 1 : m = PyModule_Create(&moduledef);
24378 1 : if (m == NULL)
24379 0 : goto out;
24380 :
24381 1 : PyModule_AddObject(m, "REG_KEY_READ", PyLong_FromLong((STANDARD_RIGHTS_READ_ACCESS|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|KEY_NOTIFY)));
24382 1 : PyModule_AddObject(m, "REG_KEY_EXECUTE", PyLong_FromLong(REG_KEY_READ));
24383 1 : PyModule_AddObject(m, "REG_KEY_WRITE", PyLong_FromLong((STANDARD_RIGHTS_WRITE_ACCESS|KEY_SET_VALUE|KEY_CREATE_SUB_KEY)));
24384 1 : PyModule_AddObject(m, "REG_KEY_ALL", PyLong_FromLong((STANDARD_RIGHTS_REQUIRED_ACCESS|REG_KEY_READ|REG_KEY_WRITE|KEY_CREATE_LINK)));
24385 1 : PyModule_AddObject(m, "REG_OPTION_NON_VOLATILE", PyLong_FromUnsignedLongLong(0x00000000));
24386 1 : PyModule_AddObject(m, "KEY_QUERY_VALUE", PyLong_FromUnsignedLongLong((uint32_t)KEY_QUERY_VALUE));
24387 1 : PyModule_AddObject(m, "KEY_SET_VALUE", PyLong_FromUnsignedLongLong((uint32_t)KEY_SET_VALUE));
24388 1 : PyModule_AddObject(m, "KEY_CREATE_SUB_KEY", PyLong_FromUnsignedLongLong((uint32_t)KEY_CREATE_SUB_KEY));
24389 1 : PyModule_AddObject(m, "KEY_ENUMERATE_SUB_KEYS", PyLong_FromUnsignedLongLong((uint32_t)KEY_ENUMERATE_SUB_KEYS));
24390 1 : PyModule_AddObject(m, "KEY_NOTIFY", PyLong_FromUnsignedLongLong((uint32_t)KEY_NOTIFY));
24391 1 : PyModule_AddObject(m, "KEY_CREATE_LINK", PyLong_FromUnsignedLongLong((uint32_t)KEY_CREATE_LINK));
24392 1 : PyModule_AddObject(m, "KEY_WOW64_64KEY", PyLong_FromUnsignedLongLong((uint32_t)KEY_WOW64_64KEY));
24393 1 : PyModule_AddObject(m, "KEY_WOW64_32KEY", PyLong_FromUnsignedLongLong((uint32_t)KEY_WOW64_32KEY));
24394 1 : PyModule_AddObject(m, "REG_OPTION_VOLATILE", PyLong_FromUnsignedLongLong((uint32_t)REG_OPTION_VOLATILE));
24395 1 : PyModule_AddObject(m, "REG_OPTION_CREATE_LINK", PyLong_FromUnsignedLongLong((uint32_t)REG_OPTION_CREATE_LINK));
24396 1 : PyModule_AddObject(m, "REG_OPTION_BACKUP_RESTORE", PyLong_FromUnsignedLongLong((uint32_t)REG_OPTION_BACKUP_RESTORE));
24397 1 : PyModule_AddObject(m, "REG_OPTION_OPEN_LINK", PyLong_FromUnsignedLongLong((uint32_t)REG_OPTION_OPEN_LINK));
24398 1 : PyModule_AddObject(m, "REG_ACTION_NONE", PyLong_FromUnsignedLongLong((uint32_t)REG_ACTION_NONE));
24399 1 : PyModule_AddObject(m, "REG_CREATED_NEW_KEY", PyLong_FromUnsignedLongLong((uint32_t)REG_CREATED_NEW_KEY));
24400 1 : PyModule_AddObject(m, "REG_OPENED_EXISTING_KEY", PyLong_FromUnsignedLongLong((uint32_t)REG_OPENED_EXISTING_KEY));
24401 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_NAME", PyLong_FromUnsignedLongLong((uint32_t)REG_NOTIFY_CHANGE_NAME));
24402 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_ATTRIBUTES", PyLong_FromUnsignedLongLong((uint32_t)REG_NOTIFY_CHANGE_ATTRIBUTES));
24403 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_LAST_SET", PyLong_FromUnsignedLongLong((uint32_t)REG_NOTIFY_CHANGE_LAST_SET));
24404 1 : PyModule_AddObject(m, "REG_NOTIFY_CHANGE_SECURITY", PyLong_FromUnsignedLongLong((uint32_t)REG_NOTIFY_CHANGE_SECURITY));
24405 1 : PyModule_AddObject(m, "REG_WHOLE_HIVE_VOLATILE", PyLong_FromUnsignedLongLong((uint32_t)REG_WHOLE_HIVE_VOLATILE));
24406 1 : PyModule_AddObject(m, "REG_REFRESH_HIVE", PyLong_FromUnsignedLongLong((uint32_t)REG_REFRESH_HIVE));
24407 1 : PyModule_AddObject(m, "REG_NO_LAZY_FLUSH", PyLong_FromUnsignedLongLong((uint32_t)REG_NO_LAZY_FLUSH));
24408 1 : PyModule_AddObject(m, "REG_FORCE_RESTORE", PyLong_FromUnsignedLongLong((uint32_t)REG_FORCE_RESTORE));
24409 1 : Py_INCREF((PyObject *)(void *)&winreg_String_Type);
24410 1 : PyModule_AddObject(m, "String", (PyObject *)(void *)&winreg_String_Type);
24411 1 : Py_INCREF((PyObject *)(void *)&KeySecurityData_Type);
24412 1 : PyModule_AddObject(m, "KeySecurityData", (PyObject *)(void *)&KeySecurityData_Type);
24413 1 : Py_INCREF((PyObject *)(void *)&winreg_SecBuf_Type);
24414 1 : PyModule_AddObject(m, "SecBuf", (PyObject *)(void *)&winreg_SecBuf_Type);
24415 1 : Py_INCREF((PyObject *)(void *)&winreg_StringBuf_Type);
24416 1 : PyModule_AddObject(m, "StringBuf", (PyObject *)(void *)&winreg_StringBuf_Type);
24417 1 : Py_INCREF((PyObject *)(void *)&winreg_ValNameBuf_Type);
24418 1 : PyModule_AddObject(m, "ValNameBuf", (PyObject *)(void *)&winreg_ValNameBuf_Type);
24419 1 : Py_INCREF((PyObject *)(void *)&KeySecurityAttribute_Type);
24420 1 : PyModule_AddObject(m, "KeySecurityAttribute", (PyObject *)(void *)&KeySecurityAttribute_Type);
24421 1 : Py_INCREF((PyObject *)(void *)&QueryMultipleValue_Type);
24422 1 : PyModule_AddObject(m, "QueryMultipleValue", (PyObject *)(void *)&QueryMultipleValue_Type);
24423 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKCR_Type);
24424 1 : PyModule_AddObject(m, "OpenHKCR", (PyObject *)(void *)&winreg_OpenHKCR_Type);
24425 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKCU_Type);
24426 1 : PyModule_AddObject(m, "OpenHKCU", (PyObject *)(void *)&winreg_OpenHKCU_Type);
24427 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKLM_Type);
24428 1 : PyModule_AddObject(m, "OpenHKLM", (PyObject *)(void *)&winreg_OpenHKLM_Type);
24429 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKPD_Type);
24430 1 : PyModule_AddObject(m, "OpenHKPD", (PyObject *)(void *)&winreg_OpenHKPD_Type);
24431 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKU_Type);
24432 1 : PyModule_AddObject(m, "OpenHKU", (PyObject *)(void *)&winreg_OpenHKU_Type);
24433 1 : Py_INCREF((PyObject *)(void *)&winreg_CloseKey_Type);
24434 1 : PyModule_AddObject(m, "CloseKey", (PyObject *)(void *)&winreg_CloseKey_Type);
24435 1 : Py_INCREF((PyObject *)(void *)&winreg_CreateKey_Type);
24436 1 : PyModule_AddObject(m, "CreateKey", (PyObject *)(void *)&winreg_CreateKey_Type);
24437 1 : Py_INCREF((PyObject *)(void *)&winreg_DeleteKey_Type);
24438 1 : PyModule_AddObject(m, "DeleteKey", (PyObject *)(void *)&winreg_DeleteKey_Type);
24439 1 : Py_INCREF((PyObject *)(void *)&winreg_DeleteValue_Type);
24440 1 : PyModule_AddObject(m, "DeleteValue", (PyObject *)(void *)&winreg_DeleteValue_Type);
24441 1 : Py_INCREF((PyObject *)(void *)&winreg_EnumKey_Type);
24442 1 : PyModule_AddObject(m, "EnumKey", (PyObject *)(void *)&winreg_EnumKey_Type);
24443 1 : Py_INCREF((PyObject *)(void *)&winreg_EnumValue_Type);
24444 1 : PyModule_AddObject(m, "EnumValue", (PyObject *)(void *)&winreg_EnumValue_Type);
24445 1 : Py_INCREF((PyObject *)(void *)&winreg_FlushKey_Type);
24446 1 : PyModule_AddObject(m, "FlushKey", (PyObject *)(void *)&winreg_FlushKey_Type);
24447 1 : Py_INCREF((PyObject *)(void *)&winreg_GetKeySecurity_Type);
24448 1 : PyModule_AddObject(m, "GetKeySecurity", (PyObject *)(void *)&winreg_GetKeySecurity_Type);
24449 1 : Py_INCREF((PyObject *)(void *)&winreg_LoadKey_Type);
24450 1 : PyModule_AddObject(m, "LoadKey", (PyObject *)(void *)&winreg_LoadKey_Type);
24451 1 : Py_INCREF((PyObject *)(void *)&winreg_NotifyChangeKeyValue_Type);
24452 1 : PyModule_AddObject(m, "NotifyChangeKeyValue", (PyObject *)(void *)&winreg_NotifyChangeKeyValue_Type);
24453 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenKey_Type);
24454 1 : PyModule_AddObject(m, "OpenKey", (PyObject *)(void *)&winreg_OpenKey_Type);
24455 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryInfoKey_Type);
24456 1 : PyModule_AddObject(m, "QueryInfoKey", (PyObject *)(void *)&winreg_QueryInfoKey_Type);
24457 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryValue_Type);
24458 1 : PyModule_AddObject(m, "QueryValue", (PyObject *)(void *)&winreg_QueryValue_Type);
24459 1 : Py_INCREF((PyObject *)(void *)&winreg_ReplaceKey_Type);
24460 1 : PyModule_AddObject(m, "ReplaceKey", (PyObject *)(void *)&winreg_ReplaceKey_Type);
24461 1 : Py_INCREF((PyObject *)(void *)&winreg_RestoreKey_Type);
24462 1 : PyModule_AddObject(m, "RestoreKey", (PyObject *)(void *)&winreg_RestoreKey_Type);
24463 1 : Py_INCREF((PyObject *)(void *)&winreg_SaveKey_Type);
24464 1 : PyModule_AddObject(m, "SaveKey", (PyObject *)(void *)&winreg_SaveKey_Type);
24465 1 : Py_INCREF((PyObject *)(void *)&winreg_SetKeySecurity_Type);
24466 1 : PyModule_AddObject(m, "SetKeySecurity", (PyObject *)(void *)&winreg_SetKeySecurity_Type);
24467 1 : Py_INCREF((PyObject *)(void *)&winreg_SetValue_Type);
24468 1 : PyModule_AddObject(m, "SetValue", (PyObject *)(void *)&winreg_SetValue_Type);
24469 1 : Py_INCREF((PyObject *)(void *)&winreg_UnLoadKey_Type);
24470 1 : PyModule_AddObject(m, "UnLoadKey", (PyObject *)(void *)&winreg_UnLoadKey_Type);
24471 1 : Py_INCREF((PyObject *)(void *)&winreg_InitiateSystemShutdown_Type);
24472 1 : PyModule_AddObject(m, "InitiateSystemShutdown", (PyObject *)(void *)&winreg_InitiateSystemShutdown_Type);
24473 1 : Py_INCREF((PyObject *)(void *)&winreg_AbortSystemShutdown_Type);
24474 1 : PyModule_AddObject(m, "AbortSystemShutdown", (PyObject *)(void *)&winreg_AbortSystemShutdown_Type);
24475 1 : Py_INCREF((PyObject *)(void *)&winreg_GetVersion_Type);
24476 1 : PyModule_AddObject(m, "GetVersion", (PyObject *)(void *)&winreg_GetVersion_Type);
24477 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKCC_Type);
24478 1 : PyModule_AddObject(m, "OpenHKCC", (PyObject *)(void *)&winreg_OpenHKCC_Type);
24479 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKDD_Type);
24480 1 : PyModule_AddObject(m, "OpenHKDD", (PyObject *)(void *)&winreg_OpenHKDD_Type);
24481 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryMultipleValues_Type);
24482 1 : PyModule_AddObject(m, "QueryMultipleValues", (PyObject *)(void *)&winreg_QueryMultipleValues_Type);
24483 1 : Py_INCREF((PyObject *)(void *)&winreg_InitiateSystemShutdownEx_Type);
24484 1 : PyModule_AddObject(m, "InitiateSystemShutdownEx", (PyObject *)(void *)&winreg_InitiateSystemShutdownEx_Type);
24485 1 : Py_INCREF((PyObject *)(void *)&winreg_SaveKeyEx_Type);
24486 1 : PyModule_AddObject(m, "SaveKeyEx", (PyObject *)(void *)&winreg_SaveKeyEx_Type);
24487 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKPT_Type);
24488 1 : PyModule_AddObject(m, "OpenHKPT", (PyObject *)(void *)&winreg_OpenHKPT_Type);
24489 1 : Py_INCREF((PyObject *)(void *)&winreg_OpenHKPN_Type);
24490 1 : PyModule_AddObject(m, "OpenHKPN", (PyObject *)(void *)&winreg_OpenHKPN_Type);
24491 1 : Py_INCREF((PyObject *)(void *)&winreg_QueryMultipleValues2_Type);
24492 1 : PyModule_AddObject(m, "QueryMultipleValues2", (PyObject *)(void *)&winreg_QueryMultipleValues2_Type);
24493 1 : Py_INCREF((PyObject *)(void *)&winreg_DeleteKeyEx_Type);
24494 1 : PyModule_AddObject(m, "DeleteKeyEx", (PyObject *)(void *)&winreg_DeleteKeyEx_Type);
24495 1 : Py_INCREF((PyObject *)(void *)&winreg_InterfaceType);
24496 1 : PyModule_AddObject(m, "winreg", (PyObject *)(void *)&winreg_InterfaceType);
24497 1 : Py_INCREF((PyObject *)(void *)&winreg_SyntaxType);
24498 1 : PyModule_AddObject(m, "winreg_abstract_syntax", (PyObject *)(void *)&winreg_SyntaxType);
24499 1 : Py_INCREF((PyObject *)(void *)&winreg_SyntaxType);
24500 1 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&winreg_SyntaxType);
24501 : #ifdef PY_MOD_WINREG_PATCH
24502 : PY_MOD_WINREG_PATCH(m);
24503 : #endif
24504 1 : out:
24505 1 : Py_XDECREF(dep_samba_dcerpc_lsa);
24506 1 : Py_XDECREF(dep_samba_dcerpc_security);
24507 1 : Py_XDECREF(dep_samba_dcerpc_misc);
24508 1 : Py_XDECREF(dep_talloc);
24509 1 : Py_XDECREF(dep_samba_dcerpc_base);
24510 1 : return m;
24511 :
24512 : }
|