/* Python wrapper functions auto-generated by pidl */ #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */ #include #include "python/py3compat.h" #include "includes.h" #include "python/modules.h" #include #include "librpc/rpc/pyrpc.h" #include "librpc/rpc/pyrpc_util.h" #include "bin/default/librpc/gen_ndr/ndr_ntsvcs.h" #include "bin/default/librpc/gen_ndr/ndr_ntsvcs_c.h" /* * Suppress compiler warnings if the generated code does not call these * functions */ #ifndef _MAYBE_UNUSED_ #ifdef __has_attribute #if __has_attribute(unused) #define _MAYBE_UNUSED_ __attribute__ ((unused)) #else #define _MAYBE_UNUSED_ #endif #endif #endif /* * These functions are here to ensure they can be optimized out by * the compiler based on the constant input values */ static inline unsigned long long ndr_sizeof2uintmax(size_t var_size) { switch (var_size) { case 8: return UINT64_MAX; case 4: return UINT32_MAX; case 2: return UINT16_MAX; case 1: return UINT8_MAX; } return 0; } static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size) { switch (var_size) { case 8: return INT64_MAX; case 4: return INT32_MAX; case 2: return INT16_MAX; case 1: return INT8_MAX; } return 0; } #include "librpc/gen_ndr/misc.h" static PyTypeObject PNP_HwProfInfo_Type; static PyTypeObject ntsvcs_InterfaceType; static PyTypeObject PNP_GetVersion_Type; static PyTypeObject PNP_ValidateDeviceInstance_Type; static PyTypeObject PNP_GetDeviceList_Type; static PyTypeObject PNP_GetDeviceListSize_Type; static PyTypeObject PNP_GetDeviceRegProp_Type; static PyTypeObject PNP_HwProfFlags_Type; static PyTypeObject PNP_GetHwProfInfo_Type; static PyTypeObject *BaseObject_Type; static PyTypeObject *ndr_pointer_Type; static PyTypeObject *ClientConnection_Type; static PyTypeObject *ndr_syntax_id_Type; static PyObject *py_PNP_HwProfInfo_get_profile_handle(PyObject *obj, void *closure) { struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_profile_handle; py_profile_handle = PyLong_FromUnsignedLongLong((uint32_t)object->profile_handle); return py_profile_handle; } static int py_PNP_HwProfInfo_set_profile_handle(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->profile_handle"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->profile_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->profile_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_HwProfInfo_get_friendly_name(PyObject *obj, void *closure) { struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_friendly_name; py_friendly_name = PyList_New(80); if (py_friendly_name == NULL) { return NULL; } { int friendly_name_cntr_0; for (friendly_name_cntr_0 = 0; friendly_name_cntr_0 < (80); friendly_name_cntr_0++) { PyObject *py_friendly_name_0; py_friendly_name_0 = PyLong_FromLong((uint16_t)object->friendly_name[friendly_name_cntr_0]); PyList_SetItem(py_friendly_name, friendly_name_cntr_0, py_friendly_name_0); } } return py_friendly_name; } static int py_PNP_HwProfInfo_set_friendly_name(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->friendly_name"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int friendly_name_cntr_0; if (ARRAY_SIZE(object->friendly_name) != PyList_GET_SIZE(value)) { PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->friendly_name), PyList_GET_SIZE(value)); return -1; } for (friendly_name_cntr_0 = 0; friendly_name_cntr_0 < PyList_GET_SIZE(value); friendly_name_cntr_0++) { if (PyList_GET_ITEM(value, friendly_name_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->friendly_name[friendly_name_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->friendly_name[friendly_name_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, friendly_name_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, friendly_name_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->friendly_name[friendly_name_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_PNP_HwProfInfo_get_flags(PyObject *obj, void *closure) { struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags); return py_flags; } static int py_PNP_HwProfInfo_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_PNP_HwProfInfo_getsetters[] = { { .name = discard_const_p(char, "profile_handle"), .get = py_PNP_HwProfInfo_get_profile_handle, .set = py_PNP_HwProfInfo_set_profile_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "friendly_name"), .get = py_PNP_HwProfInfo_get_friendly_name, .set = py_PNP_HwProfInfo_set_friendly_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "flags"), .get = py_PNP_HwProfInfo_get_flags, .set = py_PNP_HwProfInfo_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = NULL } }; static PyObject *py_PNP_HwProfInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct PNP_HwProfInfo, type); } static PyTypeObject PNP_HwProfInfo_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_HwProfInfo", .tp_getset = py_PNP_HwProfInfo_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_HwProfInfo_new, }; static PyObject *py_PNP_GetVersion_out_get_version(PyObject *obj, void *closure) { struct PNP_GetVersion *object = (struct PNP_GetVersion *)pytalloc_get_ptr(obj); PyObject *py_version; if (object->out.version == NULL) { Py_RETURN_NONE; } py_version = PyLong_FromLong((uint16_t)*object->out.version); return py_version; } static int py_PNP_GetVersion_out_set_version(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetVersion *object = (struct PNP_GetVersion *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.version)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.version"); return -1; } object->out.version = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.version); if (object->out.version == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.version)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.version = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetVersion_get_result(PyObject *obj, void *closure) { struct PNP_GetVersion *object = (struct PNP_GetVersion *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_PNP_GetVersion_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetVersion *object = (struct PNP_GetVersion *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_PNP_GetVersion_getsetters[] = { { .name = discard_const_p(char, "out_version"), .get = py_PNP_GetVersion_out_get_version, .set = py_PNP_GetVersion_out_set_version, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_PNP_GetVersion_get_result, .set = py_PNP_GetVersion_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_PNP_GetVersion_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct PNP_GetVersion, type); struct PNP_GetVersion *_self = (struct PNP_GetVersion *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.version = talloc_zero(mem_ctx, uint16_t); return self; } static PyObject *py_PNP_GetVersion_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(2); } static PyObject *py_PNP_GetVersion_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetVersion *object = (struct PNP_GetVersion *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetVersion_ndr_pack"); return NULL; } call = &ndr_table_ntsvcs.calls[2]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_PNP_GetVersion_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetVersion_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_PNP_GetVersion_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetVersion_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_PNP_GetVersion_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct PNP_GetVersion *object = (struct PNP_GetVersion *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetVersion_ndr_unpack"); return NULL; } call = &ndr_table_ntsvcs.calls[2]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_PNP_GetVersion_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetVersion_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetVersion_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetVersion_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetVersion_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetVersion *object = (struct PNP_GetVersion *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_ntsvcs.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetVersion_ndr_print"); return NULL; } call = &ndr_table_ntsvcs.calls[2]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_PNP_GetVersion_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetVersion_ndr_print(py_obj, "PNP_GetVersion_in", NDR_IN); } static PyObject *py_PNP_GetVersion_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetVersion_ndr_print(py_obj, "PNP_GetVersion_out", NDR_OUT); } static PyMethodDef py_PNP_GetVersion_methods[] = { { "opnum", (PyCFunction)py_PNP_GetVersion_ndr_opnum, METH_NOARGS|METH_CLASS, "ntsvcs.PNP_GetVersion.opnum() -> 2 (0x02) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetVersion_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetVersion_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetVersion_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetVersion_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_PNP_GetVersion_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_PNP_GetVersion_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject PNP_GetVersion_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_GetVersion", .tp_getset = py_PNP_GetVersion_getsetters, .tp_methods = py_PNP_GetVersion_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_GetVersion_new, }; static bool pack_py_PNP_GetVersion_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetVersion *r) { const char *kwnames[] = { NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":PNP_GetVersion", discard_const_p(char *, kwnames))) { return false; } return true; } static PyObject *unpack_py_PNP_GetVersion_args_out(struct PNP_GetVersion *r) { PyObject *result; PyObject *py_version; py_version = PyLong_FromLong((uint16_t)*r->out.version); result = py_version; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_PNP_ValidateDeviceInstance_in_get_devicepath(PyObject *obj, void *closure) { struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(obj); PyObject *py_devicepath; if (object->in.devicepath == NULL) { Py_RETURN_NONE; } if (object->in.devicepath == NULL) { py_devicepath = Py_None; Py_INCREF(py_devicepath); } else { py_devicepath = PyUnicode_Decode(object->in.devicepath, strlen(object->in.devicepath), "utf-8", "ignore"); } return py_devicepath; } static int py_PNP_ValidateDeviceInstance_in_set_devicepath(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.devicepath"); return -1; } object->in.devicepath = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.devicepath); if (object->in.devicepath == NULL) { PyErr_NoMemory(); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.devicepath = talloc_str; } return 0; } static PyObject *py_PNP_ValidateDeviceInstance_in_get_flags(PyObject *obj, void *closure) { struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags); return py_flags; } static int py_PNP_ValidateDeviceInstance_in_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_ValidateDeviceInstance_get_result(PyObject *obj, void *closure) { struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_PNP_ValidateDeviceInstance_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_PNP_ValidateDeviceInstance_getsetters[] = { { .name = discard_const_p(char, "in_devicepath"), .get = py_PNP_ValidateDeviceInstance_in_get_devicepath, .set = py_PNP_ValidateDeviceInstance_in_set_devicepath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_flags"), .get = py_PNP_ValidateDeviceInstance_in_get_flags, .set = py_PNP_ValidateDeviceInstance_in_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_PNP_ValidateDeviceInstance_get_result, .set = py_PNP_ValidateDeviceInstance_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_PNP_ValidateDeviceInstance_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct PNP_ValidateDeviceInstance, type); return self; } static PyObject *py_PNP_ValidateDeviceInstance_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(6); } static PyObject *py_PNP_ValidateDeviceInstance_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_ValidateDeviceInstance_ndr_pack"); return NULL; } call = &ndr_table_ntsvcs.calls[6]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_PNP_ValidateDeviceInstance_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_ValidateDeviceInstance_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_PNP_ValidateDeviceInstance_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_ValidateDeviceInstance_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_PNP_ValidateDeviceInstance_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_ValidateDeviceInstance_ndr_unpack"); return NULL; } call = &ndr_table_ntsvcs.calls[6]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_PNP_ValidateDeviceInstance_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_ValidateDeviceInstance_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_ValidateDeviceInstance_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_ValidateDeviceInstance_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_ValidateDeviceInstance_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct PNP_ValidateDeviceInstance *object = (struct PNP_ValidateDeviceInstance *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_ntsvcs.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_ValidateDeviceInstance_ndr_print"); return NULL; } call = &ndr_table_ntsvcs.calls[6]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_PNP_ValidateDeviceInstance_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_ValidateDeviceInstance_ndr_print(py_obj, "PNP_ValidateDeviceInstance_in", NDR_IN); } static PyObject *py_PNP_ValidateDeviceInstance_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_ValidateDeviceInstance_ndr_print(py_obj, "PNP_ValidateDeviceInstance_out", NDR_OUT); } static PyMethodDef py_PNP_ValidateDeviceInstance_methods[] = { { "opnum", (PyCFunction)py_PNP_ValidateDeviceInstance_ndr_opnum, METH_NOARGS|METH_CLASS, "ntsvcs.PNP_ValidateDeviceInstance.opnum() -> 6 (0x06) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_ValidateDeviceInstance_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_ValidateDeviceInstance_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_ValidateDeviceInstance_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_ValidateDeviceInstance_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_PNP_ValidateDeviceInstance_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_PNP_ValidateDeviceInstance_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject PNP_ValidateDeviceInstance_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_ValidateDeviceInstance", .tp_getset = py_PNP_ValidateDeviceInstance_getsetters, .tp_methods = py_PNP_ValidateDeviceInstance_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_ValidateDeviceInstance_new, }; static bool pack_py_PNP_ValidateDeviceInstance_args_in(PyObject *args, PyObject *kwargs, struct PNP_ValidateDeviceInstance *r) { PyObject *py_devicepath; PyObject *py_flags; const char *kwnames[] = { "devicepath", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:PNP_ValidateDeviceInstance", discard_const_p(char *, kwnames), &py_devicepath, &py_flags)) { return false; } if (py_devicepath == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.devicepath"); return false; } r->in.devicepath = talloc_ptrtype(r, r->in.devicepath); if (r->in.devicepath == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_devicepath)) { unicode = PyUnicode_AsEncodedString(py_devicepath, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_devicepath)) { test_str = PyBytes_AS_STRING(py_devicepath); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicepath)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.devicepath = talloc_str; } if (py_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags)); if (PyLong_Check(py_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_flags); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_PNP_ValidateDeviceInstance_args_out(struct PNP_ValidateDeviceInstance *r) { PyObject *result; result = Py_None; Py_INCREF(result); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_PNP_GetDeviceList_in_get_filter(PyObject *obj, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(obj); PyObject *py_filter; if (object->in.filter == NULL) { Py_RETURN_NONE; } if (object->in.filter == NULL) { py_filter = Py_None; Py_INCREF(py_filter); } else { if (object->in.filter == NULL) { py_filter = Py_None; Py_INCREF(py_filter); } else { py_filter = PyUnicode_Decode(object->in.filter, strlen(object->in.filter), "utf-8", "ignore"); } } return py_filter; } static int py_PNP_GetDeviceList_in_set_filter(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.filter"); return -1; } if (value == Py_None) { object->in.filter = NULL; } else { object->in.filter = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.filter = talloc_str; } } return 0; } static PyObject *py_PNP_GetDeviceList_out_get_buffer(PyObject *obj, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(obj); PyObject *py_buffer; if (object->out.buffer == NULL) { Py_RETURN_NONE; } py_buffer = PyList_New(*object->out.length); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->out.length); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } return py_buffer; } static int py_PNP_GetDeviceList_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer"); return -1; } object->out.buffer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer); if (object->out.buffer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int buffer_cntr_1; object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value)); if (!object->out.buffer) { return -1;; } talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer"); for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) { if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.buffer[buffer_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_PNP_GetDeviceList_in_get_length(PyObject *obj, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(obj); PyObject *py_length; if (object->in.length == NULL) { Py_RETURN_NONE; } py_length = PyLong_FromUnsignedLongLong((uint32_t)*object->in.length); return py_length; } static int py_PNP_GetDeviceList_in_set_length(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.length"); return -1; } object->in.length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.length); if (object->in.length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceList_out_get_length(PyObject *obj, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(obj); PyObject *py_length; if (object->out.length == NULL) { Py_RETURN_NONE; } py_length = PyLong_FromUnsignedLongLong((uint32_t)*object->out.length); return py_length; } static int py_PNP_GetDeviceList_out_set_length(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.length"); return -1; } object->out.length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.length); if (object->out.length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceList_in_get_flags(PyObject *obj, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags); return py_flags; } static int py_PNP_GetDeviceList_in_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceList_get_result(PyObject *obj, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_PNP_GetDeviceList_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_PNP_GetDeviceList_getsetters[] = { { .name = discard_const_p(char, "in_filter"), .get = py_PNP_GetDeviceList_in_get_filter, .set = py_PNP_GetDeviceList_in_set_filter, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_buffer"), .get = py_PNP_GetDeviceList_out_get_buffer, .set = py_PNP_GetDeviceList_out_set_buffer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_length"), .get = py_PNP_GetDeviceList_in_get_length, .set = py_PNP_GetDeviceList_in_set_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_length"), .get = py_PNP_GetDeviceList_out_get_length, .set = py_PNP_GetDeviceList_out_set_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_flags"), .get = py_PNP_GetDeviceList_in_get_flags, .set = py_PNP_GetDeviceList_in_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type PNP_GetIdListFlags") }, { .name = discard_const_p(char, "result"), .get = py_PNP_GetDeviceList_get_result, .set = py_PNP_GetDeviceList_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_PNP_GetDeviceList_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct PNP_GetDeviceList, type); struct PNP_GetDeviceList *_self = (struct PNP_GetDeviceList *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.buffer = talloc_zero(mem_ctx, uint16_t); _self->in.length = talloc_zero(mem_ctx, uint32_t); _self->out.length = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_PNP_GetDeviceList_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(10); } static PyObject *py_PNP_GetDeviceList_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceList_ndr_pack"); return NULL; } call = &ndr_table_ntsvcs.calls[10]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_PNP_GetDeviceList_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetDeviceList_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_PNP_GetDeviceList_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetDeviceList_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_PNP_GetDeviceList_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceList_ndr_unpack"); return NULL; } call = &ndr_table_ntsvcs.calls[10]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_PNP_GetDeviceList_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetDeviceList_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetDeviceList_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetDeviceList_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetDeviceList_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceList *object = (struct PNP_GetDeviceList *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_ntsvcs.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceList_ndr_print"); return NULL; } call = &ndr_table_ntsvcs.calls[10]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_PNP_GetDeviceList_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetDeviceList_ndr_print(py_obj, "PNP_GetDeviceList_in", NDR_IN); } static PyObject *py_PNP_GetDeviceList_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetDeviceList_ndr_print(py_obj, "PNP_GetDeviceList_out", NDR_OUT); } static PyMethodDef py_PNP_GetDeviceList_methods[] = { { "opnum", (PyCFunction)py_PNP_GetDeviceList_ndr_opnum, METH_NOARGS|METH_CLASS, "ntsvcs.PNP_GetDeviceList.opnum() -> 10 (0x0a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceList_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceList_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceList_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceList_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_PNP_GetDeviceList_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_PNP_GetDeviceList_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject PNP_GetDeviceList_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_GetDeviceList", .tp_getset = py_PNP_GetDeviceList_getsetters, .tp_methods = py_PNP_GetDeviceList_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_GetDeviceList_new, }; static bool pack_py_PNP_GetDeviceList_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetDeviceList *r) { PyObject *py_filter; PyObject *py_flags; const char *kwnames[] = { "filter", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:PNP_GetDeviceList", discard_const_p(char *, kwnames), &py_filter, &py_flags)) { return false; } if (py_filter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.filter"); return false; } if (py_filter == Py_None) { r->in.filter = NULL; } else { r->in.filter = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_filter)) { unicode = PyUnicode_AsEncodedString(py_filter, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_filter)) { test_str = PyBytes_AS_STRING(py_filter); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_filter)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.filter = talloc_str; } } if (py_length == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.length"); return false; } r->in.length = talloc_ptrtype(r, r->in.length); if (r->in.length == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.length)); if (PyLong_Check(py_length)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_length); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags)); if (PyLong_Check(py_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_flags); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_PNP_GetDeviceList_args_out(struct PNP_GetDeviceList *r) { PyObject *result; PyObject *py_buffer; py_buffer = PyList_New(*r->out.length); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (*r->out.length); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } result = py_buffer; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_PNP_GetDeviceListSize_in_get_devicename(PyObject *obj, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(obj); PyObject *py_devicename; if (object->in.devicename == NULL) { Py_RETURN_NONE; } if (object->in.devicename == NULL) { py_devicename = Py_None; Py_INCREF(py_devicename); } else { if (object->in.devicename == NULL) { py_devicename = Py_None; Py_INCREF(py_devicename); } else { py_devicename = PyUnicode_Decode(object->in.devicename, strlen(object->in.devicename), "utf-8", "ignore"); } } return py_devicename; } static int py_PNP_GetDeviceListSize_in_set_devicename(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.devicename"); return -1; } if (value == Py_None) { object->in.devicename = NULL; } else { object->in.devicename = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.devicename = talloc_str; } } return 0; } static PyObject *py_PNP_GetDeviceListSize_out_get_size(PyObject *obj, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(obj); PyObject *py_size; if (object->out.size == NULL) { Py_RETURN_NONE; } py_size = PyLong_FromUnsignedLongLong((uint32_t)*object->out.size); return py_size; } static int py_PNP_GetDeviceListSize_out_set_size(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.size)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.size"); return -1; } object->out.size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.size); if (object->out.size == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceListSize_in_get_flags(PyObject *obj, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags); return py_flags; } static int py_PNP_GetDeviceListSize_in_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceListSize_get_result(PyObject *obj, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_PNP_GetDeviceListSize_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_PNP_GetDeviceListSize_getsetters[] = { { .name = discard_const_p(char, "in_devicename"), .get = py_PNP_GetDeviceListSize_in_get_devicename, .set = py_PNP_GetDeviceListSize_in_set_devicename, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_size"), .get = py_PNP_GetDeviceListSize_out_get_size, .set = py_PNP_GetDeviceListSize_out_set_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_flags"), .get = py_PNP_GetDeviceListSize_in_get_flags, .set = py_PNP_GetDeviceListSize_in_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type PNP_GetIdListFlags") }, { .name = discard_const_p(char, "result"), .get = py_PNP_GetDeviceListSize_get_result, .set = py_PNP_GetDeviceListSize_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_PNP_GetDeviceListSize_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct PNP_GetDeviceListSize, type); struct PNP_GetDeviceListSize *_self = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.size = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_PNP_GetDeviceListSize_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(11); } static PyObject *py_PNP_GetDeviceListSize_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceListSize_ndr_pack"); return NULL; } call = &ndr_table_ntsvcs.calls[11]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_PNP_GetDeviceListSize_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetDeviceListSize_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_PNP_GetDeviceListSize_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetDeviceListSize_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_PNP_GetDeviceListSize_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceListSize_ndr_unpack"); return NULL; } call = &ndr_table_ntsvcs.calls[11]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_PNP_GetDeviceListSize_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetDeviceListSize_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetDeviceListSize_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetDeviceListSize_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetDeviceListSize_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceListSize *object = (struct PNP_GetDeviceListSize *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_ntsvcs.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceListSize_ndr_print"); return NULL; } call = &ndr_table_ntsvcs.calls[11]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_PNP_GetDeviceListSize_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetDeviceListSize_ndr_print(py_obj, "PNP_GetDeviceListSize_in", NDR_IN); } static PyObject *py_PNP_GetDeviceListSize_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetDeviceListSize_ndr_print(py_obj, "PNP_GetDeviceListSize_out", NDR_OUT); } static PyMethodDef py_PNP_GetDeviceListSize_methods[] = { { "opnum", (PyCFunction)py_PNP_GetDeviceListSize_ndr_opnum, METH_NOARGS|METH_CLASS, "ntsvcs.PNP_GetDeviceListSize.opnum() -> 11 (0x0b) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceListSize_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceListSize_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceListSize_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceListSize_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_PNP_GetDeviceListSize_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_PNP_GetDeviceListSize_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject PNP_GetDeviceListSize_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_GetDeviceListSize", .tp_getset = py_PNP_GetDeviceListSize_getsetters, .tp_methods = py_PNP_GetDeviceListSize_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_GetDeviceListSize_new, }; static bool pack_py_PNP_GetDeviceListSize_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetDeviceListSize *r) { PyObject *py_devicename; PyObject *py_flags; const char *kwnames[] = { "devicename", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:PNP_GetDeviceListSize", discard_const_p(char *, kwnames), &py_devicename, &py_flags)) { return false; } if (py_devicename == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.devicename"); return false; } if (py_devicename == Py_None) { r->in.devicename = NULL; } else { r->in.devicename = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_devicename)) { unicode = PyUnicode_AsEncodedString(py_devicename, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_devicename)) { test_str = PyBytes_AS_STRING(py_devicename); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicename)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.devicename = talloc_str; } } if (py_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags)); if (PyLong_Check(py_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_flags); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_PNP_GetDeviceListSize_args_out(struct PNP_GetDeviceListSize *r) { PyObject *result; PyObject *py_size; py_size = PyLong_FromUnsignedLongLong((uint32_t)*r->out.size); result = py_size; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_PNP_GetDeviceRegProp_in_get_devicepath(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_devicepath; if (object->in.devicepath == NULL) { Py_RETURN_NONE; } if (object->in.devicepath == NULL) { py_devicepath = Py_None; Py_INCREF(py_devicepath); } else { py_devicepath = PyUnicode_Decode(object->in.devicepath, strlen(object->in.devicepath), "utf-8", "ignore"); } return py_devicepath; } static int py_PNP_GetDeviceRegProp_in_set_devicepath(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.devicepath"); return -1; } object->in.devicepath = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.devicepath); if (object->in.devicepath == NULL) { PyErr_NoMemory(); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.devicepath = talloc_str; } return 0; } static PyObject *py_PNP_GetDeviceRegProp_in_get_property(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_property; py_property = PyLong_FromUnsignedLongLong((uint32_t)object->in.property); return py_property; } static int py_PNP_GetDeviceRegProp_in_set_property(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.property"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.property)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.property = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_in_get_reg_data_type(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_reg_data_type; if (object->in.reg_data_type == NULL) { Py_RETURN_NONE; } py_reg_data_type = PyLong_FromUnsignedLongLong((uint32_t)*object->in.reg_data_type); return py_reg_data_type; } static int py_PNP_GetDeviceRegProp_in_set_reg_data_type(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.reg_data_type)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.reg_data_type"); return -1; } object->in.reg_data_type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.reg_data_type); if (object->in.reg_data_type == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.reg_data_type)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.reg_data_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_out_get_reg_data_type(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_reg_data_type; if (object->out.reg_data_type == NULL) { Py_RETURN_NONE; } py_reg_data_type = PyLong_FromUnsignedLongLong((uint32_t)*object->out.reg_data_type); return py_reg_data_type; } static int py_PNP_GetDeviceRegProp_out_set_reg_data_type(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.reg_data_type)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.reg_data_type"); return -1; } object->out.reg_data_type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.reg_data_type); if (object->out.reg_data_type == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.reg_data_type)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.reg_data_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_out_get_buffer(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_buffer; if (object->out.buffer == NULL) { Py_RETURN_NONE; } py_buffer = PyList_New(*object->out.buffer_size); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (*object->out.buffer_size); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } return py_buffer; } static int py_PNP_GetDeviceRegProp_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer"); return -1; } object->out.buffer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer); if (object->out.buffer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int buffer_cntr_1; object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value)); if (!object->out.buffer) { return -1;; } talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer"); for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) { if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.buffer[buffer_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_in_get_buffer_size(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_buffer_size; if (object->in.buffer_size == NULL) { Py_RETURN_NONE; } py_buffer_size = PyLong_FromUnsignedLongLong((uint32_t)*object->in.buffer_size); return py_buffer_size; } static int py_PNP_GetDeviceRegProp_in_set_buffer_size(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer_size)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer_size"); return -1; } object->in.buffer_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer_size); if (object->in.buffer_size == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.buffer_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.buffer_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_out_get_buffer_size(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_buffer_size; if (object->out.buffer_size == NULL) { Py_RETURN_NONE; } py_buffer_size = PyLong_FromUnsignedLongLong((uint32_t)*object->out.buffer_size); return py_buffer_size; } static int py_PNP_GetDeviceRegProp_out_set_buffer_size(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer_size)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer_size"); return -1; } object->out.buffer_size = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer_size); if (object->out.buffer_size == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.buffer_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.buffer_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_in_get_needed(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->in.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->in.needed); return py_needed; } static int py_PNP_GetDeviceRegProp_in_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.needed"); return -1; } object->in.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.needed); if (object->in.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_out_get_needed(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_PNP_GetDeviceRegProp_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_in_get_flags(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags); return py_flags; } static int py_PNP_GetDeviceRegProp_in_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetDeviceRegProp_get_result(PyObject *obj, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_PNP_GetDeviceRegProp_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_PNP_GetDeviceRegProp_getsetters[] = { { .name = discard_const_p(char, "in_devicepath"), .get = py_PNP_GetDeviceRegProp_in_get_devicepath, .set = py_PNP_GetDeviceRegProp_in_set_devicepath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_property"), .get = py_PNP_GetDeviceRegProp_in_get_property, .set = py_PNP_GetDeviceRegProp_in_set_property, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_reg_data_type"), .get = py_PNP_GetDeviceRegProp_in_get_reg_data_type, .set = py_PNP_GetDeviceRegProp_in_set_reg_data_type, .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type") }, { .name = discard_const_p(char, "out_reg_data_type"), .get = py_PNP_GetDeviceRegProp_out_get_reg_data_type, .set = py_PNP_GetDeviceRegProp_out_set_reg_data_type, .doc = discard_const_p(char, "PIDL-generated element of base type winreg_Type") }, { .name = discard_const_p(char, "out_buffer"), .get = py_PNP_GetDeviceRegProp_out_get_buffer, .set = py_PNP_GetDeviceRegProp_out_set_buffer, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_buffer_size"), .get = py_PNP_GetDeviceRegProp_in_get_buffer_size, .set = py_PNP_GetDeviceRegProp_in_set_buffer_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_buffer_size"), .get = py_PNP_GetDeviceRegProp_out_get_buffer_size, .set = py_PNP_GetDeviceRegProp_out_set_buffer_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_needed"), .get = py_PNP_GetDeviceRegProp_in_get_needed, .set = py_PNP_GetDeviceRegProp_in_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_PNP_GetDeviceRegProp_out_get_needed, .set = py_PNP_GetDeviceRegProp_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_flags"), .get = py_PNP_GetDeviceRegProp_in_get_flags, .set = py_PNP_GetDeviceRegProp_in_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_PNP_GetDeviceRegProp_get_result, .set = py_PNP_GetDeviceRegProp_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_PNP_GetDeviceRegProp_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct PNP_GetDeviceRegProp, type); struct PNP_GetDeviceRegProp *_self = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.reg_data_type = talloc_zero(mem_ctx, enum winreg_Type); _self->out.reg_data_type = talloc_zero(mem_ctx, enum winreg_Type); _self->out.buffer = talloc_zero(mem_ctx, uint8_t); _self->in.buffer_size = talloc_zero(mem_ctx, uint32_t); _self->out.buffer_size = talloc_zero(mem_ctx, uint32_t); _self->in.needed = talloc_zero(mem_ctx, uint32_t); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_PNP_GetDeviceRegProp_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(13); } static PyObject *py_PNP_GetDeviceRegProp_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceRegProp_ndr_pack"); return NULL; } call = &ndr_table_ntsvcs.calls[13]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_PNP_GetDeviceRegProp_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetDeviceRegProp_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_PNP_GetDeviceRegProp_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetDeviceRegProp_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_PNP_GetDeviceRegProp_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceRegProp_ndr_unpack"); return NULL; } call = &ndr_table_ntsvcs.calls[13]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_PNP_GetDeviceRegProp_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetDeviceRegProp_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetDeviceRegProp_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetDeviceRegProp_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetDeviceRegProp_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetDeviceRegProp *object = (struct PNP_GetDeviceRegProp *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_ntsvcs.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetDeviceRegProp_ndr_print"); return NULL; } call = &ndr_table_ntsvcs.calls[13]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_PNP_GetDeviceRegProp_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetDeviceRegProp_ndr_print(py_obj, "PNP_GetDeviceRegProp_in", NDR_IN); } static PyObject *py_PNP_GetDeviceRegProp_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetDeviceRegProp_ndr_print(py_obj, "PNP_GetDeviceRegProp_out", NDR_OUT); } static PyMethodDef py_PNP_GetDeviceRegProp_methods[] = { { "opnum", (PyCFunction)py_PNP_GetDeviceRegProp_ndr_opnum, METH_NOARGS|METH_CLASS, "ntsvcs.PNP_GetDeviceRegProp.opnum() -> 13 (0x0d) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceRegProp_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceRegProp_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceRegProp_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetDeviceRegProp_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_PNP_GetDeviceRegProp_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_PNP_GetDeviceRegProp_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject PNP_GetDeviceRegProp_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_GetDeviceRegProp", .tp_getset = py_PNP_GetDeviceRegProp_getsetters, .tp_methods = py_PNP_GetDeviceRegProp_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_GetDeviceRegProp_new, }; static bool pack_py_PNP_GetDeviceRegProp_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetDeviceRegProp *r) { PyObject *py_devicepath; PyObject *py_property; PyObject *py_reg_data_type; PyObject *py_needed; PyObject *py_flags; const char *kwnames[] = { "devicepath", "property", "reg_data_type", "needed", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:PNP_GetDeviceRegProp", discard_const_p(char *, kwnames), &py_devicepath, &py_property, &py_reg_data_type, &py_needed, &py_flags)) { return false; } if (py_devicepath == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.devicepath"); return false; } r->in.devicepath = talloc_ptrtype(r, r->in.devicepath); if (r->in.devicepath == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_devicepath)) { unicode = PyUnicode_AsEncodedString(py_devicepath, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_devicepath)) { test_str = PyBytes_AS_STRING(py_devicepath); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicepath)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.devicepath = talloc_str; } if (py_property == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.property"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.property)); if (PyLong_Check(py_property)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_property); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.property = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_reg_data_type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.reg_data_type"); return false; } r->in.reg_data_type = talloc_ptrtype(r, r->in.reg_data_type); if (r->in.reg_data_type == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.reg_data_type)); if (PyLong_Check(py_reg_data_type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_reg_data_type); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.reg_data_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_buffer_size == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.buffer_size"); return false; } r->in.buffer_size = talloc_ptrtype(r, r->in.buffer_size); if (r->in.buffer_size == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.buffer_size)); if (PyLong_Check(py_buffer_size)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_buffer_size); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.buffer_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_needed == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.needed"); return false; } r->in.needed = talloc_ptrtype(r, r->in.needed); if (r->in.needed == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.needed)); if (PyLong_Check(py_needed)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_needed); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags)); if (PyLong_Check(py_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_flags); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_PNP_GetDeviceRegProp_args_out(struct PNP_GetDeviceRegProp *r) { PyObject *result; PyObject *py_reg_data_type; PyObject *py_buffer; PyObject *py_needed; result = PyTuple_New(3); py_reg_data_type = PyLong_FromUnsignedLongLong((uint32_t)*r->out.reg_data_type); PyTuple_SetItem(result, 0, py_reg_data_type); py_buffer = PyList_New(*r->out.buffer_size); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (*r->out.buffer_size); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } PyTuple_SetItem(result, 1, py_buffer); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 2, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_PNP_HwProfFlags_in_get_action(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_action; py_action = PyLong_FromUnsignedLongLong((uint32_t)object->in.action); return py_action; } static int py_PNP_HwProfFlags_in_set_action(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.action"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.action)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.action = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_HwProfFlags_in_get_devicepath(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_devicepath; if (object->in.devicepath == NULL) { Py_RETURN_NONE; } if (object->in.devicepath == NULL) { py_devicepath = Py_None; Py_INCREF(py_devicepath); } else { py_devicepath = PyUnicode_Decode(object->in.devicepath, strlen(object->in.devicepath), "utf-8", "ignore"); } return py_devicepath; } static int py_PNP_HwProfFlags_in_set_devicepath(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.devicepath"); return -1; } object->in.devicepath = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.devicepath); if (object->in.devicepath == NULL) { PyErr_NoMemory(); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.devicepath = talloc_str; } return 0; } static PyObject *py_PNP_HwProfFlags_in_get_config(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_config; py_config = PyLong_FromUnsignedLongLong((uint32_t)object->in.config); return py_config; } static int py_PNP_HwProfFlags_in_set_config(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.config"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.config)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.config = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_HwProfFlags_in_get_profile_flags(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_profile_flags; if (object->in.profile_flags == NULL) { Py_RETURN_NONE; } py_profile_flags = PyLong_FromUnsignedLongLong((uint32_t)*object->in.profile_flags); return py_profile_flags; } static int py_PNP_HwProfFlags_in_set_profile_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.profile_flags)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.profile_flags"); return -1; } object->in.profile_flags = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.profile_flags); if (object->in.profile_flags == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.profile_flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.profile_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_HwProfFlags_out_get_profile_flags(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_profile_flags; if (object->out.profile_flags == NULL) { Py_RETURN_NONE; } py_profile_flags = PyLong_FromUnsignedLongLong((uint32_t)*object->out.profile_flags); return py_profile_flags; } static int py_PNP_HwProfFlags_out_set_profile_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.profile_flags)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.profile_flags"); return -1; } object->out.profile_flags = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.profile_flags); if (object->out.profile_flags == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.profile_flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.profile_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_HwProfFlags_in_get_veto_type(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_veto_type; if (object->in.veto_type == NULL) { Py_RETURN_NONE; } if (object->in.veto_type == NULL) { py_veto_type = Py_None; Py_INCREF(py_veto_type); } else { py_veto_type = PyLong_FromLong((uint16_t)*object->in.veto_type); } return py_veto_type; } static int py_PNP_HwProfFlags_in_set_veto_type(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.veto_type)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.veto_type"); return -1; } if (value == Py_None) { object->in.veto_type = NULL; } else { object->in.veto_type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.veto_type); if (object->in.veto_type == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.veto_type)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.veto_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_PNP_HwProfFlags_out_get_veto_type(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_veto_type; if (object->out.veto_type == NULL) { Py_RETURN_NONE; } if (object->out.veto_type == NULL) { py_veto_type = Py_None; Py_INCREF(py_veto_type); } else { py_veto_type = PyLong_FromLong((uint16_t)*object->out.veto_type); } return py_veto_type; } static int py_PNP_HwProfFlags_out_set_veto_type(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.veto_type)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.veto_type"); return -1; } if (value == Py_None) { object->out.veto_type = NULL; } else { object->out.veto_type = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.veto_type); if (object->out.veto_type == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.veto_type)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.veto_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_PNP_HwProfFlags_in_get_unknown5(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_unknown5; if (object->in.unknown5 == NULL) { Py_RETURN_NONE; } if (object->in.unknown5 == NULL) { py_unknown5 = Py_None; Py_INCREF(py_unknown5); } else { if (object->in.unknown5 == NULL) { py_unknown5 = Py_None; Py_INCREF(py_unknown5); } else { py_unknown5 = PyUnicode_Decode(object->in.unknown5, strlen(object->in.unknown5), "utf-8", "ignore"); } } return py_unknown5; } static int py_PNP_HwProfFlags_in_set_unknown5(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.unknown5"); return -1; } if (value == Py_None) { object->in.unknown5 = NULL; } else { object->in.unknown5 = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->in.unknown5 = talloc_str; } } return 0; } static PyObject *py_PNP_HwProfFlags_out_get_unknown5a(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_unknown5a; if (object->out.unknown5a == NULL) { Py_RETURN_NONE; } if (object->out.unknown5a == NULL) { py_unknown5a = Py_None; Py_INCREF(py_unknown5a); } else { if (*object->out.unknown5a == NULL) { py_unknown5a = Py_None; Py_INCREF(py_unknown5a); } else { if (*object->out.unknown5a == NULL) { py_unknown5a = Py_None; Py_INCREF(py_unknown5a); } else { py_unknown5a = PyUnicode_Decode(*object->out.unknown5a, strlen(*object->out.unknown5a), "utf-8", "ignore"); } } } { PyObject *py_unknown5a_level_0 = py_unknown5a; py_unknown5a = py_dcerpc_ndr_pointer_wrap(ndr_pointer_Type, py_unknown5a_level_0); Py_XDECREF(py_unknown5a_level_0); } return py_unknown5a; } static int py_PNP_HwProfFlags_out_set_unknown5a(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.unknown5a)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.unknown5a"); return -1; } if (value == Py_None) { object->out.unknown5a = NULL; } else { object->out.unknown5a = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.unknown5a); if (object->out.unknown5a == NULL) { PyErr_NoMemory(); return -1; } value = py_dcerpc_ndr_pointer_deref(ndr_pointer_Type, value); if (value == NULL) { return -1; } if (value == Py_None) { *object->out.unknown5a = NULL; } else { *object->out.unknown5a = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } *object->out.unknown5a = talloc_str; } } } return 0; } static PyObject *py_PNP_HwProfFlags_in_get_name_length(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_name_length; py_name_length = PyLong_FromUnsignedLongLong((uint32_t)object->in.name_length); return py_name_length; } static int py_PNP_HwProfFlags_in_set_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.name_length"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_HwProfFlags_in_get_flags(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags); return py_flags; } static int py_PNP_HwProfFlags_in_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_HwProfFlags_get_result(PyObject *obj, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_PNP_HwProfFlags_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_PNP_HwProfFlags_getsetters[] = { { .name = discard_const_p(char, "in_action"), .get = py_PNP_HwProfFlags_in_get_action, .set = py_PNP_HwProfFlags_in_set_action, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_devicepath"), .get = py_PNP_HwProfFlags_in_get_devicepath, .set = py_PNP_HwProfFlags_in_set_devicepath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_config"), .get = py_PNP_HwProfFlags_in_get_config, .set = py_PNP_HwProfFlags_in_set_config, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_profile_flags"), .get = py_PNP_HwProfFlags_in_get_profile_flags, .set = py_PNP_HwProfFlags_in_set_profile_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_profile_flags"), .get = py_PNP_HwProfFlags_out_get_profile_flags, .set = py_PNP_HwProfFlags_out_set_profile_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_veto_type"), .get = py_PNP_HwProfFlags_in_get_veto_type, .set = py_PNP_HwProfFlags_in_set_veto_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_veto_type"), .get = py_PNP_HwProfFlags_out_get_veto_type, .set = py_PNP_HwProfFlags_out_set_veto_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_unknown5"), .get = py_PNP_HwProfFlags_in_get_unknown5, .set = py_PNP_HwProfFlags_in_set_unknown5, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_unknown5a"), .get = py_PNP_HwProfFlags_out_get_unknown5a, .set = py_PNP_HwProfFlags_out_set_unknown5a, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_name_length"), .get = py_PNP_HwProfFlags_in_get_name_length, .set = py_PNP_HwProfFlags_in_set_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_flags"), .get = py_PNP_HwProfFlags_in_get_flags, .set = py_PNP_HwProfFlags_in_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_PNP_HwProfFlags_get_result, .set = py_PNP_HwProfFlags_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_PNP_HwProfFlags_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct PNP_HwProfFlags, type); struct PNP_HwProfFlags *_self = (struct PNP_HwProfFlags *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.profile_flags = talloc_zero(mem_ctx, uint32_t); _self->out.profile_flags = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_PNP_HwProfFlags_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(40); } static PyObject *py_PNP_HwProfFlags_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_HwProfFlags_ndr_pack"); return NULL; } call = &ndr_table_ntsvcs.calls[40]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_PNP_HwProfFlags_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_HwProfFlags_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_PNP_HwProfFlags_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_HwProfFlags_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_PNP_HwProfFlags_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_HwProfFlags_ndr_unpack"); return NULL; } call = &ndr_table_ntsvcs.calls[40]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_PNP_HwProfFlags_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_HwProfFlags_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_HwProfFlags_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_HwProfFlags_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_HwProfFlags_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct PNP_HwProfFlags *object = (struct PNP_HwProfFlags *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_ntsvcs.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_HwProfFlags_ndr_print"); return NULL; } call = &ndr_table_ntsvcs.calls[40]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_PNP_HwProfFlags_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_HwProfFlags_ndr_print(py_obj, "PNP_HwProfFlags_in", NDR_IN); } static PyObject *py_PNP_HwProfFlags_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_HwProfFlags_ndr_print(py_obj, "PNP_HwProfFlags_out", NDR_OUT); } static PyMethodDef py_PNP_HwProfFlags_methods[] = { { "opnum", (PyCFunction)py_PNP_HwProfFlags_ndr_opnum, METH_NOARGS|METH_CLASS, "ntsvcs.PNP_HwProfFlags.opnum() -> 40 (0x28) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_HwProfFlags_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_HwProfFlags_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_HwProfFlags_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_HwProfFlags_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_PNP_HwProfFlags_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_PNP_HwProfFlags_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject PNP_HwProfFlags_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_HwProfFlags", .tp_getset = py_PNP_HwProfFlags_getsetters, .tp_methods = py_PNP_HwProfFlags_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_HwProfFlags_new, }; static bool pack_py_PNP_HwProfFlags_args_in(PyObject *args, PyObject *kwargs, struct PNP_HwProfFlags *r) { PyObject *py_action; PyObject *py_devicepath; PyObject *py_config; PyObject *py_profile_flags; PyObject *py_veto_type; PyObject *py_unknown5; PyObject *py_name_length; PyObject *py_flags; const char *kwnames[] = { "action", "devicepath", "config", "profile_flags", "veto_type", "unknown5", "name_length", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOOO:PNP_HwProfFlags", discard_const_p(char *, kwnames), &py_action, &py_devicepath, &py_config, &py_profile_flags, &py_veto_type, &py_unknown5, &py_name_length, &py_flags)) { return false; } if (py_action == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.action"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.action)); if (PyLong_Check(py_action)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_action); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.action = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_devicepath == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.devicepath"); return false; } r->in.devicepath = talloc_ptrtype(r, r->in.devicepath); if (r->in.devicepath == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_devicepath)) { unicode = PyUnicode_AsEncodedString(py_devicepath, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_devicepath)) { test_str = PyBytes_AS_STRING(py_devicepath); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicepath)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.devicepath = talloc_str; } if (py_config == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.config"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.config)); if (PyLong_Check(py_config)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_config); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.config = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_profile_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.profile_flags"); return false; } r->in.profile_flags = talloc_ptrtype(r, r->in.profile_flags); if (r->in.profile_flags == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.profile_flags)); if (PyLong_Check(py_profile_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_profile_flags); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.profile_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_veto_type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.veto_type"); return false; } if (py_veto_type == Py_None) { r->in.veto_type = NULL; } else { r->in.veto_type = talloc_ptrtype(r, r->in.veto_type); if (r->in.veto_type == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.veto_type)); if (PyLong_Check(py_veto_type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_veto_type); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.veto_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } if (py_unknown5 == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.unknown5"); return false; } if (py_unknown5 == Py_None) { r->in.unknown5 = NULL; } else { r->in.unknown5 = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_unknown5)) { unicode = PyUnicode_AsEncodedString(py_unknown5, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_unknown5)) { test_str = PyBytes_AS_STRING(py_unknown5); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_unknown5)->tp_name); return false; } talloc_str = talloc_strdup(r, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return false; } r->in.unknown5 = talloc_str; } } if (py_name_length == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.name_length"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.name_length)); if (PyLong_Check(py_name_length)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_name_length); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags)); if (PyLong_Check(py_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_flags); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_PNP_HwProfFlags_args_out(struct PNP_HwProfFlags *r) { PyObject *result; PyObject *py_profile_flags; PyObject *py_veto_type; PyObject *py_unknown5a; result = PyTuple_New(3); py_profile_flags = PyLong_FromUnsignedLongLong((uint32_t)*r->out.profile_flags); PyTuple_SetItem(result, 0, py_profile_flags); if (r->out.veto_type == NULL) { py_veto_type = Py_None; Py_INCREF(py_veto_type); } else { py_veto_type = PyLong_FromLong((uint16_t)*r->out.veto_type); } PyTuple_SetItem(result, 1, py_veto_type); if (r->out.unknown5a == NULL) { py_unknown5a = Py_None; Py_INCREF(py_unknown5a); } else { if (*r->out.unknown5a == NULL) { py_unknown5a = Py_None; Py_INCREF(py_unknown5a); } else { if (*r->out.unknown5a == NULL) { py_unknown5a = Py_None; Py_INCREF(py_unknown5a); } else { py_unknown5a = PyUnicode_Decode(*r->out.unknown5a, strlen(*r->out.unknown5a), "utf-8", "ignore"); } } } { PyObject *py_unknown5a_level_0 = py_unknown5a; py_unknown5a = py_dcerpc_ndr_pointer_wrap(ndr_pointer_Type, py_unknown5a_level_0); Py_XDECREF(py_unknown5a_level_0); } PyTuple_SetItem(result, 2, py_unknown5a); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_PNP_GetHwProfInfo_in_get_idx(PyObject *obj, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_idx; py_idx = PyLong_FromUnsignedLongLong((uint32_t)object->in.idx); return py_idx; } static int py_PNP_GetHwProfInfo_in_set_idx(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.idx"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.idx)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.idx = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetHwProfInfo_in_get_info(PyObject *obj, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_info; if (object->in.info == NULL) { Py_RETURN_NONE; } py_info = pytalloc_reference_ex(&PNP_HwProfInfo_Type, object->in.info, object->in.info); return py_info; } static int py_PNP_GetHwProfInfo_in_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.info)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info"); return -1; } object->in.info = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.info); if (object->in.info == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PNP_HwProfInfo_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->in.info = (struct PNP_HwProfInfo *)pytalloc_get_ptr(value); return 0; } static PyObject *py_PNP_GetHwProfInfo_out_get_info(PyObject *obj, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_info; if (object->out.info == NULL) { Py_RETURN_NONE; } py_info = pytalloc_reference_ex(&PNP_HwProfInfo_Type, object->out.info, object->out.info); return py_info; } static int py_PNP_GetHwProfInfo_out_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.info)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.info"); return -1; } object->out.info = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.info); if (object->out.info == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PNP_HwProfInfo_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->out.info = (struct PNP_HwProfInfo *)pytalloc_get_ptr(value); return 0; } static PyObject *py_PNP_GetHwProfInfo_in_get_size(PyObject *obj, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_size; py_size = PyLong_FromUnsignedLongLong((uint32_t)object->in.size); return py_size; } static int py_PNP_GetHwProfInfo_in_set_size(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetHwProfInfo_in_get_flags(PyObject *obj, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.flags); return py_flags; } static int py_PNP_GetHwProfInfo_in_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_PNP_GetHwProfInfo_get_result(PyObject *obj, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_PNP_GetHwProfInfo_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_PNP_GetHwProfInfo_getsetters[] = { { .name = discard_const_p(char, "in_idx"), .get = py_PNP_GetHwProfInfo_in_get_idx, .set = py_PNP_GetHwProfInfo_in_set_idx, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_info"), .get = py_PNP_GetHwProfInfo_in_get_info, .set = py_PNP_GetHwProfInfo_in_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type PNP_HwProfInfo") }, { .name = discard_const_p(char, "out_info"), .get = py_PNP_GetHwProfInfo_out_get_info, .set = py_PNP_GetHwProfInfo_out_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type PNP_HwProfInfo") }, { .name = discard_const_p(char, "in_size"), .get = py_PNP_GetHwProfInfo_in_get_size, .set = py_PNP_GetHwProfInfo_in_set_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_flags"), .get = py_PNP_GetHwProfInfo_in_get_flags, .set = py_PNP_GetHwProfInfo_in_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_PNP_GetHwProfInfo_get_result, .set = py_PNP_GetHwProfInfo_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_PNP_GetHwProfInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct PNP_GetHwProfInfo, type); struct PNP_GetHwProfInfo *_self = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.info = talloc_zero(mem_ctx, struct PNP_HwProfInfo); _self->out.info = talloc_zero(mem_ctx, struct PNP_HwProfInfo); return self; } static PyObject *py_PNP_GetHwProfInfo_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(41); } static PyObject *py_PNP_GetHwProfInfo_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetHwProfInfo_ndr_pack"); return NULL; } call = &ndr_table_ntsvcs.calls[41]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_PNP_GetHwProfInfo_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetHwProfInfo_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_PNP_GetHwProfInfo_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_PNP_GetHwProfInfo_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_PNP_GetHwProfInfo_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_ntsvcs.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetHwProfInfo_ndr_unpack"); return NULL; } call = &ndr_table_ntsvcs.calls[41]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_PNP_GetHwProfInfo_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetHwProfInfo_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetHwProfInfo_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_PNP_GetHwProfInfo_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_PNP_GetHwProfInfo_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct PNP_GetHwProfInfo *object = (struct PNP_GetHwProfInfo *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_ntsvcs.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_PNP_GetHwProfInfo_ndr_print"); return NULL; } call = &ndr_table_ntsvcs.calls[41]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_PNP_GetHwProfInfo_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetHwProfInfo_ndr_print(py_obj, "PNP_GetHwProfInfo_in", NDR_IN); } static PyObject *py_PNP_GetHwProfInfo_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_PNP_GetHwProfInfo_ndr_print(py_obj, "PNP_GetHwProfInfo_out", NDR_OUT); } static PyMethodDef py_PNP_GetHwProfInfo_methods[] = { { "opnum", (PyCFunction)py_PNP_GetHwProfInfo_ndr_opnum, METH_NOARGS|METH_CLASS, "ntsvcs.PNP_GetHwProfInfo.opnum() -> 41 (0x29) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetHwProfInfo_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetHwProfInfo_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetHwProfInfo_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PNP_GetHwProfInfo_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_PNP_GetHwProfInfo_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_PNP_GetHwProfInfo_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject PNP_GetHwProfInfo_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.PNP_GetHwProfInfo", .tp_getset = py_PNP_GetHwProfInfo_getsetters, .tp_methods = py_PNP_GetHwProfInfo_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_PNP_GetHwProfInfo_new, }; static bool pack_py_PNP_GetHwProfInfo_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetHwProfInfo *r) { PyObject *py_idx; PyObject *py_info; PyObject *py_size; PyObject *py_flags; const char *kwnames[] = { "idx", "info", "size", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:PNP_GetHwProfInfo", discard_const_p(char *, kwnames), &py_idx, &py_info, &py_size, &py_flags)) { return false; } if (py_idx == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.idx"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.idx)); if (PyLong_Check(py_idx)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_idx); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.idx = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_info == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info"); return false; } r->in.info = talloc_ptrtype(r, r->in.info); if (r->in.info == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PNP_HwProfInfo_Type, py_info, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_info)) == NULL) { PyErr_NoMemory(); return false; } r->in.info = (struct PNP_HwProfInfo *)pytalloc_get_ptr(py_info); if (py_size == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.size"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.size)); if (PyLong_Check(py_size)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_size); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.flags)); if (PyLong_Check(py_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_flags); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } r->in.flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_PNP_GetHwProfInfo_args_out(struct PNP_GetHwProfInfo *r) { PyObject *result; PyObject *py_info; py_info = pytalloc_reference_ex(&PNP_HwProfInfo_Type, r->out.info, r->out.info); result = py_info; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } const struct PyNdrRpcMethodDef py_ndr_ntsvcs_methods[] = { { "PNP_GetVersion", "S.PNP_GetVersion() -> version", (py_dcerpc_call_fn)dcerpc_PNP_GetVersion_r, (py_data_pack_fn)pack_py_PNP_GetVersion_args_in, (py_data_unpack_fn)unpack_py_PNP_GetVersion_args_out, 2, &ndr_table_ntsvcs }, { "PNP_ValidateDeviceInstance", "S.PNP_ValidateDeviceInstance(devicepath, flags) -> None", (py_dcerpc_call_fn)dcerpc_PNP_ValidateDeviceInstance_r, (py_data_pack_fn)pack_py_PNP_ValidateDeviceInstance_args_in, (py_data_unpack_fn)unpack_py_PNP_ValidateDeviceInstance_args_out, 6, &ndr_table_ntsvcs }, { "PNP_GetDeviceList", "S.PNP_GetDeviceList(filter, flags) -> buffer", (py_dcerpc_call_fn)dcerpc_PNP_GetDeviceList_r, (py_data_pack_fn)pack_py_PNP_GetDeviceList_args_in, (py_data_unpack_fn)unpack_py_PNP_GetDeviceList_args_out, 10, &ndr_table_ntsvcs }, { "PNP_GetDeviceListSize", "S.PNP_GetDeviceListSize(devicename, flags) -> size", (py_dcerpc_call_fn)dcerpc_PNP_GetDeviceListSize_r, (py_data_pack_fn)pack_py_PNP_GetDeviceListSize_args_in, (py_data_unpack_fn)unpack_py_PNP_GetDeviceListSize_args_out, 11, &ndr_table_ntsvcs }, { "PNP_GetDeviceRegProp", "S.PNP_GetDeviceRegProp(devicepath, property, reg_data_type, needed, flags) -> (reg_data_type, buffer, needed)", (py_dcerpc_call_fn)dcerpc_PNP_GetDeviceRegProp_r, (py_data_pack_fn)pack_py_PNP_GetDeviceRegProp_args_in, (py_data_unpack_fn)unpack_py_PNP_GetDeviceRegProp_args_out, 13, &ndr_table_ntsvcs }, { "PNP_HwProfFlags", "S.PNP_HwProfFlags(action, devicepath, config, profile_flags, veto_type, unknown5, name_length, flags) -> (profile_flags, veto_type, unknown5a)", (py_dcerpc_call_fn)dcerpc_PNP_HwProfFlags_r, (py_data_pack_fn)pack_py_PNP_HwProfFlags_args_in, (py_data_unpack_fn)unpack_py_PNP_HwProfFlags_args_out, 40, &ndr_table_ntsvcs }, { "PNP_GetHwProfInfo", "S.PNP_GetHwProfInfo(idx, info, size, flags) -> info", (py_dcerpc_call_fn)dcerpc_PNP_GetHwProfInfo_r, (py_data_pack_fn)pack_py_PNP_GetHwProfInfo_args_in, (py_data_unpack_fn)unpack_py_PNP_GetHwProfInfo_args_out, 41, &ndr_table_ntsvcs }, {0} }; static PyObject *interface_ntsvcs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_ntsvcs); } #define PY_DOC_NTSVCS "Plug and Play services" static PyTypeObject ntsvcs_InterfaceType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.ntsvcs", .tp_basicsize = sizeof(dcerpc_InterfaceObject), .tp_doc = "ntsvcs(binding, lp_ctx=None, credentials=None) -> connection\n" "\n" "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n" "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n" "credentials should be a credentials.Credentials object.\n\n"PY_DOC_NTSVCS, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = interface_ntsvcs_new, }; static PyObject *syntax_ntsvcs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_ntsvcs.syntax_id); } #define PY_DOC_NTSVCS_SYNTAX "Plug and Play services" static PyTypeObject ntsvcs_SyntaxType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "ntsvcs.ntsvcs_abstract_syntax", .tp_doc = "ntsvcs_abstract_syntax()\n"PY_DOC_NTSVCS_SYNTAX, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = syntax_ntsvcs_new, }; static PyMethodDef ntsvcs_methods[] = { { NULL, NULL, 0, NULL } }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "ntsvcs", .m_doc = "ntsvcs DCE/RPC", .m_size = -1, .m_methods = ntsvcs_methods, }; MODULE_INIT_FUNC(ntsvcs) { PyObject *m = NULL; PyObject *dep_samba_dcerpc_misc = NULL; PyObject *dep_talloc = NULL; PyObject *dep_samba_dcerpc_base = NULL; dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc"); if (dep_samba_dcerpc_misc == NULL) goto out; dep_talloc = PyImport_ImportModule("talloc"); if (dep_talloc == NULL) goto out; dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base"); if (dep_samba_dcerpc_base == NULL) goto out; BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject"); if (BaseObject_Type == NULL) goto out; ndr_pointer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ndr_pointer"); if (ndr_pointer_Type == NULL) goto out; ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection"); if (ClientConnection_Type == NULL) goto out; ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id"); if (ndr_syntax_id_Type == NULL) goto out; PNP_HwProfInfo_Type.tp_base = BaseObject_Type; PNP_HwProfInfo_Type.tp_basicsize = pytalloc_BaseObject_size(); PNP_GetVersion_Type.tp_base = BaseObject_Type; PNP_GetVersion_Type.tp_basicsize = pytalloc_BaseObject_size(); PNP_ValidateDeviceInstance_Type.tp_base = BaseObject_Type; PNP_ValidateDeviceInstance_Type.tp_basicsize = pytalloc_BaseObject_size(); PNP_GetDeviceList_Type.tp_base = BaseObject_Type; PNP_GetDeviceList_Type.tp_basicsize = pytalloc_BaseObject_size(); PNP_GetDeviceListSize_Type.tp_base = BaseObject_Type; PNP_GetDeviceListSize_Type.tp_basicsize = pytalloc_BaseObject_size(); PNP_GetDeviceRegProp_Type.tp_base = BaseObject_Type; PNP_GetDeviceRegProp_Type.tp_basicsize = pytalloc_BaseObject_size(); PNP_HwProfFlags_Type.tp_base = BaseObject_Type; PNP_HwProfFlags_Type.tp_basicsize = pytalloc_BaseObject_size(); PNP_GetHwProfInfo_Type.tp_base = BaseObject_Type; PNP_GetHwProfInfo_Type.tp_basicsize = pytalloc_BaseObject_size(); ntsvcs_InterfaceType.tp_base = ClientConnection_Type; ntsvcs_SyntaxType.tp_base = ndr_syntax_id_Type; ntsvcs_SyntaxType.tp_basicsize = pytalloc_BaseObject_size(); if (PyType_Ready(&PNP_HwProfInfo_Type) < 0) goto out; if (PyType_Ready(&PNP_GetVersion_Type) < 0) goto out; if (PyType_Ready(&PNP_ValidateDeviceInstance_Type) < 0) goto out; if (PyType_Ready(&PNP_GetDeviceList_Type) < 0) goto out; if (PyType_Ready(&PNP_GetDeviceListSize_Type) < 0) goto out; if (PyType_Ready(&PNP_GetDeviceRegProp_Type) < 0) goto out; if (PyType_Ready(&PNP_HwProfFlags_Type) < 0) goto out; if (PyType_Ready(&PNP_GetHwProfInfo_Type) < 0) goto out; if (PyType_Ready(&ntsvcs_InterfaceType) < 0) goto out; if (PyType_Ready(&ntsvcs_SyntaxType) < 0) goto out; if (!PyInterface_AddNdrRpcMethods(&ntsvcs_InterfaceType, py_ndr_ntsvcs_methods)) return NULL; #ifdef PY_PNP_HWPROFINFO_PATCH PY_PNP_HWPROFINFO_PATCH(&PNP_HwProfInfo_Type); #endif #ifdef PY_PNP_GETVERSION_PATCH PY_PNP_GETVERSION_PATCH(&PNP_GetVersion_Type); #endif #ifdef PY_PNP_VALIDATEDEVICEINSTANCE_PATCH PY_PNP_VALIDATEDEVICEINSTANCE_PATCH(&PNP_ValidateDeviceInstance_Type); #endif #ifdef PY_PNP_GETDEVICELIST_PATCH PY_PNP_GETDEVICELIST_PATCH(&PNP_GetDeviceList_Type); #endif #ifdef PY_PNP_GETDEVICELISTSIZE_PATCH PY_PNP_GETDEVICELISTSIZE_PATCH(&PNP_GetDeviceListSize_Type); #endif #ifdef PY_PNP_GETDEVICEREGPROP_PATCH PY_PNP_GETDEVICEREGPROP_PATCH(&PNP_GetDeviceRegProp_Type); #endif #ifdef PY_PNP_HWPROFFLAGS_PATCH PY_PNP_HWPROFFLAGS_PATCH(&PNP_HwProfFlags_Type); #endif #ifdef PY_PNP_GETHWPROFINFO_PATCH PY_PNP_GETHWPROFINFO_PATCH(&PNP_GetHwProfInfo_Type); #endif #ifdef PY_NTSVCS_PATCH PY_NTSVCS_PATCH(&ntsvcs_InterfaceType); #endif #ifdef PY_NTSVCS_ABSTRACT_SYNTAX_PATCH PY_NTSVCS_ABSTRACT_SYNTAX_PATCH(&ntsvcs_SyntaxType); #endif #ifdef PY_ABSTRACT_SYNTAX_PATCH PY_ABSTRACT_SYNTAX_PATCH(&ntsvcs_SyntaxType); #endif m = PyModule_Create(&moduledef); if (m == NULL) goto out; PyModule_AddObject(m, "CM_GETIDLIST_FILTER_NONE", PyLong_FromUnsignedLongLong(0x00000000)); PyModule_AddObject(m, "DEV_REGPROP_DESC", PyLong_FromUnsignedLongLong(1)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_ENUMERATOR", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_ENUMERATOR)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_SERVICE", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_SERVICE)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_EJECTRELATIONS", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_EJECTRELATIONS)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_REMOVALRELATIONS", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_REMOVALRELATIONS)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_POWERRELATIONS", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_POWERRELATIONS)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_BUSRELATIONS", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_BUSRELATIONS)); PyModule_AddObject(m, "CM_GETIDLIST_DONOTGENERATE", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_DONOTGENERATE)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_TRANSPORTRELATIONS", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_TRANSPORTRELATIONS)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_PRESENT", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_PRESENT)); PyModule_AddObject(m, "CM_GETIDLIST_FILTER_CLASS", PyLong_FromUnsignedLongLong((uint32_t)CM_GETIDLIST_FILTER_CLASS)); Py_INCREF((PyObject *)(void *)&PNP_HwProfInfo_Type); PyModule_AddObject(m, "PNP_HwProfInfo", (PyObject *)(void *)&PNP_HwProfInfo_Type); Py_INCREF((PyObject *)(void *)&PNP_GetVersion_Type); PyModule_AddObject(m, "PNP_GetVersion", (PyObject *)(void *)&PNP_GetVersion_Type); Py_INCREF((PyObject *)(void *)&PNP_ValidateDeviceInstance_Type); PyModule_AddObject(m, "PNP_ValidateDeviceInstance", (PyObject *)(void *)&PNP_ValidateDeviceInstance_Type); Py_INCREF((PyObject *)(void *)&PNP_GetDeviceList_Type); PyModule_AddObject(m, "PNP_GetDeviceList", (PyObject *)(void *)&PNP_GetDeviceList_Type); Py_INCREF((PyObject *)(void *)&PNP_GetDeviceListSize_Type); PyModule_AddObject(m, "PNP_GetDeviceListSize", (PyObject *)(void *)&PNP_GetDeviceListSize_Type); Py_INCREF((PyObject *)(void *)&PNP_GetDeviceRegProp_Type); PyModule_AddObject(m, "PNP_GetDeviceRegProp", (PyObject *)(void *)&PNP_GetDeviceRegProp_Type); Py_INCREF((PyObject *)(void *)&PNP_HwProfFlags_Type); PyModule_AddObject(m, "PNP_HwProfFlags", (PyObject *)(void *)&PNP_HwProfFlags_Type); Py_INCREF((PyObject *)(void *)&PNP_GetHwProfInfo_Type); PyModule_AddObject(m, "PNP_GetHwProfInfo", (PyObject *)(void *)&PNP_GetHwProfInfo_Type); Py_INCREF((PyObject *)(void *)&ntsvcs_InterfaceType); PyModule_AddObject(m, "ntsvcs", (PyObject *)(void *)&ntsvcs_InterfaceType); Py_INCREF((PyObject *)(void *)&ntsvcs_SyntaxType); PyModule_AddObject(m, "ntsvcs_abstract_syntax", (PyObject *)(void *)&ntsvcs_SyntaxType); Py_INCREF((PyObject *)(void *)&ntsvcs_SyntaxType); PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&ntsvcs_SyntaxType); #ifdef PY_MOD_NTSVCS_PATCH PY_MOD_NTSVCS_PATCH(m); #endif out: Py_XDECREF(dep_samba_dcerpc_misc); Py_XDECREF(dep_talloc); Py_XDECREF(dep_samba_dcerpc_base); return m; }