/* 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_winspool.h" #include "bin/default/librpc/gen_ndr/ndr_winspool_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" #include "librpc/gen_ndr/security.h" #include "librpc/gen_ndr/winreg.h" #include "librpc/gen_ndr/spoolss.h" static PyTypeObject winspool_NOTIFY_REPLY_CONTAINER_Type; static PyTypeObject winspool_NOTIFY_OPTIONS_CONTAINER_Type; static PyTypeObject winspool_PrintPropertyValueUnion_Type; static PyTypeObject winspool_PrintPropertyValue_Type; static PyTypeObject winspool_PrintNamedProperty_Type; static PyTypeObject winspool_PrintPropertiesCollection_Type; static PyTypeObject iremotewinspool_InterfaceType; static PyTypeObject winspool_AsyncOpenPrinter_Type; static PyTypeObject winspool_AsyncAddPrinter_Type; static PyTypeObject winspool_AsyncSetJob_Type; static PyTypeObject winspool_AsyncGetJob_Type; static PyTypeObject winspool_AsyncEnumJobs_Type; static PyTypeObject winspool_AsyncAddJob_Type; static PyTypeObject winspool_AsyncScheduleJob_Type; static PyTypeObject winspool_AsyncDeletePrinter_Type; static PyTypeObject winspool_AsyncSetPrinter_Type; static PyTypeObject winspool_AsyncGetPrinter_Type; static PyTypeObject winspool_AsyncStartDocPrinter_Type; static PyTypeObject winspool_AsyncStartPagePrinter_Type; static PyTypeObject winspool_AsyncWritePrinter_Type; static PyTypeObject winspool_AsyncEndPagePrinter_Type; static PyTypeObject winspool_AsyncEndDocPrinter_Type; static PyTypeObject winspool_AsyncAbortPrinter_Type; static PyTypeObject winspool_AsyncGetPrinterData_Type; static PyTypeObject winspool_AsyncGetPrinterDataEx_Type; static PyTypeObject winspool_AsyncSetPrinterData_Type; static PyTypeObject winspool_AsyncSetPrinterDataEx_Type; static PyTypeObject winspool_AsyncClosePrinter_Type; static PyTypeObject winspool_AsyncAddForm_Type; static PyTypeObject winspool_AsyncDeleteForm_Type; static PyTypeObject winspool_AsyncGetForm_Type; static PyTypeObject winspool_AsyncSetForm_Type; static PyTypeObject winspool_AsyncEnumForms_Type; static PyTypeObject winspool_AsyncGetPrinterDriver_Type; static PyTypeObject winspool_AsyncEnumPrinterData_Type; static PyTypeObject winspool_AsyncEnumPrinterDataEx_Type; static PyTypeObject winspool_AsyncEnumPrinterKey_Type; static PyTypeObject winspool_AsyncDeletePrinterData_Type; static PyTypeObject winspool_AsyncDeletePrinterDataEx_Type; static PyTypeObject winspool_AsyncDeletePrinterKey_Type; static PyTypeObject winspool_AsyncXcvData_Type; static PyTypeObject winspool_AsyncSendRecvBidiData_Type; static PyTypeObject winspool_AsyncCreatePrinterIC_Type; static PyTypeObject winspool_AsyncPlayGdiScriptOnPrinterIC_Type; static PyTypeObject winspool_AsyncDeletePrinterIC_Type; static PyTypeObject winspool_AsyncEnumPrinters_Type; static PyTypeObject winspool_AsyncAddPrinterDriver_Type; static PyTypeObject winspool_AsyncEnumPrinterDrivers_Type; static PyTypeObject winspool_AsyncGetPrinterDriverDirectory_Type; static PyTypeObject winspool_AsyncDeletePrinterDriver_Type; static PyTypeObject winspool_AsyncDeletePrinterDriverEx_Type; static PyTypeObject winspool_AsyncAddPrintProcessor_Type; static PyTypeObject winspool_AsyncEnumPrintProcessors_Type; static PyTypeObject winspool_AsyncGetPrintProcessorDirectory_Type; static PyTypeObject winspool_AsyncEnumPorts_Type; static PyTypeObject winspool_AsyncEnumMonitors_Type; static PyTypeObject winspool_AsyncAddPort_Type; static PyTypeObject winspool_AsyncSetPort_Type; static PyTypeObject winspool_AsyncAddMonitor_Type; static PyTypeObject winspool_AsyncDeleteMonitor_Type; static PyTypeObject winspool_AsyncDeletePrintProcessor_Type; static PyTypeObject winspool_AsyncEnumPrintProcessorDatatypes_Type; static PyTypeObject winspool_AsyncAddPerMachineConnection_Type; static PyTypeObject winspool_AsyncDeletePerMachineConnection_Type; static PyTypeObject winspool_AsyncEnumPerMachineConnections_Type; static PyTypeObject winspool_SyncRegisterForRemoteNotifications_Type; static PyTypeObject winspool_SyncUnRegisterForRemoteNotifications_Type; static PyTypeObject winspool_SyncRefreshRemoteNotifications_Type; static PyTypeObject winspool_AsyncGetRemoteNotifications_Type; static PyTypeObject winspool_AsyncInstallPrinterDriverFromPackage_Type; static PyTypeObject winspool_AsyncUploadPrinterDriverPackage_Type; static PyTypeObject winspool_AsyncGetCorePrinterDrivers_Type; static PyTypeObject winspool_AsyncCorePrinterDriverInstalled_Type; static PyTypeObject winspool_AsyncGetPrinterDriverPackagePath_Type; static PyTypeObject winspool_AsyncDeletePrinterDriverPackage_Type; static PyTypeObject winspool_AsyncReadPrinter_Type; static PyTypeObject winspool_AsyncResetPrinter_Type; static PyTypeObject winspool_AsyncGetJobNamedPropertyValue_Type; static PyTypeObject winspool_AsyncSetJobNamedProperty_Type; static PyTypeObject winspool_AsyncDeleteJobNamedProperty_Type; static PyTypeObject winspool_AsyncEnumJobNamedProperties_Type; static PyTypeObject winspool_AsyncLogJobInfoForBranchOffice_Type; static PyTypeObject *spoolss_NotifyInfo_Type; static PyTypeObject *BaseObject_Type; static PyTypeObject *spoolss_NotifyOption_Type; static PyTypeObject *spoolss_TimeCtr_Type; static PyTypeObject *spoolss_DevmodeContainer_Type; static PyTypeObject *sec_desc_buf_Type; static PyTypeObject *policy_handle_Type; static PyTypeObject *spoolss_UserLevelCtr_Type; static PyTypeObject *spoolss_SetPrinterInfoCtr_Type; static PyTypeObject *spoolss_JobInfoContainer_Type; static PyTypeObject *spoolss_DocumentInfoCtr_Type; static PyTypeObject *spoolss_AddFormInfoCtr_Type; static PyTypeObject *RPC_BIDI_REQUEST_CONTAINER_Type; static PyTypeObject *RPC_BIDI_RESPONSE_CONTAINER_Type; static PyTypeObject *spoolss_AddDriverInfoCtr_Type; static PyTypeObject *spoolss_SetPortInfoContainer_Type; static PyTypeObject *spoolss_PortVarContainer_Type; static PyTypeObject *spoolss_MonitorContainer_Type; static PyTypeObject *spoolss_CorePrinterDriver_Type; static PyTypeObject *GUID_Type; static PyTypeObject *spoolss_PrintPropertyValue_Type; static PyTypeObject *spoolss_PrintNamedProperty_Type; static PyTypeObject *spoolss_BranchOfficeJobDataContainer_Type; static PyTypeObject *ClientConnection_Type; static PyTypeObject *ndr_syntax_id_Type; static PyObject *py_winspool_NOTIFY_REPLY_CONTAINER_get_pInfo(PyObject *obj, void *closure) { struct winspool_NOTIFY_REPLY_CONTAINER *object = (struct winspool_NOTIFY_REPLY_CONTAINER *)pytalloc_get_ptr(obj); PyObject *py_pInfo; if (object->pInfo == NULL) { Py_RETURN_NONE; } if (object->pInfo == NULL) { py_pInfo = Py_None; Py_INCREF(py_pInfo); } else { py_pInfo = pytalloc_reference_ex(spoolss_NotifyInfo_Type, object->pInfo, object->pInfo); } return py_pInfo; } static int py_winspool_NOTIFY_REPLY_CONTAINER_set_pInfo(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_NOTIFY_REPLY_CONTAINER *object = (struct winspool_NOTIFY_REPLY_CONTAINER *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->pInfo)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->pInfo"); return -1; } if (value == Py_None) { object->pInfo = NULL; } else { object->pInfo = NULL; PY_CHECK_TYPE(spoolss_NotifyInfo_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->pInfo = (struct spoolss_NotifyInfo *)pytalloc_get_ptr(value); } return 0; } static PyGetSetDef py_winspool_NOTIFY_REPLY_CONTAINER_getsetters[] = { { .name = discard_const_p(char, "pInfo"), .get = py_winspool_NOTIFY_REPLY_CONTAINER_get_pInfo, .set = py_winspool_NOTIFY_REPLY_CONTAINER_set_pInfo, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_NotifyInfo") }, { .name = NULL } }; static PyObject *py_winspool_NOTIFY_REPLY_CONTAINER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct winspool_NOTIFY_REPLY_CONTAINER, type); } static PyTypeObject winspool_NOTIFY_REPLY_CONTAINER_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.NOTIFY_REPLY_CONTAINER", .tp_getset = py_winspool_NOTIFY_REPLY_CONTAINER_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_NOTIFY_REPLY_CONTAINER_new, }; static PyObject *py_winspool_NOTIFY_OPTIONS_CONTAINER_get_pOptions(PyObject *obj, void *closure) { struct winspool_NOTIFY_OPTIONS_CONTAINER *object = (struct winspool_NOTIFY_OPTIONS_CONTAINER *)pytalloc_get_ptr(obj); PyObject *py_pOptions; if (object->pOptions == NULL) { Py_RETURN_NONE; } if (object->pOptions == NULL) { py_pOptions = Py_None; Py_INCREF(py_pOptions); } else { py_pOptions = pytalloc_reference_ex(spoolss_NotifyOption_Type, object->pOptions, object->pOptions); } return py_pOptions; } static int py_winspool_NOTIFY_OPTIONS_CONTAINER_set_pOptions(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_NOTIFY_OPTIONS_CONTAINER *object = (struct winspool_NOTIFY_OPTIONS_CONTAINER *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->pOptions)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->pOptions"); return -1; } if (value == Py_None) { object->pOptions = NULL; } else { object->pOptions = NULL; PY_CHECK_TYPE(spoolss_NotifyOption_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->pOptions = (struct spoolss_NotifyOption *)pytalloc_get_ptr(value); } return 0; } static PyGetSetDef py_winspool_NOTIFY_OPTIONS_CONTAINER_getsetters[] = { { .name = discard_const_p(char, "pOptions"), .get = py_winspool_NOTIFY_OPTIONS_CONTAINER_get_pOptions, .set = py_winspool_NOTIFY_OPTIONS_CONTAINER_set_pOptions, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_NotifyOption") }, { .name = NULL } }; static PyObject *py_winspool_NOTIFY_OPTIONS_CONTAINER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct winspool_NOTIFY_OPTIONS_CONTAINER, type); } static PyTypeObject winspool_NOTIFY_OPTIONS_CONTAINER_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.NOTIFY_OPTIONS_CONTAINER", .tp_getset = py_winspool_NOTIFY_OPTIONS_CONTAINER_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_NOTIFY_OPTIONS_CONTAINER_new, }; static PyObject *py_import_winspool_PrintPropertyValueUnion(TALLOC_CTX *mem_ctx, int level, union winspool_PrintPropertyValueUnion *in) { PyObject *ret; switch (level) { case winspool_PropertyTypeString: if (in->propertyString == NULL) { ret = Py_None; Py_INCREF(ret); } else { if (in->propertyString == NULL) { ret = Py_None; Py_INCREF(ret); } else { ret = PyUnicode_Decode(in->propertyString, strlen(in->propertyString), "utf-8", "ignore"); } } return ret; case winspool_PropertyTypeInt32: ret = PyLong_FromUnsignedLongLong((uint32_t)in->propertyInt32); return ret; case winspool_PropertyTypeInt64: ret = PyLong_FromUnsignedLongLong(in->propertyInt64); return ret; case winspool_PropertyTypeByte: ret = PyLong_FromLong((uint16_t)in->propertyByte); return ret; case winspool_PropertyTypeTime: ret = pytalloc_reference_ex(spoolss_TimeCtr_Type, mem_ctx, &in->propertyTimeContainer); return ret; case winspool_PropertyTypeDevMode: ret = pytalloc_reference_ex(spoolss_DevmodeContainer_Type, mem_ctx, &in->propertyDevModeContainer); return ret; case winspool_PropertyTypeSD: ret = pytalloc_reference_ex(sec_desc_buf_Type, mem_ctx, &in->propertySDContainer); return ret; case winspool_PropertyTypeNotificationReply: ret = pytalloc_reference_ex(&winspool_NOTIFY_REPLY_CONTAINER_Type, mem_ctx, &in->propertyReplyContainer); return ret; case winspool_PropertyTypeNotificationOptions: ret = pytalloc_reference_ex(&winspool_NOTIFY_OPTIONS_CONTAINER_Type, mem_ctx, &in->propertyOptionsContainer); return ret; } PyErr_SetString(PyExc_TypeError, "unknown union level"); return NULL; } static union winspool_PrintPropertyValueUnion *py_export_winspool_PrintPropertyValueUnion(TALLOC_CTX *mem_ctx, int level, PyObject *in) { union winspool_PrintPropertyValueUnion *ret = talloc_zero(mem_ctx, union winspool_PrintPropertyValueUnion); switch (level) { case winspool_PropertyTypeString: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyString"); talloc_free(ret); return NULL; } if (in == Py_None) { ret->propertyString = NULL; } else { ret->propertyString = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(in)) { unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(in)) { test_str = PyBytes_AS_STRING(in); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name); talloc_free(ret); return NULL; } talloc_str = talloc_strdup(mem_ctx, test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->propertyString = talloc_str; } } break; case winspool_PropertyTypeInt32: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyInt32"); talloc_free(ret); return NULL; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->propertyInt32)); if (PyLong_Check(in)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(in); if (PyErr_Occurred() != NULL) { talloc_free(ret); return NULL; } 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); talloc_free(ret); return NULL; } ret->propertyInt32 = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); talloc_free(ret); return NULL; } } break; case winspool_PropertyTypeInt64: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyInt64"); talloc_free(ret); return NULL; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->propertyInt64)); if (PyLong_Check(in)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(in); if (PyErr_Occurred() != NULL) { talloc_free(ret); return NULL; } 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); talloc_free(ret); return NULL; } ret->propertyInt64 = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); talloc_free(ret); return NULL; } } break; case winspool_PropertyTypeByte: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyByte"); talloc_free(ret); return NULL; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->propertyByte)); if (PyLong_Check(in)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(in); if (PyErr_Occurred() != NULL) { talloc_free(ret); return NULL; } 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); talloc_free(ret); return NULL; } ret->propertyByte = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); talloc_free(ret); return NULL; } } break; case winspool_PropertyTypeTime: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyTimeContainer"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(spoolss_TimeCtr_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->propertyTimeContainer = *(struct spoolss_TimeCtr *)pytalloc_get_ptr(in); break; case winspool_PropertyTypeDevMode: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyDevModeContainer"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(spoolss_DevmodeContainer_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->propertyDevModeContainer = *(struct spoolss_DevmodeContainer *)pytalloc_get_ptr(in); break; case winspool_PropertyTypeSD: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertySDContainer"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(sec_desc_buf_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->propertySDContainer = *(struct sec_desc_buf *)pytalloc_get_ptr(in); break; case winspool_PropertyTypeNotificationReply: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyReplyContainer"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&winspool_NOTIFY_REPLY_CONTAINER_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->propertyReplyContainer = *(struct winspool_NOTIFY_REPLY_CONTAINER *)pytalloc_get_ptr(in); break; case winspool_PropertyTypeNotificationOptions: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->propertyOptionsContainer"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&winspool_NOTIFY_OPTIONS_CONTAINER_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->propertyOptionsContainer = *(struct winspool_NOTIFY_OPTIONS_CONTAINER *)pytalloc_get_ptr(in); break; default: PyErr_SetString(PyExc_TypeError, "invalid union level value"); talloc_free(ret); ret = NULL; } return ret; } static PyObject *py_winspool_PrintPropertyValueUnion_import(PyTypeObject *type, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "mem_ctx", "level", "in", NULL }; PyObject *mem_ctx_obj = NULL; TALLOC_CTX *mem_ctx = NULL; int level = 0; PyObject *in_obj = NULL; union winspool_PrintPropertyValueUnion *in = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import", discard_const_p(char *, kwnames), &mem_ctx_obj, &level, &in_obj)) { return NULL; } mem_ctx = pytalloc_get_ptr(mem_ctx_obj); if (mem_ctx == NULL) { PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!"); return NULL; } in = (union winspool_PrintPropertyValueUnion *)pytalloc_get_ptr(in_obj); if (in == NULL) { PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union winspool_PrintPropertyValueUnion!"); return NULL; } return py_import_winspool_PrintPropertyValueUnion(mem_ctx, level, in); } static PyObject *py_winspool_PrintPropertyValueUnion_export(PyTypeObject *type, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "mem_ctx", "level", "in", NULL }; PyObject *mem_ctx_obj = NULL; TALLOC_CTX *mem_ctx = NULL; int level = 0; PyObject *in = NULL; union winspool_PrintPropertyValueUnion *out = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export", discard_const_p(char *, kwnames), &mem_ctx_obj, &level, &in)) { return NULL; } mem_ctx = pytalloc_get_ptr(mem_ctx_obj); if (mem_ctx == NULL) { PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!"); return NULL; } out = py_export_winspool_PrintPropertyValueUnion(mem_ctx, level, in); if (out == NULL) { return NULL; } return pytalloc_GenericObject_reference(out); } static PyMethodDef py_winspool_PrintPropertyValueUnion_methods[] = { { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_PrintPropertyValueUnion_import), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__import__(mem_ctx, level, in) => ret." }, { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_PrintPropertyValueUnion_export), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__export__(mem_ctx, level, in) => ret." }, { NULL, NULL, 0, NULL } }; static PyObject *py_winspool_PrintPropertyValueUnion_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name); return NULL; } static PyTypeObject winspool_PrintPropertyValueUnion_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.PrintPropertyValueUnion", .tp_getset = NULL, .tp_methods = py_winspool_PrintPropertyValueUnion_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_PrintPropertyValueUnion_new, }; static PyObject *py_winspool_PrintPropertyValue_get_PropertyType(PyObject *obj, void *closure) { struct winspool_PrintPropertyValue *object = (struct winspool_PrintPropertyValue *)pytalloc_get_ptr(obj); PyObject *py_PropertyType; py_PropertyType = PyLong_FromLong((uint16_t)object->PropertyType); return py_PropertyType; } static int py_winspool_PrintPropertyValue_set_PropertyType(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_PrintPropertyValue *object = (struct winspool_PrintPropertyValue *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->PropertyType"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->PropertyType)); 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->PropertyType = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_PrintPropertyValue_get_value(PyObject *obj, void *closure) { struct winspool_PrintPropertyValue *object = (struct winspool_PrintPropertyValue *)pytalloc_get_ptr(obj); PyObject *py_value; py_value = pyrpc_import_union(&winspool_PrintPropertyValueUnion_Type, pytalloc_get_mem_ctx(obj), object->PropertyType, &object->value, "union winspool_PrintPropertyValueUnion"); if (py_value == NULL) { return NULL; } return py_value; } static int py_winspool_PrintPropertyValue_set_value(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_PrintPropertyValue *object = (struct winspool_PrintPropertyValue *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->value"); return -1; } { union winspool_PrintPropertyValueUnion *value_switch_0; value_switch_0 = (union winspool_PrintPropertyValueUnion *)pyrpc_export_union(&winspool_PrintPropertyValueUnion_Type, pytalloc_get_mem_ctx(py_obj), object->PropertyType, value, "union winspool_PrintPropertyValueUnion"); if (value_switch_0 == NULL) { return -1; } object->value = *value_switch_0; } return 0; } static PyGetSetDef py_winspool_PrintPropertyValue_getsetters[] = { { .name = discard_const_p(char, "PropertyType"), .get = py_winspool_PrintPropertyValue_get_PropertyType, .set = py_winspool_PrintPropertyValue_set_PropertyType, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintPropertyType") }, { .name = discard_const_p(char, "value"), .get = py_winspool_PrintPropertyValue_get_value, .set = py_winspool_PrintPropertyValue_set_value, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintPropertyValueUnion") }, { .name = NULL } }; static PyObject *py_winspool_PrintPropertyValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct winspool_PrintPropertyValue, type); } static PyTypeObject winspool_PrintPropertyValue_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.PrintPropertyValue", .tp_getset = py_winspool_PrintPropertyValue_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_PrintPropertyValue_new, }; static PyObject *py_winspool_PrintNamedProperty_get_propertyName(PyObject *obj, void *closure) { struct winspool_PrintNamedProperty *object = (struct winspool_PrintNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_propertyName; if (object->propertyName == NULL) { Py_RETURN_NONE; } if (object->propertyName == NULL) { py_propertyName = Py_None; Py_INCREF(py_propertyName); } else { if (object->propertyName == NULL) { py_propertyName = Py_None; Py_INCREF(py_propertyName); } else { py_propertyName = PyUnicode_Decode(object->propertyName, strlen(object->propertyName), "utf-8", "ignore"); } } return py_propertyName; } static int py_winspool_PrintNamedProperty_set_propertyName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_PrintNamedProperty *object = (struct winspool_PrintNamedProperty *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->propertyName"); return -1; } if (value == Py_None) { object->propertyName = NULL; } else { object->propertyName = 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->propertyName = talloc_str; } } return 0; } static PyObject *py_winspool_PrintNamedProperty_get_propertyValue(PyObject *obj, void *closure) { struct winspool_PrintNamedProperty *object = (struct winspool_PrintNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_propertyValue; py_propertyValue = pytalloc_reference_ex(&winspool_PrintPropertyValue_Type, pytalloc_get_mem_ctx(obj), &object->propertyValue); return py_propertyValue; } static int py_winspool_PrintNamedProperty_set_propertyValue(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_PrintNamedProperty *object = (struct winspool_PrintNamedProperty *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->propertyValue"); return -1; } PY_CHECK_TYPE(&winspool_PrintPropertyValue_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->propertyValue = *(struct winspool_PrintPropertyValue *)pytalloc_get_ptr(value); return 0; } static PyGetSetDef py_winspool_PrintNamedProperty_getsetters[] = { { .name = discard_const_p(char, "propertyName"), .get = py_winspool_PrintNamedProperty_get_propertyName, .set = py_winspool_PrintNamedProperty_set_propertyName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "propertyValue"), .get = py_winspool_PrintNamedProperty_get_propertyValue, .set = py_winspool_PrintNamedProperty_set_propertyValue, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintPropertyValue") }, { .name = NULL } }; static PyObject *py_winspool_PrintNamedProperty_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct winspool_PrintNamedProperty, type); } static PyTypeObject winspool_PrintNamedProperty_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.PrintNamedProperty", .tp_getset = py_winspool_PrintNamedProperty_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_PrintNamedProperty_new, }; static PyObject *py_winspool_PrintPropertiesCollection_get_numberOfProperties(PyObject *obj, void *closure) { struct winspool_PrintPropertiesCollection *object = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(obj); PyObject *py_numberOfProperties; py_numberOfProperties = PyLong_FromUnsignedLongLong((uint32_t)object->numberOfProperties); return py_numberOfProperties; } static int py_winspool_PrintPropertiesCollection_set_numberOfProperties(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_PrintPropertiesCollection *object = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->numberOfProperties"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->numberOfProperties)); 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->numberOfProperties = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_PrintPropertiesCollection_get_propertiesCollection(PyObject *obj, void *closure) { struct winspool_PrintPropertiesCollection *object = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(obj); PyObject *py_propertiesCollection; if (object->propertiesCollection == NULL) { Py_RETURN_NONE; } if (object->propertiesCollection == NULL) { py_propertiesCollection = Py_None; Py_INCREF(py_propertiesCollection); } else { py_propertiesCollection = PyList_New(object->numberOfProperties); if (py_propertiesCollection == NULL) { return NULL; } { int propertiesCollection_cntr_1; for (propertiesCollection_cntr_1 = 0; propertiesCollection_cntr_1 < (object->numberOfProperties); propertiesCollection_cntr_1++) { PyObject *py_propertiesCollection_1; py_propertiesCollection_1 = pytalloc_reference_ex(&winspool_PrintNamedProperty_Type, object->propertiesCollection, &object->propertiesCollection[propertiesCollection_cntr_1]); PyList_SetItem(py_propertiesCollection, propertiesCollection_cntr_1, py_propertiesCollection_1); } } } return py_propertiesCollection; } static int py_winspool_PrintPropertiesCollection_set_propertiesCollection(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_PrintPropertiesCollection *object = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->propertiesCollection)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->propertiesCollection"); return -1; } if (value == Py_None) { object->propertiesCollection = NULL; } else { object->propertiesCollection = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int propertiesCollection_cntr_1; object->propertiesCollection = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->propertiesCollection, PyList_GET_SIZE(value)); if (!object->propertiesCollection) { return -1;; } talloc_set_name_const(object->propertiesCollection, "ARRAY: object->propertiesCollection"); for (propertiesCollection_cntr_1 = 0; propertiesCollection_cntr_1 < PyList_GET_SIZE(value); propertiesCollection_cntr_1++) { if (PyList_GET_ITEM(value, propertiesCollection_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->propertiesCollection[propertiesCollection_cntr_1]"); return -1; } PY_CHECK_TYPE(&winspool_PrintNamedProperty_Type, PyList_GET_ITEM(value, propertiesCollection_cntr_1), return -1;); if (talloc_reference(object->propertiesCollection, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, propertiesCollection_cntr_1))) == NULL) { PyErr_NoMemory(); return -1; } object->propertiesCollection[propertiesCollection_cntr_1] = *(struct winspool_PrintNamedProperty *)pytalloc_get_ptr(PyList_GET_ITEM(value, propertiesCollection_cntr_1)); } } } return 0; } static PyGetSetDef py_winspool_PrintPropertiesCollection_getsetters[] = { { .name = discard_const_p(char, "numberOfProperties"), .get = py_winspool_PrintPropertiesCollection_get_numberOfProperties, .set = py_winspool_PrintPropertiesCollection_set_numberOfProperties, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "propertiesCollection"), .get = py_winspool_PrintPropertiesCollection_get_propertiesCollection, .set = py_winspool_PrintPropertiesCollection_set_propertiesCollection, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintNamedProperty") }, { .name = NULL } }; static PyObject *py_winspool_PrintPropertiesCollection_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct winspool_PrintPropertiesCollection, type); } static PyTypeObject winspool_PrintPropertiesCollection_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.PrintPropertiesCollection", .tp_getset = py_winspool_PrintPropertiesCollection_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_PrintPropertiesCollection_new, }; static PyObject *py_winspool_AsyncOpenPrinter_in_get_pPrinterName(PyObject *obj, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(obj); PyObject *py_pPrinterName; if (object->in.pPrinterName == NULL) { Py_RETURN_NONE; } if (object->in.pPrinterName == NULL) { py_pPrinterName = Py_None; Py_INCREF(py_pPrinterName); } else { if (object->in.pPrinterName == NULL) { py_pPrinterName = Py_None; Py_INCREF(py_pPrinterName); } else { py_pPrinterName = PyUnicode_Decode(object->in.pPrinterName, strlen(object->in.pPrinterName), "utf-8", "ignore"); } } return py_pPrinterName; } static int py_winspool_AsyncOpenPrinter_in_set_pPrinterName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterName"); return -1; } if (value == Py_None) { object->in.pPrinterName = NULL; } else { object->in.pPrinterName = 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.pPrinterName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncOpenPrinter_out_get_pHandle(PyObject *obj, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(obj); PyObject *py_pHandle; if (object->out.pHandle == NULL) { Py_RETURN_NONE; } py_pHandle = pytalloc_reference_ex(policy_handle_Type, object->out.pHandle, object->out.pHandle); return py_pHandle; } static int py_winspool_AsyncOpenPrinter_out_set_pHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pHandle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pHandle"); return -1; } object->out.pHandle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pHandle); if (object->out.pHandle == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.pHandle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncOpenPrinter_in_get_pDatatype(PyObject *obj, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(obj); PyObject *py_pDatatype; if (object->in.pDatatype == NULL) { Py_RETURN_NONE; } if (object->in.pDatatype == NULL) { py_pDatatype = Py_None; Py_INCREF(py_pDatatype); } else { if (object->in.pDatatype == NULL) { py_pDatatype = Py_None; Py_INCREF(py_pDatatype); } else { py_pDatatype = PyUnicode_Decode(object->in.pDatatype, strlen(object->in.pDatatype), "utf-8", "ignore"); } } return py_pDatatype; } static int py_winspool_AsyncOpenPrinter_in_set_pDatatype(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDatatype"); return -1; } if (value == Py_None) { object->in.pDatatype = NULL; } else { object->in.pDatatype = 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.pDatatype = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncOpenPrinter_in_get_pDevModeContainer(PyObject *obj, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(obj); PyObject *py_pDevModeContainer; if (object->in.pDevModeContainer == NULL) { Py_RETURN_NONE; } py_pDevModeContainer = pytalloc_reference_ex(spoolss_DevmodeContainer_Type, object->in.pDevModeContainer, object->in.pDevModeContainer); return py_pDevModeContainer; } static int py_winspool_AsyncOpenPrinter_in_set_pDevModeContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDevModeContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDevModeContainer"); return -1; } object->in.pDevModeContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDevModeContainer); if (object->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_DevmodeContainer_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.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncOpenPrinter_in_get_AccessRequired(PyObject *obj, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(obj); PyObject *py_AccessRequired; py_AccessRequired = PyLong_FromUnsignedLongLong((uint32_t)object->in.AccessRequired); return py_AccessRequired; } static int py_winspool_AsyncOpenPrinter_in_set_AccessRequired(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.AccessRequired"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.AccessRequired)); 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.AccessRequired = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncOpenPrinter_in_get_pClientInfo(PyObject *obj, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(obj); PyObject *py_pClientInfo; if (object->in.pClientInfo == NULL) { Py_RETURN_NONE; } py_pClientInfo = pytalloc_reference_ex(spoolss_UserLevelCtr_Type, object->in.pClientInfo, object->in.pClientInfo); return py_pClientInfo; } static int py_winspool_AsyncOpenPrinter_in_set_pClientInfo(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pClientInfo)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pClientInfo"); return -1; } object->in.pClientInfo = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pClientInfo); if (object->in.pClientInfo == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_UserLevelCtr_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.pClientInfo = (struct spoolss_UserLevelCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncOpenPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncOpenPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)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_winspool_AsyncOpenPrinter_getsetters[] = { { .name = discard_const_p(char, "in_pPrinterName"), .get = py_winspool_AsyncOpenPrinter_in_get_pPrinterName, .set = py_winspool_AsyncOpenPrinter_in_set_pPrinterName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pHandle"), .get = py_winspool_AsyncOpenPrinter_out_get_pHandle, .set = py_winspool_AsyncOpenPrinter_out_set_pHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pDatatype"), .get = py_winspool_AsyncOpenPrinter_in_get_pDatatype, .set = py_winspool_AsyncOpenPrinter_in_set_pDatatype, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pDevModeContainer"), .get = py_winspool_AsyncOpenPrinter_in_get_pDevModeContainer, .set = py_winspool_AsyncOpenPrinter_in_set_pDevModeContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_DevmodeContainer") }, { .name = discard_const_p(char, "in_AccessRequired"), .get = py_winspool_AsyncOpenPrinter_in_get_AccessRequired, .set = py_winspool_AsyncOpenPrinter_in_set_AccessRequired, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pClientInfo"), .get = py_winspool_AsyncOpenPrinter_in_get_pClientInfo, .set = py_winspool_AsyncOpenPrinter_in_set_pClientInfo, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_UserLevelCtr") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncOpenPrinter_get_result, .set = py_winspool_AsyncOpenPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncOpenPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncOpenPrinter, type); struct winspool_AsyncOpenPrinter *_self = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pHandle = talloc_zero(mem_ctx, struct policy_handle); _self->in.pDevModeContainer = talloc_zero(mem_ctx, struct spoolss_DevmodeContainer); _self->in.pClientInfo = talloc_zero(mem_ctx, struct spoolss_UserLevelCtr); return self; } static PyObject *py_winspool_AsyncOpenPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(0); } static PyObject *py_winspool_AsyncOpenPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncOpenPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[0]; 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_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncOpenPrinter_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 winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncOpenPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[0]; 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_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncOpenPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncOpenPrinter *object = (struct winspool_AsyncOpenPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncOpenPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[0]; 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_winspool_AsyncOpenPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncOpenPrinter_ndr_print(py_obj, "winspool_AsyncOpenPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncOpenPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncOpenPrinter_ndr_print(py_obj, "winspool_AsyncOpenPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncOpenPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncOpenPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncOpenPrinter.opnum() -> 0 (0x00) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_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_winspool_AsyncOpenPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncOpenPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncOpenPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncOpenPrinter", .tp_getset = py_winspool_AsyncOpenPrinter_getsetters, .tp_methods = py_winspool_AsyncOpenPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncOpenPrinter_new, }; static bool pack_py_winspool_AsyncOpenPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncOpenPrinter *r) { PyObject *py_pPrinterName; PyObject *py_pDatatype; PyObject *py_pDevModeContainer; PyObject *py_AccessRequired; PyObject *py_pClientInfo; const char *kwnames[] = { "pPrinterName", "pDatatype", "pDevModeContainer", "AccessRequired", "pClientInfo", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncOpenPrinter", discard_const_p(char *, kwnames), &py_pPrinterName, &py_pDatatype, &py_pDevModeContainer, &py_AccessRequired, &py_pClientInfo)) { return false; } if (py_pPrinterName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterName"); return false; } if (py_pPrinterName == Py_None) { r->in.pPrinterName = NULL; } else { r->in.pPrinterName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPrinterName)) { unicode = PyUnicode_AsEncodedString(py_pPrinterName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPrinterName)) { test_str = PyBytes_AS_STRING(py_pPrinterName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPrinterName)->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.pPrinterName = talloc_str; } } if (py_pDatatype == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDatatype"); return false; } if (py_pDatatype == Py_None) { r->in.pDatatype = NULL; } else { r->in.pDatatype = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pDatatype)) { unicode = PyUnicode_AsEncodedString(py_pDatatype, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pDatatype)) { test_str = PyBytes_AS_STRING(py_pDatatype); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pDatatype)->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.pDatatype = talloc_str; } } if (py_pDevModeContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDevModeContainer"); return false; } r->in.pDevModeContainer = talloc_ptrtype(r, r->in.pDevModeContainer); if (r->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_DevmodeContainer_Type, py_pDevModeContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pDevModeContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(py_pDevModeContainer); if (py_AccessRequired == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.AccessRequired"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.AccessRequired)); if (PyLong_Check(py_AccessRequired)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_AccessRequired); 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.AccessRequired = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pClientInfo == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pClientInfo"); return false; } r->in.pClientInfo = talloc_ptrtype(r, r->in.pClientInfo); if (r->in.pClientInfo == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_UserLevelCtr_Type, py_pClientInfo, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pClientInfo)) == NULL) { PyErr_NoMemory(); return false; } r->in.pClientInfo = (struct spoolss_UserLevelCtr *)pytalloc_get_ptr(py_pClientInfo); return true; } static PyObject *unpack_py_winspool_AsyncOpenPrinter_args_out(struct winspool_AsyncOpenPrinter *r) { PyObject *result; PyObject *py_pHandle; py_pHandle = pytalloc_reference_ex(policy_handle_Type, r->out.pHandle, r->out.pHandle); result = py_pHandle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncAddPrinter_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncAddPrinter_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncAddPrinter_in_get_pPrinterContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(obj); PyObject *py_pPrinterContainer; if (object->in.pPrinterContainer == NULL) { Py_RETURN_NONE; } py_pPrinterContainer = pytalloc_reference_ex(spoolss_SetPrinterInfoCtr_Type, object->in.pPrinterContainer, object->in.pPrinterContainer); return py_pPrinterContainer; } static int py_winspool_AsyncAddPrinter_in_set_pPrinterContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPrinterContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterContainer"); return -1; } object->in.pPrinterContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrinterContainer); if (object->in.pPrinterContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_SetPrinterInfoCtr_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.pPrinterContainer = (struct spoolss_SetPrinterInfoCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPrinter_in_get_pDevModeContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(obj); PyObject *py_pDevModeContainer; if (object->in.pDevModeContainer == NULL) { Py_RETURN_NONE; } py_pDevModeContainer = pytalloc_reference_ex(spoolss_DevmodeContainer_Type, object->in.pDevModeContainer, object->in.pDevModeContainer); return py_pDevModeContainer; } static int py_winspool_AsyncAddPrinter_in_set_pDevModeContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDevModeContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDevModeContainer"); return -1; } object->in.pDevModeContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDevModeContainer); if (object->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_DevmodeContainer_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.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPrinter_in_get_pSecurityContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(obj); PyObject *py_pSecurityContainer; if (object->in.pSecurityContainer == NULL) { Py_RETURN_NONE; } py_pSecurityContainer = pytalloc_reference_ex(sec_desc_buf_Type, object->in.pSecurityContainer, object->in.pSecurityContainer); return py_pSecurityContainer; } static int py_winspool_AsyncAddPrinter_in_set_pSecurityContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pSecurityContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pSecurityContainer"); return -1; } object->in.pSecurityContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pSecurityContainer); if (object->in.pSecurityContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(sec_desc_buf_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.pSecurityContainer = (struct sec_desc_buf *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPrinter_in_get_pClientInfo(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(obj); PyObject *py_pClientInfo; if (object->in.pClientInfo == NULL) { Py_RETURN_NONE; } py_pClientInfo = pytalloc_reference_ex(spoolss_UserLevelCtr_Type, object->in.pClientInfo, object->in.pClientInfo); return py_pClientInfo; } static int py_winspool_AsyncAddPrinter_in_set_pClientInfo(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pClientInfo)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pClientInfo"); return -1; } object->in.pClientInfo = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pClientInfo); if (object->in.pClientInfo == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_UserLevelCtr_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.pClientInfo = (struct spoolss_UserLevelCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPrinter_out_get_pHandle(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(obj); PyObject *py_pHandle; if (object->out.pHandle == NULL) { Py_RETURN_NONE; } py_pHandle = pytalloc_reference_ex(policy_handle_Type, object->out.pHandle, object->out.pHandle); return py_pHandle; } static int py_winspool_AsyncAddPrinter_out_set_pHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pHandle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pHandle"); return -1; } object->out.pHandle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pHandle); if (object->out.pHandle == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.pHandle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)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_winspool_AsyncAddPrinter_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncAddPrinter_in_get_pName, .set = py_winspool_AsyncAddPrinter_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrinterContainer"), .get = py_winspool_AsyncAddPrinter_in_get_pPrinterContainer, .set = py_winspool_AsyncAddPrinter_in_set_pPrinterContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_SetPrinterInfoCtr") }, { .name = discard_const_p(char, "in_pDevModeContainer"), .get = py_winspool_AsyncAddPrinter_in_get_pDevModeContainer, .set = py_winspool_AsyncAddPrinter_in_set_pDevModeContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_DevmodeContainer") }, { .name = discard_const_p(char, "in_pSecurityContainer"), .get = py_winspool_AsyncAddPrinter_in_get_pSecurityContainer, .set = py_winspool_AsyncAddPrinter_in_set_pSecurityContainer, .doc = discard_const_p(char, "PIDL-generated element of base type sec_desc_buf") }, { .name = discard_const_p(char, "in_pClientInfo"), .get = py_winspool_AsyncAddPrinter_in_get_pClientInfo, .set = py_winspool_AsyncAddPrinter_in_set_pClientInfo, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_UserLevelCtr") }, { .name = discard_const_p(char, "out_pHandle"), .get = py_winspool_AsyncAddPrinter_out_get_pHandle, .set = py_winspool_AsyncAddPrinter_out_set_pHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddPrinter_get_result, .set = py_winspool_AsyncAddPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddPrinter, type); struct winspool_AsyncAddPrinter *_self = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pPrinterContainer = talloc_zero(mem_ctx, struct spoolss_SetPrinterInfoCtr); _self->in.pDevModeContainer = talloc_zero(mem_ctx, struct spoolss_DevmodeContainer); _self->in.pSecurityContainer = talloc_zero(mem_ctx, struct sec_desc_buf); _self->in.pClientInfo = talloc_zero(mem_ctx, struct spoolss_UserLevelCtr); _self->out.pHandle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_winspool_AsyncAddPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(1); } static PyObject *py_winspool_AsyncAddPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 2) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[1]; 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_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPrinter_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 winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 2) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[1]; 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_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPrinter *object = (struct winspool_AsyncAddPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 2) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[1]; 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_winspool_AsyncAddPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPrinter_ndr_print(py_obj, "winspool_AsyncAddPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncAddPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPrinter_ndr_print(py_obj, "winspool_AsyncAddPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddPrinter.opnum() -> 1 (0x01) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_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_winspool_AsyncAddPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddPrinter", .tp_getset = py_winspool_AsyncAddPrinter_getsetters, .tp_methods = py_winspool_AsyncAddPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddPrinter_new, }; static bool pack_py_winspool_AsyncAddPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddPrinter *r) { PyObject *py_pName; PyObject *py_pPrinterContainer; PyObject *py_pDevModeContainer; PyObject *py_pSecurityContainer; PyObject *py_pClientInfo; const char *kwnames[] = { "pName", "pPrinterContainer", "pDevModeContainer", "pSecurityContainer", "pClientInfo", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncAddPrinter", discard_const_p(char *, kwnames), &py_pName, &py_pPrinterContainer, &py_pDevModeContainer, &py_pSecurityContainer, &py_pClientInfo)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pPrinterContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterContainer"); return false; } r->in.pPrinterContainer = talloc_ptrtype(r, r->in.pPrinterContainer); if (r->in.pPrinterContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_SetPrinterInfoCtr_Type, py_pPrinterContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pPrinterContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pPrinterContainer = (struct spoolss_SetPrinterInfoCtr *)pytalloc_get_ptr(py_pPrinterContainer); if (py_pDevModeContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDevModeContainer"); return false; } r->in.pDevModeContainer = talloc_ptrtype(r, r->in.pDevModeContainer); if (r->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_DevmodeContainer_Type, py_pDevModeContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pDevModeContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(py_pDevModeContainer); if (py_pSecurityContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pSecurityContainer"); return false; } r->in.pSecurityContainer = talloc_ptrtype(r, r->in.pSecurityContainer); if (r->in.pSecurityContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(sec_desc_buf_Type, py_pSecurityContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pSecurityContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pSecurityContainer = (struct sec_desc_buf *)pytalloc_get_ptr(py_pSecurityContainer); if (py_pClientInfo == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pClientInfo"); return false; } r->in.pClientInfo = talloc_ptrtype(r, r->in.pClientInfo); if (r->in.pClientInfo == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_UserLevelCtr_Type, py_pClientInfo, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pClientInfo)) == NULL) { PyErr_NoMemory(); return false; } r->in.pClientInfo = (struct spoolss_UserLevelCtr *)pytalloc_get_ptr(py_pClientInfo); return true; } static PyObject *unpack_py_winspool_AsyncAddPrinter_args_out(struct winspool_AsyncAddPrinter *r) { PyObject *result; PyObject *py_pHandle; py_pHandle = pytalloc_reference_ex(policy_handle_Type, r->out.pHandle, r->out.pHandle); result = py_pHandle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncSetJob_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncSetJob_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetJob_in_get_JobId(PyObject *obj, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(obj); PyObject *py_JobId; py_JobId = PyLong_FromUnsignedLongLong((uint32_t)object->in.JobId); return py_JobId; } static int py_winspool_AsyncSetJob_in_set_JobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.JobId"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.JobId)); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetJob_in_get_pJobContainer(PyObject *obj, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(obj); PyObject *py_pJobContainer; if (object->in.pJobContainer == NULL) { Py_RETURN_NONE; } if (object->in.pJobContainer == NULL) { py_pJobContainer = Py_None; Py_INCREF(py_pJobContainer); } else { py_pJobContainer = pytalloc_reference_ex(spoolss_JobInfoContainer_Type, object->in.pJobContainer, object->in.pJobContainer); } return py_pJobContainer; } static int py_winspool_AsyncSetJob_in_set_pJobContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pJobContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pJobContainer"); return -1; } if (value == Py_None) { object->in.pJobContainer = NULL; } else { object->in.pJobContainer = NULL; PY_CHECK_TYPE(spoolss_JobInfoContainer_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.pJobContainer = (struct spoolss_JobInfoContainer *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_winspool_AsyncSetJob_in_get_Command(PyObject *obj, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(obj); PyObject *py_Command; py_Command = PyLong_FromUnsignedLongLong((uint32_t)object->in.Command); return py_Command; } static int py_winspool_AsyncSetJob_in_set_Command(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Command"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Command)); 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.Command = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetJob_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSetJob_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)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_winspool_AsyncSetJob_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncSetJob_in_get_hPrinter, .set = py_winspool_AsyncSetJob_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_JobId"), .get = py_winspool_AsyncSetJob_in_get_JobId, .set = py_winspool_AsyncSetJob_in_set_JobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pJobContainer"), .get = py_winspool_AsyncSetJob_in_get_pJobContainer, .set = py_winspool_AsyncSetJob_in_set_pJobContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_JobInfoContainer") }, { .name = discard_const_p(char, "in_Command"), .get = py_winspool_AsyncSetJob_in_get_Command, .set = py_winspool_AsyncSetJob_in_set_Command, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSetJob_get_result, .set = py_winspool_AsyncSetJob_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSetJob_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSetJob, type); return self; } static PyObject *py_winspool_AsyncSetJob_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(2); } static PyObject *py_winspool_AsyncSetJob_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetJob_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncSetJob_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_winspool_AsyncSetJob_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSetJob_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_winspool_AsyncSetJob_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSetJob_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 winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetJob_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncSetJob_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_winspool_AsyncSetJob_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetJob_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_winspool_AsyncSetJob_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetJob_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetJob *object = (struct winspool_AsyncSetJob *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetJob_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncSetJob_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetJob_ndr_print(py_obj, "winspool_AsyncSetJob_in", NDR_IN); } static PyObject *py_winspool_AsyncSetJob_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetJob_ndr_print(py_obj, "winspool_AsyncSetJob_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSetJob_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSetJob_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSetJob.opnum() -> 2 (0x02) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSetJob_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_winspool_AsyncSetJob_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_winspool_AsyncSetJob_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_winspool_AsyncSetJob_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_winspool_AsyncSetJob_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSetJob_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSetJob_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSetJob", .tp_getset = py_winspool_AsyncSetJob_getsetters, .tp_methods = py_winspool_AsyncSetJob_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSetJob_new, }; static bool pack_py_winspool_AsyncSetJob_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSetJob *r) { PyObject *py_hPrinter; PyObject *py_JobId; PyObject *py_pJobContainer; PyObject *py_Command; const char *kwnames[] = { "hPrinter", "JobId", "pJobContainer", "Command", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncSetJob", discard_const_p(char *, kwnames), &py_hPrinter, &py_JobId, &py_pJobContainer, &py_Command)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_JobId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.JobId"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.JobId)); if (PyLong_Check(py_JobId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_JobId); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pJobContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pJobContainer"); return false; } if (py_pJobContainer == Py_None) { r->in.pJobContainer = NULL; } else { r->in.pJobContainer = NULL; PY_CHECK_TYPE(spoolss_JobInfoContainer_Type, py_pJobContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pJobContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pJobContainer = (struct spoolss_JobInfoContainer *)pytalloc_get_ptr(py_pJobContainer); } if (py_Command == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Command"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Command)); if (PyLong_Check(py_Command)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Command); 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.Command = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncSetJob_args_out(struct winspool_AsyncSetJob *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_winspool_AsyncGetJob_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncGetJob_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetJob_in_get_JobId(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_JobId; py_JobId = PyLong_FromUnsignedLongLong((uint32_t)object->in.JobId); return py_JobId; } static int py_winspool_AsyncGetJob_in_set_JobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.JobId"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.JobId)); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetJob_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncGetJob_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetJob_in_get_pJob(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_pJob; if (object->in.pJob == NULL) { Py_RETURN_NONE; } if (object->in.pJob == NULL) { py_pJob = Py_None; Py_INCREF(py_pJob); } else { py_pJob = PyList_New(object->in.cbBuf); if (py_pJob == NULL) { return NULL; } { int pJob_cntr_1; for (pJob_cntr_1 = 0; pJob_cntr_1 < (object->in.cbBuf); pJob_cntr_1++) { PyObject *py_pJob_1; py_pJob_1 = PyLong_FromLong((uint16_t)object->in.pJob[pJob_cntr_1]); PyList_SetItem(py_pJob, pJob_cntr_1, py_pJob_1); } } } return py_pJob; } static int py_winspool_AsyncGetJob_in_set_pJob(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pJob)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pJob"); return -1; } if (value == Py_None) { object->in.pJob = NULL; } else { object->in.pJob = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pJob_cntr_1; object->in.pJob = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pJob, PyList_GET_SIZE(value)); if (!object->in.pJob) { return -1;; } talloc_set_name_const(object->in.pJob, "ARRAY: object->in.pJob"); for (pJob_cntr_1 = 0; pJob_cntr_1 < PyList_GET_SIZE(value); pJob_cntr_1++) { if (PyList_GET_ITEM(value, pJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pJob[pJob_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pJob[pJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pJob_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->in.pJob[pJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetJob_out_get_pJob(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_pJob; if (object->out.pJob == NULL) { Py_RETURN_NONE; } if (object->out.pJob == NULL) { py_pJob = Py_None; Py_INCREF(py_pJob); } else { py_pJob = PyList_New(object->in.cbBuf); if (py_pJob == NULL) { return NULL; } { int pJob_cntr_1; for (pJob_cntr_1 = 0; pJob_cntr_1 < (object->in.cbBuf); pJob_cntr_1++) { PyObject *py_pJob_1; py_pJob_1 = PyLong_FromLong((uint16_t)object->out.pJob[pJob_cntr_1]); PyList_SetItem(py_pJob, pJob_cntr_1, py_pJob_1); } } } return py_pJob; } static int py_winspool_AsyncGetJob_out_set_pJob(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pJob)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pJob"); return -1; } if (value == Py_None) { object->out.pJob = NULL; } else { object->out.pJob = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pJob_cntr_1; object->out.pJob = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pJob, PyList_GET_SIZE(value)); if (!object->out.pJob) { return -1;; } talloc_set_name_const(object->out.pJob, "ARRAY: object->out.pJob"); for (pJob_cntr_1 = 0; pJob_cntr_1 < PyList_GET_SIZE(value); pJob_cntr_1++) { if (PyList_GET_ITEM(value, pJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pJob[pJob_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pJob[pJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pJob_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.pJob[pJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetJob_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncGetJob_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetJob_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetJob_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetJob_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetJob_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)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_winspool_AsyncGetJob_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncGetJob_in_get_hPrinter, .set = py_winspool_AsyncGetJob_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_JobId"), .get = py_winspool_AsyncGetJob_in_get_JobId, .set = py_winspool_AsyncGetJob_in_set_JobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncGetJob_in_get_Level, .set = py_winspool_AsyncGetJob_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pJob"), .get = py_winspool_AsyncGetJob_in_get_pJob, .set = py_winspool_AsyncGetJob_in_set_pJob, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pJob"), .get = py_winspool_AsyncGetJob_out_get_pJob, .set = py_winspool_AsyncGetJob_out_set_pJob, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncGetJob_in_get_cbBuf, .set = py_winspool_AsyncGetJob_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetJob_out_get_pcbNeeded, .set = py_winspool_AsyncGetJob_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetJob_get_result, .set = py_winspool_AsyncGetJob_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetJob_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetJob, type); struct winspool_AsyncGetJob *_self = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetJob_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(3); } static PyObject *py_winspool_AsyncGetJob_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 4) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetJob_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[3]; 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_winspool_AsyncGetJob_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_winspool_AsyncGetJob_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetJob_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_winspool_AsyncGetJob_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetJob_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 winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 4) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetJob_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[3]; 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_winspool_AsyncGetJob_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_winspool_AsyncGetJob_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetJob_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_winspool_AsyncGetJob_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetJob_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetJob *object = (struct winspool_AsyncGetJob *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 4) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetJob_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[3]; 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_winspool_AsyncGetJob_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetJob_ndr_print(py_obj, "winspool_AsyncGetJob_in", NDR_IN); } static PyObject *py_winspool_AsyncGetJob_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetJob_ndr_print(py_obj, "winspool_AsyncGetJob_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetJob_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetJob_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetJob.opnum() -> 3 (0x03) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetJob_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_winspool_AsyncGetJob_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_winspool_AsyncGetJob_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_winspool_AsyncGetJob_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_winspool_AsyncGetJob_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetJob_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetJob_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetJob", .tp_getset = py_winspool_AsyncGetJob_getsetters, .tp_methods = py_winspool_AsyncGetJob_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetJob_new, }; static bool pack_py_winspool_AsyncGetJob_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetJob *r) { PyObject *py_hPrinter; PyObject *py_JobId; PyObject *py_Level; PyObject *py_pJob; const char *kwnames[] = { "hPrinter", "JobId", "Level", "pJob", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncGetJob", discard_const_p(char *, kwnames), &py_hPrinter, &py_JobId, &py_Level, &py_pJob)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_JobId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.JobId"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.JobId)); if (PyLong_Check(py_JobId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_JobId); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pJob == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pJob"); return false; } if (py_pJob == Py_None) { r->in.pJob = NULL; } else { r->in.pJob = NULL; PY_CHECK_TYPE(&PyList_Type, py_pJob, return false;); { int pJob_cntr_1; r->in.pJob = talloc_array_ptrtype(r, r->in.pJob, PyList_GET_SIZE(py_pJob)); if (!r->in.pJob) { return false;; } talloc_set_name_const(r->in.pJob, "ARRAY: r->in.pJob"); for (pJob_cntr_1 = 0; pJob_cntr_1 < PyList_GET_SIZE(py_pJob); pJob_cntr_1++) { if (PyList_GET_ITEM(py_pJob, pJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pJob[pJob_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pJob[pJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pJob, pJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pJob, pJob_cntr_1)); 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.pJob[pJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pJob, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pJob); return true; } static PyObject *unpack_py_winspool_AsyncGetJob_args_out(struct winspool_AsyncGetJob *r) { PyObject *result; PyObject *py_pJob; PyObject *py_pcbNeeded; result = PyTuple_New(2); if (r->out.pJob == NULL) { py_pJob = Py_None; Py_INCREF(py_pJob); } else { py_pJob = PyList_New(r->in.cbBuf); if (py_pJob == NULL) { return NULL; } { int pJob_cntr_1; for (pJob_cntr_1 = 0; pJob_cntr_1 < (r->in.cbBuf); pJob_cntr_1++) { PyObject *py_pJob_1; py_pJob_1 = PyLong_FromLong((uint16_t)r->out.pJob[pJob_cntr_1]); PyList_SetItem(py_pJob, pJob_cntr_1, py_pJob_1); } } } PyTuple_SetItem(result, 0, py_pJob); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEnumJobs_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEnumJobs_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEnumJobs_in_get_FirstJob(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_FirstJob; py_FirstJob = PyLong_FromUnsignedLongLong((uint32_t)object->in.FirstJob); return py_FirstJob; } static int py_winspool_AsyncEnumJobs_in_set_FirstJob(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.FirstJob"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.FirstJob)); 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.FirstJob = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_in_get_NoJobs(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_NoJobs; py_NoJobs = PyLong_FromUnsignedLongLong((uint32_t)object->in.NoJobs); return py_NoJobs; } static int py_winspool_AsyncEnumJobs_in_set_NoJobs(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.NoJobs"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.NoJobs)); 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.NoJobs = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumJobs_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_in_get_pJob(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_pJob; if (object->in.pJob == NULL) { Py_RETURN_NONE; } if (object->in.pJob == NULL) { py_pJob = Py_None; Py_INCREF(py_pJob); } else { py_pJob = PyList_New(object->in.cbBuf); if (py_pJob == NULL) { return NULL; } { int pJob_cntr_1; for (pJob_cntr_1 = 0; pJob_cntr_1 < (object->in.cbBuf); pJob_cntr_1++) { PyObject *py_pJob_1; py_pJob_1 = PyLong_FromLong((uint16_t)object->in.pJob[pJob_cntr_1]); PyList_SetItem(py_pJob, pJob_cntr_1, py_pJob_1); } } } return py_pJob; } static int py_winspool_AsyncEnumJobs_in_set_pJob(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pJob)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pJob"); return -1; } if (value == Py_None) { object->in.pJob = NULL; } else { object->in.pJob = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pJob_cntr_1; object->in.pJob = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pJob, PyList_GET_SIZE(value)); if (!object->in.pJob) { return -1;; } talloc_set_name_const(object->in.pJob, "ARRAY: object->in.pJob"); for (pJob_cntr_1 = 0; pJob_cntr_1 < PyList_GET_SIZE(value); pJob_cntr_1++) { if (PyList_GET_ITEM(value, pJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pJob[pJob_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pJob[pJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pJob_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->in.pJob[pJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_out_get_pJob(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_pJob; if (object->out.pJob == NULL) { Py_RETURN_NONE; } if (object->out.pJob == NULL) { py_pJob = Py_None; Py_INCREF(py_pJob); } else { py_pJob = PyList_New(object->in.cbBuf); if (py_pJob == NULL) { return NULL; } { int pJob_cntr_1; for (pJob_cntr_1 = 0; pJob_cntr_1 < (object->in.cbBuf); pJob_cntr_1++) { PyObject *py_pJob_1; py_pJob_1 = PyLong_FromLong((uint16_t)object->out.pJob[pJob_cntr_1]); PyList_SetItem(py_pJob, pJob_cntr_1, py_pJob_1); } } } return py_pJob; } static int py_winspool_AsyncEnumJobs_out_set_pJob(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pJob)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pJob"); return -1; } if (value == Py_None) { object->out.pJob = NULL; } else { object->out.pJob = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pJob_cntr_1; object->out.pJob = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pJob, PyList_GET_SIZE(value)); if (!object->out.pJob) { return -1;; } talloc_set_name_const(object->out.pJob, "ARRAY: object->out.pJob"); for (pJob_cntr_1 = 0; pJob_cntr_1 < PyList_GET_SIZE(value); pJob_cntr_1++) { if (PyList_GET_ITEM(value, pJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pJob[pJob_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pJob[pJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pJob_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.pJob[pJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumJobs_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumJobs_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumJobs_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobs_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumJobs_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)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_winspool_AsyncEnumJobs_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEnumJobs_in_get_hPrinter, .set = py_winspool_AsyncEnumJobs_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_FirstJob"), .get = py_winspool_AsyncEnumJobs_in_get_FirstJob, .set = py_winspool_AsyncEnumJobs_in_set_FirstJob, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_NoJobs"), .get = py_winspool_AsyncEnumJobs_in_get_NoJobs, .set = py_winspool_AsyncEnumJobs_in_set_NoJobs, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumJobs_in_get_Level, .set = py_winspool_AsyncEnumJobs_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pJob"), .get = py_winspool_AsyncEnumJobs_in_get_pJob, .set = py_winspool_AsyncEnumJobs_in_set_pJob, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pJob"), .get = py_winspool_AsyncEnumJobs_out_get_pJob, .set = py_winspool_AsyncEnumJobs_out_set_pJob, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumJobs_in_get_cbBuf, .set = py_winspool_AsyncEnumJobs_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumJobs_out_get_pcbNeeded, .set = py_winspool_AsyncEnumJobs_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumJobs_out_get_pcReturned, .set = py_winspool_AsyncEnumJobs_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumJobs_get_result, .set = py_winspool_AsyncEnumJobs_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumJobs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumJobs, type); struct winspool_AsyncEnumJobs *_self = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumJobs_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(4); } static PyObject *py_winspool_AsyncEnumJobs_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumJobs_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[4]; 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_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumJobs_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 winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumJobs_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[4]; 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_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumJobs_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumJobs *object = (struct winspool_AsyncEnumJobs *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumJobs_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[4]; 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_winspool_AsyncEnumJobs_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumJobs_ndr_print(py_obj, "winspool_AsyncEnumJobs_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumJobs_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumJobs_ndr_print(py_obj, "winspool_AsyncEnumJobs_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumJobs_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumJobs_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumJobs.opnum() -> 4 (0x04) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_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_winspool_AsyncEnumJobs_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumJobs_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumJobs_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumJobs", .tp_getset = py_winspool_AsyncEnumJobs_getsetters, .tp_methods = py_winspool_AsyncEnumJobs_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumJobs_new, }; static bool pack_py_winspool_AsyncEnumJobs_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumJobs *r) { PyObject *py_hPrinter; PyObject *py_FirstJob; PyObject *py_NoJobs; PyObject *py_Level; PyObject *py_pJob; const char *kwnames[] = { "hPrinter", "FirstJob", "NoJobs", "Level", "pJob", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncEnumJobs", discard_const_p(char *, kwnames), &py_hPrinter, &py_FirstJob, &py_NoJobs, &py_Level, &py_pJob)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_FirstJob == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.FirstJob"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.FirstJob)); if (PyLong_Check(py_FirstJob)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_FirstJob); 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.FirstJob = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_NoJobs == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.NoJobs"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.NoJobs)); if (PyLong_Check(py_NoJobs)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_NoJobs); 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.NoJobs = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pJob == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pJob"); return false; } if (py_pJob == Py_None) { r->in.pJob = NULL; } else { r->in.pJob = NULL; PY_CHECK_TYPE(&PyList_Type, py_pJob, return false;); { int pJob_cntr_1; r->in.pJob = talloc_array_ptrtype(r, r->in.pJob, PyList_GET_SIZE(py_pJob)); if (!r->in.pJob) { return false;; } talloc_set_name_const(r->in.pJob, "ARRAY: r->in.pJob"); for (pJob_cntr_1 = 0; pJob_cntr_1 < PyList_GET_SIZE(py_pJob); pJob_cntr_1++) { if (PyList_GET_ITEM(py_pJob, pJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pJob[pJob_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pJob[pJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pJob, pJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pJob, pJob_cntr_1)); 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.pJob[pJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pJob, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pJob); return true; } static PyObject *unpack_py_winspool_AsyncEnumJobs_args_out(struct winspool_AsyncEnumJobs *r) { PyObject *result; PyObject *py_pJob; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pJob == NULL) { py_pJob = Py_None; Py_INCREF(py_pJob); } else { py_pJob = PyList_New(r->in.cbBuf); if (py_pJob == NULL) { return NULL; } { int pJob_cntr_1; for (pJob_cntr_1 = 0; pJob_cntr_1 < (r->in.cbBuf); pJob_cntr_1++) { PyObject *py_pJob_1; py_pJob_1 = PyLong_FromLong((uint16_t)r->out.pJob[pJob_cntr_1]); PyList_SetItem(py_pJob, pJob_cntr_1, py_pJob_1); } } } PyTuple_SetItem(result, 0, py_pJob); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncAddJob_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncAddJob_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddJob_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncAddJob_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncAddJob_in_get_pAddJob(PyObject *obj, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(obj); PyObject *py_pAddJob; if (object->in.pAddJob == NULL) { Py_RETURN_NONE; } if (object->in.pAddJob == NULL) { py_pAddJob = Py_None; Py_INCREF(py_pAddJob); } else { py_pAddJob = PyList_New(object->in.cbBuf); if (py_pAddJob == NULL) { return NULL; } { int pAddJob_cntr_1; for (pAddJob_cntr_1 = 0; pAddJob_cntr_1 < (object->in.cbBuf); pAddJob_cntr_1++) { PyObject *py_pAddJob_1; py_pAddJob_1 = PyLong_FromLong((uint16_t)object->in.pAddJob[pAddJob_cntr_1]); PyList_SetItem(py_pAddJob, pAddJob_cntr_1, py_pAddJob_1); } } } return py_pAddJob; } static int py_winspool_AsyncAddJob_in_set_pAddJob(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pAddJob)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pAddJob"); return -1; } if (value == Py_None) { object->in.pAddJob = NULL; } else { object->in.pAddJob = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pAddJob_cntr_1; object->in.pAddJob = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pAddJob, PyList_GET_SIZE(value)); if (!object->in.pAddJob) { return -1;; } talloc_set_name_const(object->in.pAddJob, "ARRAY: object->in.pAddJob"); for (pAddJob_cntr_1 = 0; pAddJob_cntr_1 < PyList_GET_SIZE(value); pAddJob_cntr_1++) { if (PyList_GET_ITEM(value, pAddJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pAddJob[pAddJob_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pAddJob[pAddJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pAddJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pAddJob_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->in.pAddJob[pAddJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncAddJob_out_get_pAddJob(PyObject *obj, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(obj); PyObject *py_pAddJob; if (object->out.pAddJob == NULL) { Py_RETURN_NONE; } if (object->out.pAddJob == NULL) { py_pAddJob = Py_None; Py_INCREF(py_pAddJob); } else { py_pAddJob = PyList_New(object->in.cbBuf); if (py_pAddJob == NULL) { return NULL; } { int pAddJob_cntr_1; for (pAddJob_cntr_1 = 0; pAddJob_cntr_1 < (object->in.cbBuf); pAddJob_cntr_1++) { PyObject *py_pAddJob_1; py_pAddJob_1 = PyLong_FromLong((uint16_t)object->out.pAddJob[pAddJob_cntr_1]); PyList_SetItem(py_pAddJob, pAddJob_cntr_1, py_pAddJob_1); } } } return py_pAddJob; } static int py_winspool_AsyncAddJob_out_set_pAddJob(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pAddJob)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pAddJob"); return -1; } if (value == Py_None) { object->out.pAddJob = NULL; } else { object->out.pAddJob = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pAddJob_cntr_1; object->out.pAddJob = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pAddJob, PyList_GET_SIZE(value)); if (!object->out.pAddJob) { return -1;; } talloc_set_name_const(object->out.pAddJob, "ARRAY: object->out.pAddJob"); for (pAddJob_cntr_1 = 0; pAddJob_cntr_1 < PyList_GET_SIZE(value); pAddJob_cntr_1++) { if (PyList_GET_ITEM(value, pAddJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pAddJob[pAddJob_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pAddJob[pAddJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pAddJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pAddJob_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.pAddJob[pAddJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncAddJob_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncAddJob_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncAddJob_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncAddJob_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncAddJob_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddJob_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)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_winspool_AsyncAddJob_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncAddJob_in_get_hPrinter, .set = py_winspool_AsyncAddJob_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncAddJob_in_get_Level, .set = py_winspool_AsyncAddJob_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pAddJob"), .get = py_winspool_AsyncAddJob_in_get_pAddJob, .set = py_winspool_AsyncAddJob_in_set_pAddJob, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pAddJob"), .get = py_winspool_AsyncAddJob_out_get_pAddJob, .set = py_winspool_AsyncAddJob_out_set_pAddJob, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncAddJob_in_get_cbBuf, .set = py_winspool_AsyncAddJob_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncAddJob_out_get_pcbNeeded, .set = py_winspool_AsyncAddJob_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddJob_get_result, .set = py_winspool_AsyncAddJob_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddJob_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddJob, type); struct winspool_AsyncAddJob *_self = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncAddJob_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(5); } static PyObject *py_winspool_AsyncAddJob_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddJob_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[5]; 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_winspool_AsyncAddJob_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_winspool_AsyncAddJob_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddJob_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_winspool_AsyncAddJob_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddJob_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 winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddJob_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[5]; 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_winspool_AsyncAddJob_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_winspool_AsyncAddJob_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddJob_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_winspool_AsyncAddJob_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddJob_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddJob *object = (struct winspool_AsyncAddJob *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddJob_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[5]; 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_winspool_AsyncAddJob_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddJob_ndr_print(py_obj, "winspool_AsyncAddJob_in", NDR_IN); } static PyObject *py_winspool_AsyncAddJob_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddJob_ndr_print(py_obj, "winspool_AsyncAddJob_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddJob_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddJob_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddJob.opnum() -> 5 (0x05) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddJob_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_winspool_AsyncAddJob_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_winspool_AsyncAddJob_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_winspool_AsyncAddJob_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_winspool_AsyncAddJob_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddJob_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddJob_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddJob", .tp_getset = py_winspool_AsyncAddJob_getsetters, .tp_methods = py_winspool_AsyncAddJob_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddJob_new, }; static bool pack_py_winspool_AsyncAddJob_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddJob *r) { PyObject *py_hPrinter; PyObject *py_Level; PyObject *py_pAddJob; const char *kwnames[] = { "hPrinter", "Level", "pAddJob", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncAddJob", discard_const_p(char *, kwnames), &py_hPrinter, &py_Level, &py_pAddJob)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pAddJob == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pAddJob"); return false; } if (py_pAddJob == Py_None) { r->in.pAddJob = NULL; } else { r->in.pAddJob = NULL; PY_CHECK_TYPE(&PyList_Type, py_pAddJob, return false;); { int pAddJob_cntr_1; r->in.pAddJob = talloc_array_ptrtype(r, r->in.pAddJob, PyList_GET_SIZE(py_pAddJob)); if (!r->in.pAddJob) { return false;; } talloc_set_name_const(r->in.pAddJob, "ARRAY: r->in.pAddJob"); for (pAddJob_cntr_1 = 0; pAddJob_cntr_1 < PyList_GET_SIZE(py_pAddJob); pAddJob_cntr_1++) { if (PyList_GET_ITEM(py_pAddJob, pAddJob_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pAddJob[pAddJob_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pAddJob[pAddJob_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pAddJob, pAddJob_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pAddJob, pAddJob_cntr_1)); 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.pAddJob[pAddJob_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pAddJob, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pAddJob); return true; } static PyObject *unpack_py_winspool_AsyncAddJob_args_out(struct winspool_AsyncAddJob *r) { PyObject *result; PyObject *py_pAddJob; PyObject *py_pcbNeeded; result = PyTuple_New(2); if (r->out.pAddJob == NULL) { py_pAddJob = Py_None; Py_INCREF(py_pAddJob); } else { py_pAddJob = PyList_New(r->in.cbBuf); if (py_pAddJob == NULL) { return NULL; } { int pAddJob_cntr_1; for (pAddJob_cntr_1 = 0; pAddJob_cntr_1 < (r->in.cbBuf); pAddJob_cntr_1++) { PyObject *py_pAddJob_1; py_pAddJob_1 = PyLong_FromLong((uint16_t)r->out.pAddJob[pAddJob_cntr_1]); PyList_SetItem(py_pAddJob, pAddJob_cntr_1, py_pAddJob_1); } } } PyTuple_SetItem(result, 0, py_pAddJob); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncScheduleJob_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncScheduleJob_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncScheduleJob_in_get_JobId(PyObject *obj, void *closure) { struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(obj); PyObject *py_JobId; py_JobId = PyLong_FromUnsignedLongLong((uint32_t)object->in.JobId); return py_JobId; } static int py_winspool_AsyncScheduleJob_in_set_JobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.JobId"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.JobId)); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncScheduleJob_get_result(PyObject *obj, void *closure) { struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncScheduleJob_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)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_winspool_AsyncScheduleJob_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncScheduleJob_in_get_hPrinter, .set = py_winspool_AsyncScheduleJob_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_JobId"), .get = py_winspool_AsyncScheduleJob_in_get_JobId, .set = py_winspool_AsyncScheduleJob_in_set_JobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncScheduleJob_get_result, .set = py_winspool_AsyncScheduleJob_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncScheduleJob_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncScheduleJob, type); return self; } static PyObject *py_winspool_AsyncScheduleJob_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(6); } static PyObject *py_winspool_AsyncScheduleJob_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncScheduleJob_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncScheduleJob_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 winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncScheduleJob_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncScheduleJob_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncScheduleJob *object = (struct winspool_AsyncScheduleJob *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncScheduleJob_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncScheduleJob_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncScheduleJob_ndr_print(py_obj, "winspool_AsyncScheduleJob_in", NDR_IN); } static PyObject *py_winspool_AsyncScheduleJob_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncScheduleJob_ndr_print(py_obj, "winspool_AsyncScheduleJob_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncScheduleJob_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncScheduleJob_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncScheduleJob.opnum() -> 6 (0x06) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_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_winspool_AsyncScheduleJob_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncScheduleJob_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncScheduleJob_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncScheduleJob", .tp_getset = py_winspool_AsyncScheduleJob_getsetters, .tp_methods = py_winspool_AsyncScheduleJob_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncScheduleJob_new, }; static bool pack_py_winspool_AsyncScheduleJob_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncScheduleJob *r) { PyObject *py_hPrinter; PyObject *py_JobId; const char *kwnames[] = { "hPrinter", "JobId", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncScheduleJob", discard_const_p(char *, kwnames), &py_hPrinter, &py_JobId)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_JobId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.JobId"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.JobId)); if (PyLong_Check(py_JobId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_JobId); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncScheduleJob_args_out(struct winspool_AsyncScheduleJob *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_winspool_AsyncDeletePrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinter *object = (struct winspool_AsyncDeletePrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncDeletePrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinter *object = (struct winspool_AsyncDeletePrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeletePrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinter *object = (struct winspool_AsyncDeletePrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinter *object = (struct winspool_AsyncDeletePrinter *)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_winspool_AsyncDeletePrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncDeletePrinter_in_get_hPrinter, .set = py_winspool_AsyncDeletePrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinter_get_result, .set = py_winspool_AsyncDeletePrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinter, type); return self; } static PyObject *py_winspool_AsyncDeletePrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(7); } static PyObject *py_winspool_AsyncDeletePrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinter *object = (struct winspool_AsyncDeletePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 8) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[7]; 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_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinter_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 winspool_AsyncDeletePrinter *object = (struct winspool_AsyncDeletePrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 8) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[7]; 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_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinter *object = (struct winspool_AsyncDeletePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 8) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[7]; 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_winspool_AsyncDeletePrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinter_ndr_print(py_obj, "winspool_AsyncDeletePrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinter_ndr_print(py_obj, "winspool_AsyncDeletePrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinter.opnum() -> 7 (0x07) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_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_winspool_AsyncDeletePrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinter", .tp_getset = py_winspool_AsyncDeletePrinter_getsetters, .tp_methods = py_winspool_AsyncDeletePrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinter_new, }; static bool pack_py_winspool_AsyncDeletePrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinter *r) { PyObject *py_hPrinter; const char *kwnames[] = { "hPrinter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncDeletePrinter", discard_const_p(char *, kwnames), &py_hPrinter)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinter_args_out(struct winspool_AsyncDeletePrinter *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_winspool_AsyncSetPrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncSetPrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetPrinter_in_get_pPrinterContainer(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pPrinterContainer; if (object->in.pPrinterContainer == NULL) { Py_RETURN_NONE; } py_pPrinterContainer = pytalloc_reference_ex(spoolss_SetPrinterInfoCtr_Type, object->in.pPrinterContainer, object->in.pPrinterContainer); return py_pPrinterContainer; } static int py_winspool_AsyncSetPrinter_in_set_pPrinterContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPrinterContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterContainer"); return -1; } object->in.pPrinterContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrinterContainer); if (object->in.pPrinterContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_SetPrinterInfoCtr_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.pPrinterContainer = (struct spoolss_SetPrinterInfoCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetPrinter_in_get_pDevModeContainer(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pDevModeContainer; if (object->in.pDevModeContainer == NULL) { Py_RETURN_NONE; } py_pDevModeContainer = pytalloc_reference_ex(spoolss_DevmodeContainer_Type, object->in.pDevModeContainer, object->in.pDevModeContainer); return py_pDevModeContainer; } static int py_winspool_AsyncSetPrinter_in_set_pDevModeContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDevModeContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDevModeContainer"); return -1; } object->in.pDevModeContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDevModeContainer); if (object->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_DevmodeContainer_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.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetPrinter_in_get_pSecurityContainer(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pSecurityContainer; if (object->in.pSecurityContainer == NULL) { Py_RETURN_NONE; } py_pSecurityContainer = pytalloc_reference_ex(sec_desc_buf_Type, object->in.pSecurityContainer, object->in.pSecurityContainer); return py_pSecurityContainer; } static int py_winspool_AsyncSetPrinter_in_set_pSecurityContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pSecurityContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pSecurityContainer"); return -1; } object->in.pSecurityContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pSecurityContainer); if (object->in.pSecurityContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(sec_desc_buf_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.pSecurityContainer = (struct sec_desc_buf *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetPrinter_in_get_Command(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(obj); PyObject *py_Command; py_Command = PyLong_FromUnsignedLongLong((uint32_t)object->in.Command); return py_Command; } static int py_winspool_AsyncSetPrinter_in_set_Command(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Command"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Command)); 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.Command = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSetPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)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_winspool_AsyncSetPrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncSetPrinter_in_get_hPrinter, .set = py_winspool_AsyncSetPrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pPrinterContainer"), .get = py_winspool_AsyncSetPrinter_in_get_pPrinterContainer, .set = py_winspool_AsyncSetPrinter_in_set_pPrinterContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_SetPrinterInfoCtr") }, { .name = discard_const_p(char, "in_pDevModeContainer"), .get = py_winspool_AsyncSetPrinter_in_get_pDevModeContainer, .set = py_winspool_AsyncSetPrinter_in_set_pDevModeContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_DevmodeContainer") }, { .name = discard_const_p(char, "in_pSecurityContainer"), .get = py_winspool_AsyncSetPrinter_in_get_pSecurityContainer, .set = py_winspool_AsyncSetPrinter_in_set_pSecurityContainer, .doc = discard_const_p(char, "PIDL-generated element of base type sec_desc_buf") }, { .name = discard_const_p(char, "in_Command"), .get = py_winspool_AsyncSetPrinter_in_get_Command, .set = py_winspool_AsyncSetPrinter_in_set_Command, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSetPrinter_get_result, .set = py_winspool_AsyncSetPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSetPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSetPrinter, type); struct winspool_AsyncSetPrinter *_self = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pPrinterContainer = talloc_zero(mem_ctx, struct spoolss_SetPrinterInfoCtr); _self->in.pDevModeContainer = talloc_zero(mem_ctx, struct spoolss_DevmodeContainer); _self->in.pSecurityContainer = talloc_zero(mem_ctx, struct sec_desc_buf); return self; } static PyObject *py_winspool_AsyncSetPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(8); } static PyObject *py_winspool_AsyncSetPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[8]; 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_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPrinter_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 winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[8]; 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_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPrinter *object = (struct winspool_AsyncSetPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[8]; 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_winspool_AsyncSetPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPrinter_ndr_print(py_obj, "winspool_AsyncSetPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncSetPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPrinter_ndr_print(py_obj, "winspool_AsyncSetPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSetPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSetPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSetPrinter.opnum() -> 8 (0x08) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_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_winspool_AsyncSetPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSetPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSetPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSetPrinter", .tp_getset = py_winspool_AsyncSetPrinter_getsetters, .tp_methods = py_winspool_AsyncSetPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSetPrinter_new, }; static bool pack_py_winspool_AsyncSetPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSetPrinter *r) { PyObject *py_hPrinter; PyObject *py_pPrinterContainer; PyObject *py_pDevModeContainer; PyObject *py_pSecurityContainer; PyObject *py_Command; const char *kwnames[] = { "hPrinter", "pPrinterContainer", "pDevModeContainer", "pSecurityContainer", "Command", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncSetPrinter", discard_const_p(char *, kwnames), &py_hPrinter, &py_pPrinterContainer, &py_pDevModeContainer, &py_pSecurityContainer, &py_Command)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pPrinterContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterContainer"); return false; } r->in.pPrinterContainer = talloc_ptrtype(r, r->in.pPrinterContainer); if (r->in.pPrinterContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_SetPrinterInfoCtr_Type, py_pPrinterContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pPrinterContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pPrinterContainer = (struct spoolss_SetPrinterInfoCtr *)pytalloc_get_ptr(py_pPrinterContainer); if (py_pDevModeContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDevModeContainer"); return false; } r->in.pDevModeContainer = talloc_ptrtype(r, r->in.pDevModeContainer); if (r->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_DevmodeContainer_Type, py_pDevModeContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pDevModeContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(py_pDevModeContainer); if (py_pSecurityContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pSecurityContainer"); return false; } r->in.pSecurityContainer = talloc_ptrtype(r, r->in.pSecurityContainer); if (r->in.pSecurityContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(sec_desc_buf_Type, py_pSecurityContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pSecurityContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pSecurityContainer = (struct sec_desc_buf *)pytalloc_get_ptr(py_pSecurityContainer); if (py_Command == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Command"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Command)); if (PyLong_Check(py_Command)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Command); 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.Command = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncSetPrinter_args_out(struct winspool_AsyncSetPrinter *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_winspool_AsyncGetPrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncGetPrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetPrinter_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncGetPrinter_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinter_in_get_pPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pPrinter; if (object->in.pPrinter == NULL) { Py_RETURN_NONE; } if (object->in.pPrinter == NULL) { py_pPrinter = Py_None; Py_INCREF(py_pPrinter); } else { py_pPrinter = PyList_New(object->in.cbBuf); if (py_pPrinter == NULL) { return NULL; } { int pPrinter_cntr_1; for (pPrinter_cntr_1 = 0; pPrinter_cntr_1 < (object->in.cbBuf); pPrinter_cntr_1++) { PyObject *py_pPrinter_1; py_pPrinter_1 = PyLong_FromLong((uint16_t)object->in.pPrinter[pPrinter_cntr_1]); PyList_SetItem(py_pPrinter, pPrinter_cntr_1, py_pPrinter_1); } } } return py_pPrinter; } static int py_winspool_AsyncGetPrinter_in_set_pPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPrinter)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinter"); return -1; } if (value == Py_None) { object->in.pPrinter = NULL; } else { object->in.pPrinter = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrinter_cntr_1; object->in.pPrinter = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrinter, PyList_GET_SIZE(value)); if (!object->in.pPrinter) { return -1;; } talloc_set_name_const(object->in.pPrinter, "ARRAY: object->in.pPrinter"); for (pPrinter_cntr_1 = 0; pPrinter_cntr_1 < PyList_GET_SIZE(value); pPrinter_cntr_1++) { if (PyList_GET_ITEM(value, pPrinter_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinter[pPrinter_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pPrinter[pPrinter_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrinter_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrinter_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->in.pPrinter[pPrinter_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinter_out_get_pPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pPrinter; if (object->out.pPrinter == NULL) { Py_RETURN_NONE; } if (object->out.pPrinter == NULL) { py_pPrinter = Py_None; Py_INCREF(py_pPrinter); } else { py_pPrinter = PyList_New(object->in.cbBuf); if (py_pPrinter == NULL) { return NULL; } { int pPrinter_cntr_1; for (pPrinter_cntr_1 = 0; pPrinter_cntr_1 < (object->in.cbBuf); pPrinter_cntr_1++) { PyObject *py_pPrinter_1; py_pPrinter_1 = PyLong_FromLong((uint16_t)object->out.pPrinter[pPrinter_cntr_1]); PyList_SetItem(py_pPrinter, pPrinter_cntr_1, py_pPrinter_1); } } } return py_pPrinter; } static int py_winspool_AsyncGetPrinter_out_set_pPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pPrinter)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrinter"); return -1; } if (value == Py_None) { object->out.pPrinter = NULL; } else { object->out.pPrinter = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrinter_cntr_1; object->out.pPrinter = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pPrinter, PyList_GET_SIZE(value)); if (!object->out.pPrinter) { return -1;; } talloc_set_name_const(object->out.pPrinter, "ARRAY: object->out.pPrinter"); for (pPrinter_cntr_1 = 0; pPrinter_cntr_1 < PyList_GET_SIZE(value); pPrinter_cntr_1++) { if (PyList_GET_ITEM(value, pPrinter_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrinter[pPrinter_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pPrinter[pPrinter_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrinter_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrinter_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.pPrinter[pPrinter_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinter_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncGetPrinter_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinter_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetPrinter_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)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_winspool_AsyncGetPrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncGetPrinter_in_get_hPrinter, .set = py_winspool_AsyncGetPrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncGetPrinter_in_get_Level, .set = py_winspool_AsyncGetPrinter_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pPrinter"), .get = py_winspool_AsyncGetPrinter_in_get_pPrinter, .set = py_winspool_AsyncGetPrinter_in_set_pPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pPrinter"), .get = py_winspool_AsyncGetPrinter_out_get_pPrinter, .set = py_winspool_AsyncGetPrinter_out_set_pPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncGetPrinter_in_get_cbBuf, .set = py_winspool_AsyncGetPrinter_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetPrinter_out_get_pcbNeeded, .set = py_winspool_AsyncGetPrinter_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetPrinter_get_result, .set = py_winspool_AsyncGetPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetPrinter, type); struct winspool_AsyncGetPrinter *_self = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(9); } static PyObject *py_winspool_AsyncGetPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 10) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[9]; 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_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinter_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 winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 10) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[9]; 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_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinter *object = (struct winspool_AsyncGetPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 10) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[9]; 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_winspool_AsyncGetPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinter_ndr_print(py_obj, "winspool_AsyncGetPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncGetPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinter_ndr_print(py_obj, "winspool_AsyncGetPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetPrinter.opnum() -> 9 (0x09) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_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_winspool_AsyncGetPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetPrinter", .tp_getset = py_winspool_AsyncGetPrinter_getsetters, .tp_methods = py_winspool_AsyncGetPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetPrinter_new, }; static bool pack_py_winspool_AsyncGetPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetPrinter *r) { PyObject *py_hPrinter; PyObject *py_Level; PyObject *py_pPrinter; const char *kwnames[] = { "hPrinter", "Level", "pPrinter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncGetPrinter", discard_const_p(char *, kwnames), &py_hPrinter, &py_Level, &py_pPrinter)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinter"); return false; } if (py_pPrinter == Py_None) { r->in.pPrinter = NULL; } else { r->in.pPrinter = NULL; PY_CHECK_TYPE(&PyList_Type, py_pPrinter, return false;); { int pPrinter_cntr_1; r->in.pPrinter = talloc_array_ptrtype(r, r->in.pPrinter, PyList_GET_SIZE(py_pPrinter)); if (!r->in.pPrinter) { return false;; } talloc_set_name_const(r->in.pPrinter, "ARRAY: r->in.pPrinter"); for (pPrinter_cntr_1 = 0; pPrinter_cntr_1 < PyList_GET_SIZE(py_pPrinter); pPrinter_cntr_1++) { if (PyList_GET_ITEM(py_pPrinter, pPrinter_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinter[pPrinter_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pPrinter[pPrinter_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pPrinter, pPrinter_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pPrinter, pPrinter_cntr_1)); 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.pPrinter[pPrinter_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pPrinter, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pPrinter); return true; } static PyObject *unpack_py_winspool_AsyncGetPrinter_args_out(struct winspool_AsyncGetPrinter *r) { PyObject *result; PyObject *py_pPrinter; PyObject *py_pcbNeeded; result = PyTuple_New(2); if (r->out.pPrinter == NULL) { py_pPrinter = Py_None; Py_INCREF(py_pPrinter); } else { py_pPrinter = PyList_New(r->in.cbBuf); if (py_pPrinter == NULL) { return NULL; } { int pPrinter_cntr_1; for (pPrinter_cntr_1 = 0; pPrinter_cntr_1 < (r->in.cbBuf); pPrinter_cntr_1++) { PyObject *py_pPrinter_1; py_pPrinter_1 = PyLong_FromLong((uint16_t)r->out.pPrinter[pPrinter_cntr_1]); PyList_SetItem(py_pPrinter, pPrinter_cntr_1, py_pPrinter_1); } } } PyTuple_SetItem(result, 0, py_pPrinter); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncStartDocPrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncStartDocPrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncStartDocPrinter_in_get_pDocInfoContainer(PyObject *obj, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(obj); PyObject *py_pDocInfoContainer; if (object->in.pDocInfoContainer == NULL) { Py_RETURN_NONE; } py_pDocInfoContainer = pytalloc_reference_ex(spoolss_DocumentInfoCtr_Type, object->in.pDocInfoContainer, object->in.pDocInfoContainer); return py_pDocInfoContainer; } static int py_winspool_AsyncStartDocPrinter_in_set_pDocInfoContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDocInfoContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDocInfoContainer"); return -1; } object->in.pDocInfoContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDocInfoContainer); if (object->in.pDocInfoContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_DocumentInfoCtr_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.pDocInfoContainer = (struct spoolss_DocumentInfoCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncStartDocPrinter_out_get_pJobId(PyObject *obj, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(obj); PyObject *py_pJobId; if (object->out.pJobId == NULL) { Py_RETURN_NONE; } py_pJobId = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pJobId); return py_pJobId; } static int py_winspool_AsyncStartDocPrinter_out_set_pJobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pJobId)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pJobId"); return -1; } object->out.pJobId = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pJobId); if (object->out.pJobId == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pJobId)); 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.pJobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncStartDocPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncStartDocPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)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_winspool_AsyncStartDocPrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncStartDocPrinter_in_get_hPrinter, .set = py_winspool_AsyncStartDocPrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pDocInfoContainer"), .get = py_winspool_AsyncStartDocPrinter_in_get_pDocInfoContainer, .set = py_winspool_AsyncStartDocPrinter_in_set_pDocInfoContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_DocumentInfoCtr") }, { .name = discard_const_p(char, "out_pJobId"), .get = py_winspool_AsyncStartDocPrinter_out_get_pJobId, .set = py_winspool_AsyncStartDocPrinter_out_set_pJobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncStartDocPrinter_get_result, .set = py_winspool_AsyncStartDocPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncStartDocPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncStartDocPrinter, type); struct winspool_AsyncStartDocPrinter *_self = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pDocInfoContainer = talloc_zero(mem_ctx, struct spoolss_DocumentInfoCtr); _self->out.pJobId = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncStartDocPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(10); } static PyObject *py_winspool_AsyncStartDocPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncStartDocPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncStartDocPrinter_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 winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncStartDocPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncStartDocPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncStartDocPrinter *object = (struct winspool_AsyncStartDocPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncStartDocPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncStartDocPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncStartDocPrinter_ndr_print(py_obj, "winspool_AsyncStartDocPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncStartDocPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncStartDocPrinter_ndr_print(py_obj, "winspool_AsyncStartDocPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncStartDocPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncStartDocPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncStartDocPrinter.opnum() -> 10 (0x0a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_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_winspool_AsyncStartDocPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncStartDocPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncStartDocPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncStartDocPrinter", .tp_getset = py_winspool_AsyncStartDocPrinter_getsetters, .tp_methods = py_winspool_AsyncStartDocPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncStartDocPrinter_new, }; static bool pack_py_winspool_AsyncStartDocPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncStartDocPrinter *r) { PyObject *py_hPrinter; PyObject *py_pDocInfoContainer; const char *kwnames[] = { "hPrinter", "pDocInfoContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncStartDocPrinter", discard_const_p(char *, kwnames), &py_hPrinter, &py_pDocInfoContainer)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pDocInfoContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDocInfoContainer"); return false; } r->in.pDocInfoContainer = talloc_ptrtype(r, r->in.pDocInfoContainer); if (r->in.pDocInfoContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_DocumentInfoCtr_Type, py_pDocInfoContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pDocInfoContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pDocInfoContainer = (struct spoolss_DocumentInfoCtr *)pytalloc_get_ptr(py_pDocInfoContainer); return true; } static PyObject *unpack_py_winspool_AsyncStartDocPrinter_args_out(struct winspool_AsyncStartDocPrinter *r) { PyObject *result; PyObject *py_pJobId; py_pJobId = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pJobId); result = py_pJobId; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncStartPagePrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncStartPagePrinter *object = (struct winspool_AsyncStartPagePrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncStartPagePrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncStartPagePrinter *object = (struct winspool_AsyncStartPagePrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncStartPagePrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncStartPagePrinter *object = (struct winspool_AsyncStartPagePrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncStartPagePrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncStartPagePrinter *object = (struct winspool_AsyncStartPagePrinter *)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_winspool_AsyncStartPagePrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncStartPagePrinter_in_get_hPrinter, .set = py_winspool_AsyncStartPagePrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncStartPagePrinter_get_result, .set = py_winspool_AsyncStartPagePrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncStartPagePrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncStartPagePrinter, type); return self; } static PyObject *py_winspool_AsyncStartPagePrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(11); } static PyObject *py_winspool_AsyncStartPagePrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncStartPagePrinter *object = (struct winspool_AsyncStartPagePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncStartPagePrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncStartPagePrinter_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 winspool_AsyncStartPagePrinter *object = (struct winspool_AsyncStartPagePrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncStartPagePrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncStartPagePrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncStartPagePrinter *object = (struct winspool_AsyncStartPagePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncStartPagePrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncStartPagePrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncStartPagePrinter_ndr_print(py_obj, "winspool_AsyncStartPagePrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncStartPagePrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncStartPagePrinter_ndr_print(py_obj, "winspool_AsyncStartPagePrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncStartPagePrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncStartPagePrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncStartPagePrinter.opnum() -> 11 (0x0b) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_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_winspool_AsyncStartPagePrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncStartPagePrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncStartPagePrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncStartPagePrinter", .tp_getset = py_winspool_AsyncStartPagePrinter_getsetters, .tp_methods = py_winspool_AsyncStartPagePrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncStartPagePrinter_new, }; static bool pack_py_winspool_AsyncStartPagePrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncStartPagePrinter *r) { PyObject *py_hPrinter; const char *kwnames[] = { "hPrinter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncStartPagePrinter", discard_const_p(char *, kwnames), &py_hPrinter)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); return true; } static PyObject *unpack_py_winspool_AsyncStartPagePrinter_args_out(struct winspool_AsyncStartPagePrinter *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_winspool_AsyncWritePrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncWritePrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncWritePrinter_in_get_pBuf(PyObject *obj, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(obj); PyObject *py_pBuf; if (object->in.pBuf == NULL) { Py_RETURN_NONE; } py_pBuf = PyList_New(object->in.cbBuf); if (py_pBuf == NULL) { return NULL; } { int pBuf_cntr_1; for (pBuf_cntr_1 = 0; pBuf_cntr_1 < (object->in.cbBuf); pBuf_cntr_1++) { PyObject *py_pBuf_1; py_pBuf_1 = PyLong_FromLong((uint16_t)object->in.pBuf[pBuf_cntr_1]); PyList_SetItem(py_pBuf, pBuf_cntr_1, py_pBuf_1); } } return py_pBuf; } static int py_winspool_AsyncWritePrinter_in_set_pBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pBuf)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pBuf"); return -1; } object->in.pBuf = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pBuf); if (object->in.pBuf == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pBuf_cntr_1; object->in.pBuf = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pBuf, PyList_GET_SIZE(value)); if (!object->in.pBuf) { return -1;; } talloc_set_name_const(object->in.pBuf, "ARRAY: object->in.pBuf"); for (pBuf_cntr_1 = 0; pBuf_cntr_1 < PyList_GET_SIZE(value); pBuf_cntr_1++) { if (PyList_GET_ITEM(value, pBuf_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pBuf[pBuf_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pBuf[pBuf_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pBuf_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pBuf_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->in.pBuf[pBuf_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncWritePrinter_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncWritePrinter_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncWritePrinter_out_get_pcWritten(PyObject *obj, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(obj); PyObject *py_pcWritten; if (object->out.pcWritten == NULL) { Py_RETURN_NONE; } py_pcWritten = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcWritten); return py_pcWritten; } static int py_winspool_AsyncWritePrinter_out_set_pcWritten(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcWritten)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcWritten"); return -1; } object->out.pcWritten = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcWritten); if (object->out.pcWritten == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcWritten)); 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.pcWritten = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncWritePrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncWritePrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)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_winspool_AsyncWritePrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncWritePrinter_in_get_hPrinter, .set = py_winspool_AsyncWritePrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pBuf"), .get = py_winspool_AsyncWritePrinter_in_get_pBuf, .set = py_winspool_AsyncWritePrinter_in_set_pBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncWritePrinter_in_get_cbBuf, .set = py_winspool_AsyncWritePrinter_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcWritten"), .get = py_winspool_AsyncWritePrinter_out_get_pcWritten, .set = py_winspool_AsyncWritePrinter_out_set_pcWritten, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncWritePrinter_get_result, .set = py_winspool_AsyncWritePrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncWritePrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncWritePrinter, type); struct winspool_AsyncWritePrinter *_self = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pBuf = talloc_zero(mem_ctx, uint8_t); _self->out.pcWritten = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncWritePrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(12); } static PyObject *py_winspool_AsyncWritePrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 13) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncWritePrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[12]; 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_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncWritePrinter_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 winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 13) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncWritePrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[12]; 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_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncWritePrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncWritePrinter *object = (struct winspool_AsyncWritePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 13) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncWritePrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[12]; 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_winspool_AsyncWritePrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncWritePrinter_ndr_print(py_obj, "winspool_AsyncWritePrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncWritePrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncWritePrinter_ndr_print(py_obj, "winspool_AsyncWritePrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncWritePrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncWritePrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncWritePrinter.opnum() -> 12 (0x0c) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_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_winspool_AsyncWritePrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncWritePrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncWritePrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncWritePrinter", .tp_getset = py_winspool_AsyncWritePrinter_getsetters, .tp_methods = py_winspool_AsyncWritePrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncWritePrinter_new, }; static bool pack_py_winspool_AsyncWritePrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncWritePrinter *r) { PyObject *py_hPrinter; PyObject *py_pBuf; const char *kwnames[] = { "hPrinter", "pBuf", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncWritePrinter", discard_const_p(char *, kwnames), &py_hPrinter, &py_pBuf)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pBuf == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pBuf"); return false; } r->in.pBuf = talloc_ptrtype(r, r->in.pBuf); if (r->in.pBuf == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PyList_Type, py_pBuf, return false;); { int pBuf_cntr_1; r->in.pBuf = talloc_array_ptrtype(r, r->in.pBuf, PyList_GET_SIZE(py_pBuf)); if (!r->in.pBuf) { return false;; } talloc_set_name_const(r->in.pBuf, "ARRAY: r->in.pBuf"); for (pBuf_cntr_1 = 0; pBuf_cntr_1 < PyList_GET_SIZE(py_pBuf); pBuf_cntr_1++) { if (PyList_GET_ITEM(py_pBuf, pBuf_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pBuf[pBuf_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pBuf[pBuf_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pBuf, pBuf_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pBuf, pBuf_cntr_1)); 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.pBuf[pBuf_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } PY_CHECK_TYPE(&PyList_Type, py_pBuf, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pBuf); return true; } static PyObject *unpack_py_winspool_AsyncWritePrinter_args_out(struct winspool_AsyncWritePrinter *r) { PyObject *result; PyObject *py_pcWritten; py_pcWritten = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcWritten); result = py_pcWritten; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEndPagePrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEndPagePrinter *object = (struct winspool_AsyncEndPagePrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEndPagePrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEndPagePrinter *object = (struct winspool_AsyncEndPagePrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEndPagePrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEndPagePrinter *object = (struct winspool_AsyncEndPagePrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEndPagePrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEndPagePrinter *object = (struct winspool_AsyncEndPagePrinter *)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_winspool_AsyncEndPagePrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEndPagePrinter_in_get_hPrinter, .set = py_winspool_AsyncEndPagePrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEndPagePrinter_get_result, .set = py_winspool_AsyncEndPagePrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEndPagePrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEndPagePrinter, type); return self; } static PyObject *py_winspool_AsyncEndPagePrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(13); } static PyObject *py_winspool_AsyncEndPagePrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEndPagePrinter *object = (struct winspool_AsyncEndPagePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEndPagePrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEndPagePrinter_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 winspool_AsyncEndPagePrinter *object = (struct winspool_AsyncEndPagePrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEndPagePrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEndPagePrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEndPagePrinter *object = (struct winspool_AsyncEndPagePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEndPagePrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncEndPagePrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEndPagePrinter_ndr_print(py_obj, "winspool_AsyncEndPagePrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncEndPagePrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEndPagePrinter_ndr_print(py_obj, "winspool_AsyncEndPagePrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEndPagePrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEndPagePrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEndPagePrinter.opnum() -> 13 (0x0d) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_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_winspool_AsyncEndPagePrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEndPagePrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEndPagePrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEndPagePrinter", .tp_getset = py_winspool_AsyncEndPagePrinter_getsetters, .tp_methods = py_winspool_AsyncEndPagePrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEndPagePrinter_new, }; static bool pack_py_winspool_AsyncEndPagePrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEndPagePrinter *r) { PyObject *py_hPrinter; const char *kwnames[] = { "hPrinter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncEndPagePrinter", discard_const_p(char *, kwnames), &py_hPrinter)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); return true; } static PyObject *unpack_py_winspool_AsyncEndPagePrinter_args_out(struct winspool_AsyncEndPagePrinter *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_winspool_AsyncEndDocPrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEndDocPrinter *object = (struct winspool_AsyncEndDocPrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEndDocPrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEndDocPrinter *object = (struct winspool_AsyncEndDocPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEndDocPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEndDocPrinter *object = (struct winspool_AsyncEndDocPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEndDocPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEndDocPrinter *object = (struct winspool_AsyncEndDocPrinter *)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_winspool_AsyncEndDocPrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEndDocPrinter_in_get_hPrinter, .set = py_winspool_AsyncEndDocPrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEndDocPrinter_get_result, .set = py_winspool_AsyncEndDocPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEndDocPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEndDocPrinter, type); return self; } static PyObject *py_winspool_AsyncEndDocPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(14); } static PyObject *py_winspool_AsyncEndDocPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEndDocPrinter *object = (struct winspool_AsyncEndDocPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 15) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEndDocPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[14]; 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_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEndDocPrinter_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 winspool_AsyncEndDocPrinter *object = (struct winspool_AsyncEndDocPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 15) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEndDocPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[14]; 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_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEndDocPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEndDocPrinter *object = (struct winspool_AsyncEndDocPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 15) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEndDocPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[14]; 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_winspool_AsyncEndDocPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEndDocPrinter_ndr_print(py_obj, "winspool_AsyncEndDocPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncEndDocPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEndDocPrinter_ndr_print(py_obj, "winspool_AsyncEndDocPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEndDocPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEndDocPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEndDocPrinter.opnum() -> 14 (0x0e) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_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_winspool_AsyncEndDocPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEndDocPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEndDocPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEndDocPrinter", .tp_getset = py_winspool_AsyncEndDocPrinter_getsetters, .tp_methods = py_winspool_AsyncEndDocPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEndDocPrinter_new, }; static bool pack_py_winspool_AsyncEndDocPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEndDocPrinter *r) { PyObject *py_hPrinter; const char *kwnames[] = { "hPrinter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncEndDocPrinter", discard_const_p(char *, kwnames), &py_hPrinter)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); return true; } static PyObject *unpack_py_winspool_AsyncEndDocPrinter_args_out(struct winspool_AsyncEndDocPrinter *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_winspool_AsyncAbortPrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncAbortPrinter *object = (struct winspool_AsyncAbortPrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncAbortPrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAbortPrinter *object = (struct winspool_AsyncAbortPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAbortPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAbortPrinter *object = (struct winspool_AsyncAbortPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAbortPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAbortPrinter *object = (struct winspool_AsyncAbortPrinter *)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_winspool_AsyncAbortPrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncAbortPrinter_in_get_hPrinter, .set = py_winspool_AsyncAbortPrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAbortPrinter_get_result, .set = py_winspool_AsyncAbortPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAbortPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAbortPrinter, type); return self; } static PyObject *py_winspool_AsyncAbortPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(15); } static PyObject *py_winspool_AsyncAbortPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAbortPrinter *object = (struct winspool_AsyncAbortPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 16) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAbortPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[15]; 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_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAbortPrinter_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 winspool_AsyncAbortPrinter *object = (struct winspool_AsyncAbortPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 16) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAbortPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[15]; 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_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAbortPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAbortPrinter *object = (struct winspool_AsyncAbortPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 16) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAbortPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[15]; 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_winspool_AsyncAbortPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAbortPrinter_ndr_print(py_obj, "winspool_AsyncAbortPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncAbortPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAbortPrinter_ndr_print(py_obj, "winspool_AsyncAbortPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAbortPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAbortPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAbortPrinter.opnum() -> 15 (0x0f) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_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_winspool_AsyncAbortPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAbortPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAbortPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAbortPrinter", .tp_getset = py_winspool_AsyncAbortPrinter_getsetters, .tp_methods = py_winspool_AsyncAbortPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAbortPrinter_new, }; static bool pack_py_winspool_AsyncAbortPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAbortPrinter *r) { PyObject *py_hPrinter; const char *kwnames[] = { "hPrinter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncAbortPrinter", discard_const_p(char *, kwnames), &py_hPrinter)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); return true; } static PyObject *unpack_py_winspool_AsyncAbortPrinter_args_out(struct winspool_AsyncAbortPrinter *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_winspool_AsyncGetPrinterData_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncGetPrinterData_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetPrinterData_in_get_pValueName(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pValueName; if (object->in.pValueName == NULL) { Py_RETURN_NONE; } if (object->in.pValueName == NULL) { py_pValueName = Py_None; Py_INCREF(py_pValueName); } else { py_pValueName = PyUnicode_Decode(object->in.pValueName, strlen(object->in.pValueName), "utf-8", "ignore"); } return py_pValueName; } static int py_winspool_AsyncGetPrinterData_in_set_pValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pValueName"); return -1; } object->in.pValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pValueName); if (object->in.pValueName == 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.pValueName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetPrinterData_out_get_pType(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pType; if (object->out.pType == NULL) { Py_RETURN_NONE; } py_pType = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pType); return py_pType; } static int py_winspool_AsyncGetPrinterData_out_set_pType(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pType)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pType"); return -1; } object->out.pType = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pType); if (object->out.pType == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pType)); 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.pType = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterData_out_get_pData(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pData; if (object->out.pData == NULL) { Py_RETURN_NONE; } py_pData = PyList_New(object->in.nSize); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (object->in.nSize); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)object->out.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } return py_pData; } static int py_winspool_AsyncGetPrinterData_out_set_pData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pData"); return -1; } object->out.pData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pData); if (object->out.pData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pData_cntr_1; object->out.pData = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pData, PyList_GET_SIZE(value)); if (!object->out.pData) { return -1;; } talloc_set_name_const(object->out.pData, "ARRAY: object->out.pData"); for (pData_cntr_1 = 0; pData_cntr_1 < PyList_GET_SIZE(value); pData_cntr_1++) { if (PyList_GET_ITEM(value, pData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pData[pData_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pData[pData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pData_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.pData[pData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterData_in_get_nSize(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_nSize; py_nSize = PyLong_FromUnsignedLongLong((uint32_t)object->in.nSize); return py_nSize; } static int py_winspool_AsyncGetPrinterData_in_set_nSize(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.nSize"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.nSize)); 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.nSize = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterData_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetPrinterData_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterData_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetPrinterData_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)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_winspool_AsyncGetPrinterData_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncGetPrinterData_in_get_hPrinter, .set = py_winspool_AsyncGetPrinterData_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pValueName"), .get = py_winspool_AsyncGetPrinterData_in_get_pValueName, .set = py_winspool_AsyncGetPrinterData_in_set_pValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pType"), .get = py_winspool_AsyncGetPrinterData_out_get_pType, .set = py_winspool_AsyncGetPrinterData_out_set_pType, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pData"), .get = py_winspool_AsyncGetPrinterData_out_get_pData, .set = py_winspool_AsyncGetPrinterData_out_set_pData, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_nSize"), .get = py_winspool_AsyncGetPrinterData_in_get_nSize, .set = py_winspool_AsyncGetPrinterData_in_set_nSize, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetPrinterData_out_get_pcbNeeded, .set = py_winspool_AsyncGetPrinterData_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetPrinterData_get_result, .set = py_winspool_AsyncGetPrinterData_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetPrinterData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetPrinterData, type); struct winspool_AsyncGetPrinterData *_self = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pType = talloc_zero(mem_ctx, uint32_t); _self->out.pData = talloc_zero(mem_ctx, uint8_t); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetPrinterData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(16); } static PyObject *py_winspool_AsyncGetPrinterData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 17) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterData_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[16]; 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_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterData_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 winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 17) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterData_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[16]; 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_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterData *object = (struct winspool_AsyncGetPrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 17) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterData_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[16]; 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_winspool_AsyncGetPrinterData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterData_ndr_print(py_obj, "winspool_AsyncGetPrinterData_in", NDR_IN); } static PyObject *py_winspool_AsyncGetPrinterData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterData_ndr_print(py_obj, "winspool_AsyncGetPrinterData_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetPrinterData_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetPrinterData_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetPrinterData.opnum() -> 16 (0x10) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_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_winspool_AsyncGetPrinterData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetPrinterData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetPrinterData_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetPrinterData", .tp_getset = py_winspool_AsyncGetPrinterData_getsetters, .tp_methods = py_winspool_AsyncGetPrinterData_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetPrinterData_new, }; static bool pack_py_winspool_AsyncGetPrinterData_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetPrinterData *r) { PyObject *py_hPrinter; PyObject *py_pValueName; PyObject *py_nSize; const char *kwnames[] = { "hPrinter", "pValueName", "nSize", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncGetPrinterData", discard_const_p(char *, kwnames), &py_hPrinter, &py_pValueName, &py_nSize)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pValueName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pValueName"); return false; } r->in.pValueName = talloc_ptrtype(r, r->in.pValueName); if (r->in.pValueName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pValueName)) { unicode = PyUnicode_AsEncodedString(py_pValueName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pValueName)) { test_str = PyBytes_AS_STRING(py_pValueName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pValueName)->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.pValueName = talloc_str; } if (py_nSize == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.nSize"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.nSize)); if (PyLong_Check(py_nSize)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_nSize); 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.nSize = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncGetPrinterData_args_out(struct winspool_AsyncGetPrinterData *r) { PyObject *result; PyObject *py_pType; PyObject *py_pData; PyObject *py_pcbNeeded; result = PyTuple_New(3); py_pType = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pType); PyTuple_SetItem(result, 0, py_pType); py_pData = PyList_New(r->in.nSize); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (r->in.nSize); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)r->out.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } PyTuple_SetItem(result, 1, py_pData); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 2, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncGetPrinterDataEx_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncGetPrinterDataEx_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetPrinterDataEx_in_get_pKeyName(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pKeyName; if (object->in.pKeyName == NULL) { Py_RETURN_NONE; } if (object->in.pKeyName == NULL) { py_pKeyName = Py_None; Py_INCREF(py_pKeyName); } else { py_pKeyName = PyUnicode_Decode(object->in.pKeyName, strlen(object->in.pKeyName), "utf-8", "ignore"); } return py_pKeyName; } static int py_winspool_AsyncGetPrinterDataEx_in_set_pKeyName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pKeyName"); return -1; } object->in.pKeyName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pKeyName); if (object->in.pKeyName == 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.pKeyName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetPrinterDataEx_in_get_pValueName(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pValueName; if (object->in.pValueName == NULL) { Py_RETURN_NONE; } if (object->in.pValueName == NULL) { py_pValueName = Py_None; Py_INCREF(py_pValueName); } else { py_pValueName = PyUnicode_Decode(object->in.pValueName, strlen(object->in.pValueName), "utf-8", "ignore"); } return py_pValueName; } static int py_winspool_AsyncGetPrinterDataEx_in_set_pValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pValueName"); return -1; } object->in.pValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pValueName); if (object->in.pValueName == 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.pValueName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetPrinterDataEx_out_get_pType(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pType; if (object->out.pType == NULL) { Py_RETURN_NONE; } py_pType = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pType); return py_pType; } static int py_winspool_AsyncGetPrinterDataEx_out_set_pType(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pType)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pType"); return -1; } object->out.pType = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pType); if (object->out.pType == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pType)); 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.pType = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDataEx_out_get_pData(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pData; if (object->out.pData == NULL) { Py_RETURN_NONE; } py_pData = PyList_New(object->in.nSize); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (object->in.nSize); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)object->out.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } return py_pData; } static int py_winspool_AsyncGetPrinterDataEx_out_set_pData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pData"); return -1; } object->out.pData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pData); if (object->out.pData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pData_cntr_1; object->out.pData = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pData, PyList_GET_SIZE(value)); if (!object->out.pData) { return -1;; } talloc_set_name_const(object->out.pData, "ARRAY: object->out.pData"); for (pData_cntr_1 = 0; pData_cntr_1 < PyList_GET_SIZE(value); pData_cntr_1++) { if (PyList_GET_ITEM(value, pData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pData[pData_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pData[pData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pData_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.pData[pData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDataEx_in_get_nSize(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_nSize; py_nSize = PyLong_FromUnsignedLongLong((uint32_t)object->in.nSize); return py_nSize; } static int py_winspool_AsyncGetPrinterDataEx_in_set_nSize(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.nSize"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.nSize)); 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.nSize = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDataEx_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetPrinterDataEx_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDataEx_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetPrinterDataEx_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)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_winspool_AsyncGetPrinterDataEx_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncGetPrinterDataEx_in_get_hPrinter, .set = py_winspool_AsyncGetPrinterDataEx_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pKeyName"), .get = py_winspool_AsyncGetPrinterDataEx_in_get_pKeyName, .set = py_winspool_AsyncGetPrinterDataEx_in_set_pKeyName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pValueName"), .get = py_winspool_AsyncGetPrinterDataEx_in_get_pValueName, .set = py_winspool_AsyncGetPrinterDataEx_in_set_pValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pType"), .get = py_winspool_AsyncGetPrinterDataEx_out_get_pType, .set = py_winspool_AsyncGetPrinterDataEx_out_set_pType, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pData"), .get = py_winspool_AsyncGetPrinterDataEx_out_get_pData, .set = py_winspool_AsyncGetPrinterDataEx_out_set_pData, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_nSize"), .get = py_winspool_AsyncGetPrinterDataEx_in_get_nSize, .set = py_winspool_AsyncGetPrinterDataEx_in_set_nSize, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetPrinterDataEx_out_get_pcbNeeded, .set = py_winspool_AsyncGetPrinterDataEx_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetPrinterDataEx_get_result, .set = py_winspool_AsyncGetPrinterDataEx_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetPrinterDataEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetPrinterDataEx, type); struct winspool_AsyncGetPrinterDataEx *_self = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pType = talloc_zero(mem_ctx, uint32_t); _self->out.pData = talloc_zero(mem_ctx, uint8_t); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetPrinterDataEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(17); } static PyObject *py_winspool_AsyncGetPrinterDataEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 18) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDataEx_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[17]; 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_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDataEx_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 winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 18) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDataEx_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[17]; 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_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDataEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDataEx *object = (struct winspool_AsyncGetPrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 18) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDataEx_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[17]; 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_winspool_AsyncGetPrinterDataEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDataEx_ndr_print(py_obj, "winspool_AsyncGetPrinterDataEx_in", NDR_IN); } static PyObject *py_winspool_AsyncGetPrinterDataEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDataEx_ndr_print(py_obj, "winspool_AsyncGetPrinterDataEx_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetPrinterDataEx_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetPrinterDataEx_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetPrinterDataEx.opnum() -> 17 (0x11) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_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_winspool_AsyncGetPrinterDataEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetPrinterDataEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetPrinterDataEx_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetPrinterDataEx", .tp_getset = py_winspool_AsyncGetPrinterDataEx_getsetters, .tp_methods = py_winspool_AsyncGetPrinterDataEx_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetPrinterDataEx_new, }; static bool pack_py_winspool_AsyncGetPrinterDataEx_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetPrinterDataEx *r) { PyObject *py_hPrinter; PyObject *py_pKeyName; PyObject *py_pValueName; PyObject *py_nSize; const char *kwnames[] = { "hPrinter", "pKeyName", "pValueName", "nSize", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncGetPrinterDataEx", discard_const_p(char *, kwnames), &py_hPrinter, &py_pKeyName, &py_pValueName, &py_nSize)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pKeyName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pKeyName"); return false; } r->in.pKeyName = talloc_ptrtype(r, r->in.pKeyName); if (r->in.pKeyName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pKeyName)) { unicode = PyUnicode_AsEncodedString(py_pKeyName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pKeyName)) { test_str = PyBytes_AS_STRING(py_pKeyName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pKeyName)->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.pKeyName = talloc_str; } if (py_pValueName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pValueName"); return false; } r->in.pValueName = talloc_ptrtype(r, r->in.pValueName); if (r->in.pValueName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pValueName)) { unicode = PyUnicode_AsEncodedString(py_pValueName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pValueName)) { test_str = PyBytes_AS_STRING(py_pValueName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pValueName)->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.pValueName = talloc_str; } if (py_nSize == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.nSize"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.nSize)); if (PyLong_Check(py_nSize)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_nSize); 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.nSize = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncGetPrinterDataEx_args_out(struct winspool_AsyncGetPrinterDataEx *r) { PyObject *result; PyObject *py_pType; PyObject *py_pData; PyObject *py_pcbNeeded; result = PyTuple_New(3); py_pType = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pType); PyTuple_SetItem(result, 0, py_pType); py_pData = PyList_New(r->in.nSize); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (r->in.nSize); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)r->out.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } PyTuple_SetItem(result, 1, py_pData); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 2, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncSetPrinterData_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncSetPrinterData_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetPrinterData_in_get_pValueName(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pValueName; if (object->in.pValueName == NULL) { Py_RETURN_NONE; } if (object->in.pValueName == NULL) { py_pValueName = Py_None; Py_INCREF(py_pValueName); } else { py_pValueName = PyUnicode_Decode(object->in.pValueName, strlen(object->in.pValueName), "utf-8", "ignore"); } return py_pValueName; } static int py_winspool_AsyncSetPrinterData_in_set_pValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pValueName"); return -1; } object->in.pValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pValueName); if (object->in.pValueName == 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.pValueName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncSetPrinterData_in_get_Type(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_Type; py_Type = PyLong_FromUnsignedLongLong((uint32_t)object->in.Type); return py_Type; } static int py_winspool_AsyncSetPrinterData_in_set_Type(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.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.Type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetPrinterData_in_get_pData(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pData; if (object->in.pData == NULL) { Py_RETURN_NONE; } py_pData = PyList_New(object->in.cbData); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (object->in.cbData); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)object->in.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } return py_pData; } static int py_winspool_AsyncSetPrinterData_in_set_pData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pData"); return -1; } object->in.pData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pData); if (object->in.pData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pData_cntr_1; object->in.pData = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pData, PyList_GET_SIZE(value)); if (!object->in.pData) { return -1;; } talloc_set_name_const(object->in.pData, "ARRAY: object->in.pData"); for (pData_cntr_1 = 0; pData_cntr_1 < PyList_GET_SIZE(value); pData_cntr_1++) { if (PyList_GET_ITEM(value, pData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pData[pData_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pData[pData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pData_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->in.pData[pData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncSetPrinterData_in_get_cbData(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_cbData; py_cbData = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbData); return py_cbData; } static int py_winspool_AsyncSetPrinterData_in_set_cbData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbData"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbData)); 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.cbData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetPrinterData_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSetPrinterData_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)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_winspool_AsyncSetPrinterData_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncSetPrinterData_in_get_hPrinter, .set = py_winspool_AsyncSetPrinterData_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pValueName"), .get = py_winspool_AsyncSetPrinterData_in_get_pValueName, .set = py_winspool_AsyncSetPrinterData_in_set_pValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Type"), .get = py_winspool_AsyncSetPrinterData_in_get_Type, .set = py_winspool_AsyncSetPrinterData_in_set_Type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pData"), .get = py_winspool_AsyncSetPrinterData_in_get_pData, .set = py_winspool_AsyncSetPrinterData_in_set_pData, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbData"), .get = py_winspool_AsyncSetPrinterData_in_get_cbData, .set = py_winspool_AsyncSetPrinterData_in_set_cbData, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSetPrinterData_get_result, .set = py_winspool_AsyncSetPrinterData_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSetPrinterData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSetPrinterData, type); struct winspool_AsyncSetPrinterData *_self = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pData = talloc_zero(mem_ctx, uint8_t); return self; } static PyObject *py_winspool_AsyncSetPrinterData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(18); } static PyObject *py_winspool_AsyncSetPrinterData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 19) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinterData_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[18]; 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_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPrinterData_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 winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 19) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinterData_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[18]; 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_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPrinterData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPrinterData *object = (struct winspool_AsyncSetPrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 19) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinterData_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[18]; 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_winspool_AsyncSetPrinterData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPrinterData_ndr_print(py_obj, "winspool_AsyncSetPrinterData_in", NDR_IN); } static PyObject *py_winspool_AsyncSetPrinterData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPrinterData_ndr_print(py_obj, "winspool_AsyncSetPrinterData_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSetPrinterData_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSetPrinterData_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSetPrinterData.opnum() -> 18 (0x12) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_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_winspool_AsyncSetPrinterData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSetPrinterData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSetPrinterData_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSetPrinterData", .tp_getset = py_winspool_AsyncSetPrinterData_getsetters, .tp_methods = py_winspool_AsyncSetPrinterData_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSetPrinterData_new, }; static bool pack_py_winspool_AsyncSetPrinterData_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSetPrinterData *r) { PyObject *py_hPrinter; PyObject *py_pValueName; PyObject *py_Type; PyObject *py_pData; const char *kwnames[] = { "hPrinter", "pValueName", "Type", "pData", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncSetPrinterData", discard_const_p(char *, kwnames), &py_hPrinter, &py_pValueName, &py_Type, &py_pData)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pValueName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pValueName"); return false; } r->in.pValueName = talloc_ptrtype(r, r->in.pValueName); if (r->in.pValueName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pValueName)) { unicode = PyUnicode_AsEncodedString(py_pValueName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pValueName)) { test_str = PyBytes_AS_STRING(py_pValueName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pValueName)->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.pValueName = talloc_str; } if (py_Type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Type"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Type)); if (PyLong_Check(py_Type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_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.Type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pData == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pData"); return false; } r->in.pData = talloc_ptrtype(r, r->in.pData); if (r->in.pData == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PyList_Type, py_pData, return false;); { int pData_cntr_1; r->in.pData = talloc_array_ptrtype(r, r->in.pData, PyList_GET_SIZE(py_pData)); if (!r->in.pData) { return false;; } talloc_set_name_const(r->in.pData, "ARRAY: r->in.pData"); for (pData_cntr_1 = 0; pData_cntr_1 < PyList_GET_SIZE(py_pData); pData_cntr_1++) { if (PyList_GET_ITEM(py_pData, pData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pData[pData_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pData[pData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pData, pData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pData, pData_cntr_1)); 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.pData[pData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } PY_CHECK_TYPE(&PyList_Type, py_pData, return false;); r->in.cbData = PyList_GET_SIZE(py_pData); return true; } static PyObject *unpack_py_winspool_AsyncSetPrinterData_args_out(struct winspool_AsyncSetPrinterData *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_winspool_AsyncSetPrinterDataEx_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncSetPrinterDataEx_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetPrinterDataEx_in_get_pKeyName(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pKeyName; if (object->in.pKeyName == NULL) { Py_RETURN_NONE; } if (object->in.pKeyName == NULL) { py_pKeyName = Py_None; Py_INCREF(py_pKeyName); } else { py_pKeyName = PyUnicode_Decode(object->in.pKeyName, strlen(object->in.pKeyName), "utf-8", "ignore"); } return py_pKeyName; } static int py_winspool_AsyncSetPrinterDataEx_in_set_pKeyName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pKeyName"); return -1; } object->in.pKeyName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pKeyName); if (object->in.pKeyName == 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.pKeyName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncSetPrinterDataEx_in_get_pValueName(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pValueName; if (object->in.pValueName == NULL) { Py_RETURN_NONE; } if (object->in.pValueName == NULL) { py_pValueName = Py_None; Py_INCREF(py_pValueName); } else { py_pValueName = PyUnicode_Decode(object->in.pValueName, strlen(object->in.pValueName), "utf-8", "ignore"); } return py_pValueName; } static int py_winspool_AsyncSetPrinterDataEx_in_set_pValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pValueName"); return -1; } object->in.pValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pValueName); if (object->in.pValueName == 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.pValueName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncSetPrinterDataEx_in_get_Type(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_Type; py_Type = PyLong_FromUnsignedLongLong((uint32_t)object->in.Type); return py_Type; } static int py_winspool_AsyncSetPrinterDataEx_in_set_Type(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.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.Type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetPrinterDataEx_in_get_pData(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pData; if (object->in.pData == NULL) { Py_RETURN_NONE; } py_pData = PyList_New(object->in.cbData); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (object->in.cbData); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)object->in.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } return py_pData; } static int py_winspool_AsyncSetPrinterDataEx_in_set_pData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pData"); return -1; } object->in.pData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pData); if (object->in.pData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pData_cntr_1; object->in.pData = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pData, PyList_GET_SIZE(value)); if (!object->in.pData) { return -1;; } talloc_set_name_const(object->in.pData, "ARRAY: object->in.pData"); for (pData_cntr_1 = 0; pData_cntr_1 < PyList_GET_SIZE(value); pData_cntr_1++) { if (PyList_GET_ITEM(value, pData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pData[pData_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pData[pData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pData_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->in.pData[pData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncSetPrinterDataEx_in_get_cbData(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_cbData; py_cbData = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbData); return py_cbData; } static int py_winspool_AsyncSetPrinterDataEx_in_set_cbData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbData"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbData)); 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.cbData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetPrinterDataEx_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSetPrinterDataEx_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)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_winspool_AsyncSetPrinterDataEx_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncSetPrinterDataEx_in_get_hPrinter, .set = py_winspool_AsyncSetPrinterDataEx_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pKeyName"), .get = py_winspool_AsyncSetPrinterDataEx_in_get_pKeyName, .set = py_winspool_AsyncSetPrinterDataEx_in_set_pKeyName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pValueName"), .get = py_winspool_AsyncSetPrinterDataEx_in_get_pValueName, .set = py_winspool_AsyncSetPrinterDataEx_in_set_pValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Type"), .get = py_winspool_AsyncSetPrinterDataEx_in_get_Type, .set = py_winspool_AsyncSetPrinterDataEx_in_set_Type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pData"), .get = py_winspool_AsyncSetPrinterDataEx_in_get_pData, .set = py_winspool_AsyncSetPrinterDataEx_in_set_pData, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbData"), .get = py_winspool_AsyncSetPrinterDataEx_in_get_cbData, .set = py_winspool_AsyncSetPrinterDataEx_in_set_cbData, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSetPrinterDataEx_get_result, .set = py_winspool_AsyncSetPrinterDataEx_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSetPrinterDataEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSetPrinterDataEx, type); struct winspool_AsyncSetPrinterDataEx *_self = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pData = talloc_zero(mem_ctx, uint8_t); return self; } static PyObject *py_winspool_AsyncSetPrinterDataEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(19); } static PyObject *py_winspool_AsyncSetPrinterDataEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 20) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinterDataEx_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[19]; 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_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPrinterDataEx_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 winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 20) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinterDataEx_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[19]; 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_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPrinterDataEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPrinterDataEx *object = (struct winspool_AsyncSetPrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 20) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPrinterDataEx_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[19]; 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_winspool_AsyncSetPrinterDataEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPrinterDataEx_ndr_print(py_obj, "winspool_AsyncSetPrinterDataEx_in", NDR_IN); } static PyObject *py_winspool_AsyncSetPrinterDataEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPrinterDataEx_ndr_print(py_obj, "winspool_AsyncSetPrinterDataEx_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSetPrinterDataEx_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSetPrinterDataEx_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSetPrinterDataEx.opnum() -> 19 (0x13) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_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_winspool_AsyncSetPrinterDataEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSetPrinterDataEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSetPrinterDataEx_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSetPrinterDataEx", .tp_getset = py_winspool_AsyncSetPrinterDataEx_getsetters, .tp_methods = py_winspool_AsyncSetPrinterDataEx_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSetPrinterDataEx_new, }; static bool pack_py_winspool_AsyncSetPrinterDataEx_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSetPrinterDataEx *r) { PyObject *py_hPrinter; PyObject *py_pKeyName; PyObject *py_pValueName; PyObject *py_Type; PyObject *py_pData; const char *kwnames[] = { "hPrinter", "pKeyName", "pValueName", "Type", "pData", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncSetPrinterDataEx", discard_const_p(char *, kwnames), &py_hPrinter, &py_pKeyName, &py_pValueName, &py_Type, &py_pData)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pKeyName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pKeyName"); return false; } r->in.pKeyName = talloc_ptrtype(r, r->in.pKeyName); if (r->in.pKeyName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pKeyName)) { unicode = PyUnicode_AsEncodedString(py_pKeyName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pKeyName)) { test_str = PyBytes_AS_STRING(py_pKeyName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pKeyName)->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.pKeyName = talloc_str; } if (py_pValueName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pValueName"); return false; } r->in.pValueName = talloc_ptrtype(r, r->in.pValueName); if (r->in.pValueName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pValueName)) { unicode = PyUnicode_AsEncodedString(py_pValueName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pValueName)) { test_str = PyBytes_AS_STRING(py_pValueName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pValueName)->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.pValueName = talloc_str; } if (py_Type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Type"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Type)); if (PyLong_Check(py_Type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_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.Type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pData == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pData"); return false; } r->in.pData = talloc_ptrtype(r, r->in.pData); if (r->in.pData == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PyList_Type, py_pData, return false;); { int pData_cntr_1; r->in.pData = talloc_array_ptrtype(r, r->in.pData, PyList_GET_SIZE(py_pData)); if (!r->in.pData) { return false;; } talloc_set_name_const(r->in.pData, "ARRAY: r->in.pData"); for (pData_cntr_1 = 0; pData_cntr_1 < PyList_GET_SIZE(py_pData); pData_cntr_1++) { if (PyList_GET_ITEM(py_pData, pData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pData[pData_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pData[pData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pData, pData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pData, pData_cntr_1)); 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.pData[pData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } PY_CHECK_TYPE(&PyList_Type, py_pData, return false;); r->in.cbData = PyList_GET_SIZE(py_pData); return true; } static PyObject *unpack_py_winspool_AsyncSetPrinterDataEx_args_out(struct winspool_AsyncSetPrinterDataEx *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_winspool_AsyncClosePrinter_in_get_phPrinter(PyObject *obj, void *closure) { struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(obj); PyObject *py_phPrinter; if (object->in.phPrinter == NULL) { Py_RETURN_NONE; } py_phPrinter = pytalloc_reference_ex(policy_handle_Type, object->in.phPrinter, object->in.phPrinter); return py_phPrinter; } static int py_winspool_AsyncClosePrinter_in_set_phPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.phPrinter)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.phPrinter"); return -1; } object->in.phPrinter = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.phPrinter); if (object->in.phPrinter == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.phPrinter = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncClosePrinter_out_get_phPrinter(PyObject *obj, void *closure) { struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(obj); PyObject *py_phPrinter; if (object->out.phPrinter == NULL) { Py_RETURN_NONE; } py_phPrinter = pytalloc_reference_ex(policy_handle_Type, object->out.phPrinter, object->out.phPrinter); return py_phPrinter; } static int py_winspool_AsyncClosePrinter_out_set_phPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.phPrinter)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.phPrinter"); return -1; } object->out.phPrinter = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.phPrinter); if (object->out.phPrinter == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.phPrinter = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncClosePrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncClosePrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)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_winspool_AsyncClosePrinter_getsetters[] = { { .name = discard_const_p(char, "in_phPrinter"), .get = py_winspool_AsyncClosePrinter_in_get_phPrinter, .set = py_winspool_AsyncClosePrinter_in_set_phPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_phPrinter"), .get = py_winspool_AsyncClosePrinter_out_get_phPrinter, .set = py_winspool_AsyncClosePrinter_out_set_phPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncClosePrinter_get_result, .set = py_winspool_AsyncClosePrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncClosePrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncClosePrinter, type); struct winspool_AsyncClosePrinter *_self = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.phPrinter = talloc_zero(mem_ctx, struct policy_handle); _self->out.phPrinter = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_winspool_AsyncClosePrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(20); } static PyObject *py_winspool_AsyncClosePrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 21) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncClosePrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[20]; 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_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncClosePrinter_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 winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 21) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncClosePrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[20]; 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_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncClosePrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncClosePrinter *object = (struct winspool_AsyncClosePrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 21) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncClosePrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[20]; 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_winspool_AsyncClosePrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncClosePrinter_ndr_print(py_obj, "winspool_AsyncClosePrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncClosePrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncClosePrinter_ndr_print(py_obj, "winspool_AsyncClosePrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncClosePrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncClosePrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncClosePrinter.opnum() -> 20 (0x14) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_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_winspool_AsyncClosePrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncClosePrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncClosePrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncClosePrinter", .tp_getset = py_winspool_AsyncClosePrinter_getsetters, .tp_methods = py_winspool_AsyncClosePrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncClosePrinter_new, }; static bool pack_py_winspool_AsyncClosePrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncClosePrinter *r) { PyObject *py_phPrinter; const char *kwnames[] = { "phPrinter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncClosePrinter", discard_const_p(char *, kwnames), &py_phPrinter)) { return false; } if (py_phPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.phPrinter"); return false; } r->in.phPrinter = talloc_ptrtype(r, r->in.phPrinter); if (r->in.phPrinter == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_phPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_phPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.phPrinter = (struct policy_handle *)pytalloc_get_ptr(py_phPrinter); return true; } static PyObject *unpack_py_winspool_AsyncClosePrinter_args_out(struct winspool_AsyncClosePrinter *r) { PyObject *result; PyObject *py_phPrinter; py_phPrinter = pytalloc_reference_ex(policy_handle_Type, r->out.phPrinter, r->out.phPrinter); result = py_phPrinter; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncAddForm_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncAddForm_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddForm_in_get_pFormInfoContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(obj); PyObject *py_pFormInfoContainer; if (object->in.pFormInfoContainer == NULL) { Py_RETURN_NONE; } py_pFormInfoContainer = pytalloc_reference_ex(spoolss_AddFormInfoCtr_Type, object->in.pFormInfoContainer, object->in.pFormInfoContainer); return py_pFormInfoContainer; } static int py_winspool_AsyncAddForm_in_set_pFormInfoContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pFormInfoContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pFormInfoContainer"); return -1; } object->in.pFormInfoContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pFormInfoContainer); if (object->in.pFormInfoContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_AddFormInfoCtr_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.pFormInfoContainer = (struct spoolss_AddFormInfoCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddForm_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddForm_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)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_winspool_AsyncAddForm_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncAddForm_in_get_hPrinter, .set = py_winspool_AsyncAddForm_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pFormInfoContainer"), .get = py_winspool_AsyncAddForm_in_get_pFormInfoContainer, .set = py_winspool_AsyncAddForm_in_set_pFormInfoContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_AddFormInfoCtr") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddForm_get_result, .set = py_winspool_AsyncAddForm_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddForm_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddForm, type); struct winspool_AsyncAddForm *_self = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pFormInfoContainer = talloc_zero(mem_ctx, struct spoolss_AddFormInfoCtr); return self; } static PyObject *py_winspool_AsyncAddForm_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(21); } static PyObject *py_winspool_AsyncAddForm_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 22) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddForm_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[21]; 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_winspool_AsyncAddForm_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_winspool_AsyncAddForm_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddForm_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_winspool_AsyncAddForm_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddForm_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 winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 22) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddForm_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[21]; 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_winspool_AsyncAddForm_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_winspool_AsyncAddForm_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddForm_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_winspool_AsyncAddForm_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddForm_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddForm *object = (struct winspool_AsyncAddForm *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 22) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddForm_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[21]; 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_winspool_AsyncAddForm_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddForm_ndr_print(py_obj, "winspool_AsyncAddForm_in", NDR_IN); } static PyObject *py_winspool_AsyncAddForm_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddForm_ndr_print(py_obj, "winspool_AsyncAddForm_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddForm_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddForm_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddForm.opnum() -> 21 (0x15) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddForm_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_winspool_AsyncAddForm_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_winspool_AsyncAddForm_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_winspool_AsyncAddForm_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_winspool_AsyncAddForm_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddForm_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddForm_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddForm", .tp_getset = py_winspool_AsyncAddForm_getsetters, .tp_methods = py_winspool_AsyncAddForm_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddForm_new, }; static bool pack_py_winspool_AsyncAddForm_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddForm *r) { PyObject *py_hPrinter; PyObject *py_pFormInfoContainer; const char *kwnames[] = { "hPrinter", "pFormInfoContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncAddForm", discard_const_p(char *, kwnames), &py_hPrinter, &py_pFormInfoContainer)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pFormInfoContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pFormInfoContainer"); return false; } r->in.pFormInfoContainer = talloc_ptrtype(r, r->in.pFormInfoContainer); if (r->in.pFormInfoContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_AddFormInfoCtr_Type, py_pFormInfoContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pFormInfoContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pFormInfoContainer = (struct spoolss_AddFormInfoCtr *)pytalloc_get_ptr(py_pFormInfoContainer); return true; } static PyObject *unpack_py_winspool_AsyncAddForm_args_out(struct winspool_AsyncAddForm *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_winspool_AsyncDeleteForm_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncDeleteForm_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeleteForm_in_get_pFormName(PyObject *obj, void *closure) { struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(obj); PyObject *py_pFormName; if (object->in.pFormName == NULL) { Py_RETURN_NONE; } if (object->in.pFormName == NULL) { py_pFormName = Py_None; Py_INCREF(py_pFormName); } else { py_pFormName = PyUnicode_Decode(object->in.pFormName, strlen(object->in.pFormName), "utf-8", "ignore"); } return py_pFormName; } static int py_winspool_AsyncDeleteForm_in_set_pFormName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pFormName"); return -1; } object->in.pFormName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pFormName); if (object->in.pFormName == 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.pFormName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeleteForm_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeleteForm_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)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_winspool_AsyncDeleteForm_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncDeleteForm_in_get_hPrinter, .set = py_winspool_AsyncDeleteForm_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pFormName"), .get = py_winspool_AsyncDeleteForm_in_get_pFormName, .set = py_winspool_AsyncDeleteForm_in_set_pFormName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeleteForm_get_result, .set = py_winspool_AsyncDeleteForm_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeleteForm_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeleteForm, type); return self; } static PyObject *py_winspool_AsyncDeleteForm_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(22); } static PyObject *py_winspool_AsyncDeleteForm_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 23) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteForm_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[22]; 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_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeleteForm_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 winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 23) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteForm_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[22]; 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_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeleteForm_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeleteForm *object = (struct winspool_AsyncDeleteForm *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 23) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteForm_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[22]; 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_winspool_AsyncDeleteForm_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeleteForm_ndr_print(py_obj, "winspool_AsyncDeleteForm_in", NDR_IN); } static PyObject *py_winspool_AsyncDeleteForm_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeleteForm_ndr_print(py_obj, "winspool_AsyncDeleteForm_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeleteForm_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeleteForm_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeleteForm.opnum() -> 22 (0x16) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_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_winspool_AsyncDeleteForm_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeleteForm_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeleteForm_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeleteForm", .tp_getset = py_winspool_AsyncDeleteForm_getsetters, .tp_methods = py_winspool_AsyncDeleteForm_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeleteForm_new, }; static bool pack_py_winspool_AsyncDeleteForm_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeleteForm *r) { PyObject *py_hPrinter; PyObject *py_pFormName; const char *kwnames[] = { "hPrinter", "pFormName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncDeleteForm", discard_const_p(char *, kwnames), &py_hPrinter, &py_pFormName)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pFormName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pFormName"); return false; } r->in.pFormName = talloc_ptrtype(r, r->in.pFormName); if (r->in.pFormName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pFormName)) { unicode = PyUnicode_AsEncodedString(py_pFormName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pFormName)) { test_str = PyBytes_AS_STRING(py_pFormName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pFormName)->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.pFormName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeleteForm_args_out(struct winspool_AsyncDeleteForm *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_winspool_AsyncGetForm_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncGetForm_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetForm_in_get_pFormName(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_pFormName; if (object->in.pFormName == NULL) { Py_RETURN_NONE; } if (object->in.pFormName == NULL) { py_pFormName = Py_None; Py_INCREF(py_pFormName); } else { py_pFormName = PyUnicode_Decode(object->in.pFormName, strlen(object->in.pFormName), "utf-8", "ignore"); } return py_pFormName; } static int py_winspool_AsyncGetForm_in_set_pFormName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pFormName"); return -1; } object->in.pFormName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pFormName); if (object->in.pFormName == 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.pFormName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetForm_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncGetForm_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetForm_in_get_pForm(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_pForm; if (object->in.pForm == NULL) { Py_RETURN_NONE; } if (object->in.pForm == NULL) { py_pForm = Py_None; Py_INCREF(py_pForm); } else { py_pForm = PyList_New(object->in.cbBuf); if (py_pForm == NULL) { return NULL; } { int pForm_cntr_1; for (pForm_cntr_1 = 0; pForm_cntr_1 < (object->in.cbBuf); pForm_cntr_1++) { PyObject *py_pForm_1; py_pForm_1 = PyLong_FromLong((uint16_t)object->in.pForm[pForm_cntr_1]); PyList_SetItem(py_pForm, pForm_cntr_1, py_pForm_1); } } } return py_pForm; } static int py_winspool_AsyncGetForm_in_set_pForm(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pForm)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pForm"); return -1; } if (value == Py_None) { object->in.pForm = NULL; } else { object->in.pForm = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pForm_cntr_1; object->in.pForm = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pForm, PyList_GET_SIZE(value)); if (!object->in.pForm) { return -1;; } talloc_set_name_const(object->in.pForm, "ARRAY: object->in.pForm"); for (pForm_cntr_1 = 0; pForm_cntr_1 < PyList_GET_SIZE(value); pForm_cntr_1++) { if (PyList_GET_ITEM(value, pForm_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pForm[pForm_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pForm[pForm_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pForm_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pForm_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->in.pForm[pForm_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetForm_out_get_pForm(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_pForm; if (object->out.pForm == NULL) { Py_RETURN_NONE; } if (object->out.pForm == NULL) { py_pForm = Py_None; Py_INCREF(py_pForm); } else { py_pForm = PyList_New(object->in.cbBuf); if (py_pForm == NULL) { return NULL; } { int pForm_cntr_1; for (pForm_cntr_1 = 0; pForm_cntr_1 < (object->in.cbBuf); pForm_cntr_1++) { PyObject *py_pForm_1; py_pForm_1 = PyLong_FromLong((uint16_t)object->out.pForm[pForm_cntr_1]); PyList_SetItem(py_pForm, pForm_cntr_1, py_pForm_1); } } } return py_pForm; } static int py_winspool_AsyncGetForm_out_set_pForm(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pForm)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pForm"); return -1; } if (value == Py_None) { object->out.pForm = NULL; } else { object->out.pForm = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pForm_cntr_1; object->out.pForm = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pForm, PyList_GET_SIZE(value)); if (!object->out.pForm) { return -1;; } talloc_set_name_const(object->out.pForm, "ARRAY: object->out.pForm"); for (pForm_cntr_1 = 0; pForm_cntr_1 < PyList_GET_SIZE(value); pForm_cntr_1++) { if (PyList_GET_ITEM(value, pForm_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pForm[pForm_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pForm[pForm_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pForm_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pForm_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.pForm[pForm_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetForm_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncGetForm_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetForm_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetForm_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetForm_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetForm_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)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_winspool_AsyncGetForm_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncGetForm_in_get_hPrinter, .set = py_winspool_AsyncGetForm_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pFormName"), .get = py_winspool_AsyncGetForm_in_get_pFormName, .set = py_winspool_AsyncGetForm_in_set_pFormName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncGetForm_in_get_Level, .set = py_winspool_AsyncGetForm_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pForm"), .get = py_winspool_AsyncGetForm_in_get_pForm, .set = py_winspool_AsyncGetForm_in_set_pForm, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pForm"), .get = py_winspool_AsyncGetForm_out_get_pForm, .set = py_winspool_AsyncGetForm_out_set_pForm, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncGetForm_in_get_cbBuf, .set = py_winspool_AsyncGetForm_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetForm_out_get_pcbNeeded, .set = py_winspool_AsyncGetForm_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetForm_get_result, .set = py_winspool_AsyncGetForm_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetForm_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetForm, type); struct winspool_AsyncGetForm *_self = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetForm_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(23); } static PyObject *py_winspool_AsyncGetForm_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 24) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetForm_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[23]; 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_winspool_AsyncGetForm_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_winspool_AsyncGetForm_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetForm_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_winspool_AsyncGetForm_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetForm_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 winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 24) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetForm_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[23]; 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_winspool_AsyncGetForm_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_winspool_AsyncGetForm_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetForm_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_winspool_AsyncGetForm_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetForm_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetForm *object = (struct winspool_AsyncGetForm *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 24) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetForm_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[23]; 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_winspool_AsyncGetForm_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetForm_ndr_print(py_obj, "winspool_AsyncGetForm_in", NDR_IN); } static PyObject *py_winspool_AsyncGetForm_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetForm_ndr_print(py_obj, "winspool_AsyncGetForm_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetForm_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetForm_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetForm.opnum() -> 23 (0x17) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetForm_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_winspool_AsyncGetForm_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_winspool_AsyncGetForm_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_winspool_AsyncGetForm_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_winspool_AsyncGetForm_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetForm_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetForm_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetForm", .tp_getset = py_winspool_AsyncGetForm_getsetters, .tp_methods = py_winspool_AsyncGetForm_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetForm_new, }; static bool pack_py_winspool_AsyncGetForm_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetForm *r) { PyObject *py_hPrinter; PyObject *py_pFormName; PyObject *py_Level; PyObject *py_pForm; const char *kwnames[] = { "hPrinter", "pFormName", "Level", "pForm", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncGetForm", discard_const_p(char *, kwnames), &py_hPrinter, &py_pFormName, &py_Level, &py_pForm)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pFormName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pFormName"); return false; } r->in.pFormName = talloc_ptrtype(r, r->in.pFormName); if (r->in.pFormName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pFormName)) { unicode = PyUnicode_AsEncodedString(py_pFormName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pFormName)) { test_str = PyBytes_AS_STRING(py_pFormName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pFormName)->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.pFormName = talloc_str; } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pForm == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pForm"); return false; } if (py_pForm == Py_None) { r->in.pForm = NULL; } else { r->in.pForm = NULL; PY_CHECK_TYPE(&PyList_Type, py_pForm, return false;); { int pForm_cntr_1; r->in.pForm = talloc_array_ptrtype(r, r->in.pForm, PyList_GET_SIZE(py_pForm)); if (!r->in.pForm) { return false;; } talloc_set_name_const(r->in.pForm, "ARRAY: r->in.pForm"); for (pForm_cntr_1 = 0; pForm_cntr_1 < PyList_GET_SIZE(py_pForm); pForm_cntr_1++) { if (PyList_GET_ITEM(py_pForm, pForm_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pForm[pForm_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pForm[pForm_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pForm, pForm_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pForm, pForm_cntr_1)); 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.pForm[pForm_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pForm, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pForm); return true; } static PyObject *unpack_py_winspool_AsyncGetForm_args_out(struct winspool_AsyncGetForm *r) { PyObject *result; PyObject *py_pForm; PyObject *py_pcbNeeded; result = PyTuple_New(2); if (r->out.pForm == NULL) { py_pForm = Py_None; Py_INCREF(py_pForm); } else { py_pForm = PyList_New(r->in.cbBuf); if (py_pForm == NULL) { return NULL; } { int pForm_cntr_1; for (pForm_cntr_1 = 0; pForm_cntr_1 < (r->in.cbBuf); pForm_cntr_1++) { PyObject *py_pForm_1; py_pForm_1 = PyLong_FromLong((uint16_t)r->out.pForm[pForm_cntr_1]); PyList_SetItem(py_pForm, pForm_cntr_1, py_pForm_1); } } } PyTuple_SetItem(result, 0, py_pForm); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncSetForm_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncSetForm_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetForm_in_get_pFormName(PyObject *obj, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(obj); PyObject *py_pFormName; if (object->in.pFormName == NULL) { Py_RETURN_NONE; } if (object->in.pFormName == NULL) { py_pFormName = Py_None; Py_INCREF(py_pFormName); } else { py_pFormName = PyUnicode_Decode(object->in.pFormName, strlen(object->in.pFormName), "utf-8", "ignore"); } return py_pFormName; } static int py_winspool_AsyncSetForm_in_set_pFormName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pFormName"); return -1; } object->in.pFormName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pFormName); if (object->in.pFormName == 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.pFormName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncSetForm_in_get_pFormInfoContainer(PyObject *obj, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(obj); PyObject *py_pFormInfoContainer; if (object->in.pFormInfoContainer == NULL) { Py_RETURN_NONE; } py_pFormInfoContainer = pytalloc_reference_ex(spoolss_AddFormInfoCtr_Type, object->in.pFormInfoContainer, object->in.pFormInfoContainer); return py_pFormInfoContainer; } static int py_winspool_AsyncSetForm_in_set_pFormInfoContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pFormInfoContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pFormInfoContainer"); return -1; } object->in.pFormInfoContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pFormInfoContainer); if (object->in.pFormInfoContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_AddFormInfoCtr_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.pFormInfoContainer = (struct spoolss_AddFormInfoCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetForm_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSetForm_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)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_winspool_AsyncSetForm_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncSetForm_in_get_hPrinter, .set = py_winspool_AsyncSetForm_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pFormName"), .get = py_winspool_AsyncSetForm_in_get_pFormName, .set = py_winspool_AsyncSetForm_in_set_pFormName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pFormInfoContainer"), .get = py_winspool_AsyncSetForm_in_get_pFormInfoContainer, .set = py_winspool_AsyncSetForm_in_set_pFormInfoContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_AddFormInfoCtr") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSetForm_get_result, .set = py_winspool_AsyncSetForm_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSetForm_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSetForm, type); struct winspool_AsyncSetForm *_self = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pFormInfoContainer = talloc_zero(mem_ctx, struct spoolss_AddFormInfoCtr); return self; } static PyObject *py_winspool_AsyncSetForm_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(24); } static PyObject *py_winspool_AsyncSetForm_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 25) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetForm_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[24]; 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_winspool_AsyncSetForm_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_winspool_AsyncSetForm_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSetForm_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_winspool_AsyncSetForm_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSetForm_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 winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 25) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetForm_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[24]; 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_winspool_AsyncSetForm_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_winspool_AsyncSetForm_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetForm_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_winspool_AsyncSetForm_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetForm_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetForm *object = (struct winspool_AsyncSetForm *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 25) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetForm_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[24]; 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_winspool_AsyncSetForm_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetForm_ndr_print(py_obj, "winspool_AsyncSetForm_in", NDR_IN); } static PyObject *py_winspool_AsyncSetForm_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetForm_ndr_print(py_obj, "winspool_AsyncSetForm_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSetForm_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSetForm_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSetForm.opnum() -> 24 (0x18) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSetForm_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_winspool_AsyncSetForm_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_winspool_AsyncSetForm_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_winspool_AsyncSetForm_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_winspool_AsyncSetForm_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSetForm_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSetForm_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSetForm", .tp_getset = py_winspool_AsyncSetForm_getsetters, .tp_methods = py_winspool_AsyncSetForm_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSetForm_new, }; static bool pack_py_winspool_AsyncSetForm_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSetForm *r) { PyObject *py_hPrinter; PyObject *py_pFormName; PyObject *py_pFormInfoContainer; const char *kwnames[] = { "hPrinter", "pFormName", "pFormInfoContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncSetForm", discard_const_p(char *, kwnames), &py_hPrinter, &py_pFormName, &py_pFormInfoContainer)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pFormName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pFormName"); return false; } r->in.pFormName = talloc_ptrtype(r, r->in.pFormName); if (r->in.pFormName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pFormName)) { unicode = PyUnicode_AsEncodedString(py_pFormName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pFormName)) { test_str = PyBytes_AS_STRING(py_pFormName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pFormName)->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.pFormName = talloc_str; } if (py_pFormInfoContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pFormInfoContainer"); return false; } r->in.pFormInfoContainer = talloc_ptrtype(r, r->in.pFormInfoContainer); if (r->in.pFormInfoContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_AddFormInfoCtr_Type, py_pFormInfoContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pFormInfoContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pFormInfoContainer = (struct spoolss_AddFormInfoCtr *)pytalloc_get_ptr(py_pFormInfoContainer); return true; } static PyObject *unpack_py_winspool_AsyncSetForm_args_out(struct winspool_AsyncSetForm *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_winspool_AsyncEnumForms_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEnumForms_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEnumForms_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumForms_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumForms_in_get_pForm(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_pForm; if (object->in.pForm == NULL) { Py_RETURN_NONE; } if (object->in.pForm == NULL) { py_pForm = Py_None; Py_INCREF(py_pForm); } else { py_pForm = PyList_New(object->in.cbBuf); if (py_pForm == NULL) { return NULL; } { int pForm_cntr_1; for (pForm_cntr_1 = 0; pForm_cntr_1 < (object->in.cbBuf); pForm_cntr_1++) { PyObject *py_pForm_1; py_pForm_1 = PyLong_FromLong((uint16_t)object->in.pForm[pForm_cntr_1]); PyList_SetItem(py_pForm, pForm_cntr_1, py_pForm_1); } } } return py_pForm; } static int py_winspool_AsyncEnumForms_in_set_pForm(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pForm)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pForm"); return -1; } if (value == Py_None) { object->in.pForm = NULL; } else { object->in.pForm = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pForm_cntr_1; object->in.pForm = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pForm, PyList_GET_SIZE(value)); if (!object->in.pForm) { return -1;; } talloc_set_name_const(object->in.pForm, "ARRAY: object->in.pForm"); for (pForm_cntr_1 = 0; pForm_cntr_1 < PyList_GET_SIZE(value); pForm_cntr_1++) { if (PyList_GET_ITEM(value, pForm_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pForm[pForm_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pForm[pForm_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pForm_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pForm_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->in.pForm[pForm_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumForms_out_get_pForm(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_pForm; if (object->out.pForm == NULL) { Py_RETURN_NONE; } if (object->out.pForm == NULL) { py_pForm = Py_None; Py_INCREF(py_pForm); } else { py_pForm = PyList_New(object->in.cbBuf); if (py_pForm == NULL) { return NULL; } { int pForm_cntr_1; for (pForm_cntr_1 = 0; pForm_cntr_1 < (object->in.cbBuf); pForm_cntr_1++) { PyObject *py_pForm_1; py_pForm_1 = PyLong_FromLong((uint16_t)object->out.pForm[pForm_cntr_1]); PyList_SetItem(py_pForm, pForm_cntr_1, py_pForm_1); } } } return py_pForm; } static int py_winspool_AsyncEnumForms_out_set_pForm(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pForm)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pForm"); return -1; } if (value == Py_None) { object->out.pForm = NULL; } else { object->out.pForm = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pForm_cntr_1; object->out.pForm = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pForm, PyList_GET_SIZE(value)); if (!object->out.pForm) { return -1;; } talloc_set_name_const(object->out.pForm, "ARRAY: object->out.pForm"); for (pForm_cntr_1 = 0; pForm_cntr_1 < PyList_GET_SIZE(value); pForm_cntr_1++) { if (PyList_GET_ITEM(value, pForm_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pForm[pForm_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pForm[pForm_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pForm_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pForm_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.pForm[pForm_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumForms_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumForms_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumForms_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumForms_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumForms_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumForms_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumForms_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumForms_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)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_winspool_AsyncEnumForms_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEnumForms_in_get_hPrinter, .set = py_winspool_AsyncEnumForms_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumForms_in_get_Level, .set = py_winspool_AsyncEnumForms_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pForm"), .get = py_winspool_AsyncEnumForms_in_get_pForm, .set = py_winspool_AsyncEnumForms_in_set_pForm, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pForm"), .get = py_winspool_AsyncEnumForms_out_get_pForm, .set = py_winspool_AsyncEnumForms_out_set_pForm, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumForms_in_get_cbBuf, .set = py_winspool_AsyncEnumForms_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumForms_out_get_pcbNeeded, .set = py_winspool_AsyncEnumForms_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumForms_out_get_pcReturned, .set = py_winspool_AsyncEnumForms_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumForms_get_result, .set = py_winspool_AsyncEnumForms_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumForms_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumForms, type); struct winspool_AsyncEnumForms *_self = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumForms_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(25); } static PyObject *py_winspool_AsyncEnumForms_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 26) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumForms_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[25]; 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_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumForms_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 winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 26) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumForms_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[25]; 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_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumForms_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumForms *object = (struct winspool_AsyncEnumForms *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 26) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumForms_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[25]; 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_winspool_AsyncEnumForms_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumForms_ndr_print(py_obj, "winspool_AsyncEnumForms_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumForms_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumForms_ndr_print(py_obj, "winspool_AsyncEnumForms_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumForms_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumForms_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumForms.opnum() -> 25 (0x19) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_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_winspool_AsyncEnumForms_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumForms_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumForms_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumForms", .tp_getset = py_winspool_AsyncEnumForms_getsetters, .tp_methods = py_winspool_AsyncEnumForms_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumForms_new, }; static bool pack_py_winspool_AsyncEnumForms_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumForms *r) { PyObject *py_hPrinter; PyObject *py_Level; PyObject *py_pForm; const char *kwnames[] = { "hPrinter", "Level", "pForm", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncEnumForms", discard_const_p(char *, kwnames), &py_hPrinter, &py_Level, &py_pForm)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pForm == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pForm"); return false; } if (py_pForm == Py_None) { r->in.pForm = NULL; } else { r->in.pForm = NULL; PY_CHECK_TYPE(&PyList_Type, py_pForm, return false;); { int pForm_cntr_1; r->in.pForm = talloc_array_ptrtype(r, r->in.pForm, PyList_GET_SIZE(py_pForm)); if (!r->in.pForm) { return false;; } talloc_set_name_const(r->in.pForm, "ARRAY: r->in.pForm"); for (pForm_cntr_1 = 0; pForm_cntr_1 < PyList_GET_SIZE(py_pForm); pForm_cntr_1++) { if (PyList_GET_ITEM(py_pForm, pForm_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pForm[pForm_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pForm[pForm_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pForm, pForm_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pForm, pForm_cntr_1)); 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.pForm[pForm_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pForm, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pForm); return true; } static PyObject *unpack_py_winspool_AsyncEnumForms_args_out(struct winspool_AsyncEnumForms *r) { PyObject *result; PyObject *py_pForm; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pForm == NULL) { py_pForm = Py_None; Py_INCREF(py_pForm); } else { py_pForm = PyList_New(r->in.cbBuf); if (py_pForm == NULL) { return NULL; } { int pForm_cntr_1; for (pForm_cntr_1 = 0; pForm_cntr_1 < (r->in.cbBuf); pForm_cntr_1++) { PyObject *py_pForm_1; py_pForm_1 = PyLong_FromLong((uint16_t)r->out.pForm[pForm_cntr_1]); PyList_SetItem(py_pForm, pForm_cntr_1, py_pForm_1); } } } PyTuple_SetItem(result, 0, py_pForm); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncGetPrinterDriver_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncGetPrinterDriver_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } } return py_pEnvironment; } static int py_winspool_AsyncGetPrinterDriver_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } if (value == Py_None) { object->in.pEnvironment = NULL; } else { object->in.pEnvironment = 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.pEnvironment = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncGetPrinterDriver_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_in_get_pDriver(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pDriver; if (object->in.pDriver == NULL) { Py_RETURN_NONE; } if (object->in.pDriver == NULL) { py_pDriver = Py_None; Py_INCREF(py_pDriver); } else { py_pDriver = PyList_New(object->in.cbBuf); if (py_pDriver == NULL) { return NULL; } { int pDriver_cntr_1; for (pDriver_cntr_1 = 0; pDriver_cntr_1 < (object->in.cbBuf); pDriver_cntr_1++) { PyObject *py_pDriver_1; py_pDriver_1 = PyLong_FromLong((uint16_t)object->in.pDriver[pDriver_cntr_1]); PyList_SetItem(py_pDriver, pDriver_cntr_1, py_pDriver_1); } } } return py_pDriver; } static int py_winspool_AsyncGetPrinterDriver_in_set_pDriver(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDriver)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDriver"); return -1; } if (value == Py_None) { object->in.pDriver = NULL; } else { object->in.pDriver = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDriver_cntr_1; object->in.pDriver = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDriver, PyList_GET_SIZE(value)); if (!object->in.pDriver) { return -1;; } talloc_set_name_const(object->in.pDriver, "ARRAY: object->in.pDriver"); for (pDriver_cntr_1 = 0; pDriver_cntr_1 < PyList_GET_SIZE(value); pDriver_cntr_1++) { if (PyList_GET_ITEM(value, pDriver_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDriver[pDriver_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pDriver[pDriver_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDriver_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDriver_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->in.pDriver[pDriver_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_out_get_pDriver(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pDriver; if (object->out.pDriver == NULL) { Py_RETURN_NONE; } if (object->out.pDriver == NULL) { py_pDriver = Py_None; Py_INCREF(py_pDriver); } else { py_pDriver = PyList_New(object->in.cbBuf); if (py_pDriver == NULL) { return NULL; } { int pDriver_cntr_1; for (pDriver_cntr_1 = 0; pDriver_cntr_1 < (object->in.cbBuf); pDriver_cntr_1++) { PyObject *py_pDriver_1; py_pDriver_1 = PyLong_FromLong((uint16_t)object->out.pDriver[pDriver_cntr_1]); PyList_SetItem(py_pDriver, pDriver_cntr_1, py_pDriver_1); } } } return py_pDriver; } static int py_winspool_AsyncGetPrinterDriver_out_set_pDriver(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pDriver)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDriver"); return -1; } if (value == Py_None) { object->out.pDriver = NULL; } else { object->out.pDriver = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDriver_cntr_1; object->out.pDriver = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pDriver, PyList_GET_SIZE(value)); if (!object->out.pDriver) { return -1;; } talloc_set_name_const(object->out.pDriver, "ARRAY: object->out.pDriver"); for (pDriver_cntr_1 = 0; pDriver_cntr_1 < PyList_GET_SIZE(value); pDriver_cntr_1++) { if (PyList_GET_ITEM(value, pDriver_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDriver[pDriver_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pDriver[pDriver_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDriver_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDriver_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.pDriver[pDriver_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncGetPrinterDriver_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetPrinterDriver_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_in_get_dwClientMajorVersion(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_dwClientMajorVersion; py_dwClientMajorVersion = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwClientMajorVersion); return py_dwClientMajorVersion; } static int py_winspool_AsyncGetPrinterDriver_in_set_dwClientMajorVersion(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwClientMajorVersion"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwClientMajorVersion)); 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.dwClientMajorVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_in_get_dwClientMinorVersion(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_dwClientMinorVersion; py_dwClientMinorVersion = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwClientMinorVersion); return py_dwClientMinorVersion; } static int py_winspool_AsyncGetPrinterDriver_in_set_dwClientMinorVersion(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwClientMinorVersion"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwClientMinorVersion)); 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.dwClientMinorVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_out_get_pdwServerMaxVersion(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pdwServerMaxVersion; if (object->out.pdwServerMaxVersion == NULL) { Py_RETURN_NONE; } py_pdwServerMaxVersion = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pdwServerMaxVersion); return py_pdwServerMaxVersion; } static int py_winspool_AsyncGetPrinterDriver_out_set_pdwServerMaxVersion(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pdwServerMaxVersion)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pdwServerMaxVersion"); return -1; } object->out.pdwServerMaxVersion = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pdwServerMaxVersion); if (object->out.pdwServerMaxVersion == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pdwServerMaxVersion)); 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.pdwServerMaxVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_out_get_pdwServerMinVersion(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pdwServerMinVersion; if (object->out.pdwServerMinVersion == NULL) { Py_RETURN_NONE; } py_pdwServerMinVersion = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pdwServerMinVersion); return py_pdwServerMinVersion; } static int py_winspool_AsyncGetPrinterDriver_out_set_pdwServerMinVersion(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pdwServerMinVersion)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pdwServerMinVersion"); return -1; } object->out.pdwServerMinVersion = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pdwServerMinVersion); if (object->out.pdwServerMinVersion == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pdwServerMinVersion)); 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.pdwServerMinVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriver_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetPrinterDriver_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)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_winspool_AsyncGetPrinterDriver_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncGetPrinterDriver_in_get_hPrinter, .set = py_winspool_AsyncGetPrinterDriver_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncGetPrinterDriver_in_get_pEnvironment, .set = py_winspool_AsyncGetPrinterDriver_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncGetPrinterDriver_in_get_Level, .set = py_winspool_AsyncGetPrinterDriver_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pDriver"), .get = py_winspool_AsyncGetPrinterDriver_in_get_pDriver, .set = py_winspool_AsyncGetPrinterDriver_in_set_pDriver, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pDriver"), .get = py_winspool_AsyncGetPrinterDriver_out_get_pDriver, .set = py_winspool_AsyncGetPrinterDriver_out_set_pDriver, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncGetPrinterDriver_in_get_cbBuf, .set = py_winspool_AsyncGetPrinterDriver_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetPrinterDriver_out_get_pcbNeeded, .set = py_winspool_AsyncGetPrinterDriver_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_dwClientMajorVersion"), .get = py_winspool_AsyncGetPrinterDriver_in_get_dwClientMajorVersion, .set = py_winspool_AsyncGetPrinterDriver_in_set_dwClientMajorVersion, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_dwClientMinorVersion"), .get = py_winspool_AsyncGetPrinterDriver_in_get_dwClientMinorVersion, .set = py_winspool_AsyncGetPrinterDriver_in_set_dwClientMinorVersion, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pdwServerMaxVersion"), .get = py_winspool_AsyncGetPrinterDriver_out_get_pdwServerMaxVersion, .set = py_winspool_AsyncGetPrinterDriver_out_set_pdwServerMaxVersion, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pdwServerMinVersion"), .get = py_winspool_AsyncGetPrinterDriver_out_get_pdwServerMinVersion, .set = py_winspool_AsyncGetPrinterDriver_out_set_pdwServerMinVersion, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetPrinterDriver_get_result, .set = py_winspool_AsyncGetPrinterDriver_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetPrinterDriver_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetPrinterDriver, type); struct winspool_AsyncGetPrinterDriver *_self = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pdwServerMaxVersion = talloc_zero(mem_ctx, uint32_t); _self->out.pdwServerMinVersion = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetPrinterDriver_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(26); } static PyObject *py_winspool_AsyncGetPrinterDriver_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 27) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriver_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[26]; 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_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDriver_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 winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 27) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriver_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[26]; 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_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDriver_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDriver *object = (struct winspool_AsyncGetPrinterDriver *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 27) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriver_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[26]; 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_winspool_AsyncGetPrinterDriver_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDriver_ndr_print(py_obj, "winspool_AsyncGetPrinterDriver_in", NDR_IN); } static PyObject *py_winspool_AsyncGetPrinterDriver_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDriver_ndr_print(py_obj, "winspool_AsyncGetPrinterDriver_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetPrinterDriver_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetPrinterDriver_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetPrinterDriver.opnum() -> 26 (0x1a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_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_winspool_AsyncGetPrinterDriver_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetPrinterDriver_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetPrinterDriver_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetPrinterDriver", .tp_getset = py_winspool_AsyncGetPrinterDriver_getsetters, .tp_methods = py_winspool_AsyncGetPrinterDriver_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetPrinterDriver_new, }; static bool pack_py_winspool_AsyncGetPrinterDriver_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetPrinterDriver *r) { PyObject *py_hPrinter; PyObject *py_pEnvironment; PyObject *py_Level; PyObject *py_pDriver; PyObject *py_dwClientMajorVersion; PyObject *py_dwClientMinorVersion; const char *kwnames[] = { "hPrinter", "pEnvironment", "Level", "pDriver", "dwClientMajorVersion", "dwClientMinorVersion", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOO:winspool_AsyncGetPrinterDriver", discard_const_p(char *, kwnames), &py_hPrinter, &py_pEnvironment, &py_Level, &py_pDriver, &py_dwClientMajorVersion, &py_dwClientMinorVersion)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } if (py_pEnvironment == Py_None) { r->in.pEnvironment = NULL; } else { r->in.pEnvironment = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pDriver == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDriver"); return false; } if (py_pDriver == Py_None) { r->in.pDriver = NULL; } else { r->in.pDriver = NULL; PY_CHECK_TYPE(&PyList_Type, py_pDriver, return false;); { int pDriver_cntr_1; r->in.pDriver = talloc_array_ptrtype(r, r->in.pDriver, PyList_GET_SIZE(py_pDriver)); if (!r->in.pDriver) { return false;; } talloc_set_name_const(r->in.pDriver, "ARRAY: r->in.pDriver"); for (pDriver_cntr_1 = 0; pDriver_cntr_1 < PyList_GET_SIZE(py_pDriver); pDriver_cntr_1++) { if (PyList_GET_ITEM(py_pDriver, pDriver_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDriver[pDriver_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pDriver[pDriver_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pDriver, pDriver_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pDriver, pDriver_cntr_1)); 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.pDriver[pDriver_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pDriver, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pDriver); if (py_dwClientMajorVersion == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwClientMajorVersion"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwClientMajorVersion)); if (PyLong_Check(py_dwClientMajorVersion)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwClientMajorVersion); 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.dwClientMajorVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_dwClientMinorVersion == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwClientMinorVersion"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwClientMinorVersion)); if (PyLong_Check(py_dwClientMinorVersion)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwClientMinorVersion); 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.dwClientMinorVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncGetPrinterDriver_args_out(struct winspool_AsyncGetPrinterDriver *r) { PyObject *result; PyObject *py_pDriver; PyObject *py_pcbNeeded; PyObject *py_pdwServerMaxVersion; PyObject *py_pdwServerMinVersion; result = PyTuple_New(4); if (r->out.pDriver == NULL) { py_pDriver = Py_None; Py_INCREF(py_pDriver); } else { py_pDriver = PyList_New(r->in.cbBuf); if (py_pDriver == NULL) { return NULL; } { int pDriver_cntr_1; for (pDriver_cntr_1 = 0; pDriver_cntr_1 < (r->in.cbBuf); pDriver_cntr_1++) { PyObject *py_pDriver_1; py_pDriver_1 = PyLong_FromLong((uint16_t)r->out.pDriver[pDriver_cntr_1]); PyList_SetItem(py_pDriver, pDriver_cntr_1, py_pDriver_1); } } } PyTuple_SetItem(result, 0, py_pDriver); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pdwServerMaxVersion = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pdwServerMaxVersion); PyTuple_SetItem(result, 2, py_pdwServerMaxVersion); py_pdwServerMinVersion = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pdwServerMinVersion); PyTuple_SetItem(result, 3, py_pdwServerMinVersion); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEnumPrinterData_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEnumPrinterData_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_in_get_dwIndex(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_dwIndex; py_dwIndex = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwIndex); return py_dwIndex; } static int py_winspool_AsyncEnumPrinterData_in_set_dwIndex(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwIndex"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwIndex)); 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.dwIndex = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_out_get_pValueName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pValueName; if (object->out.pValueName == NULL) { Py_RETURN_NONE; } py_pValueName = PyList_New(object->in.cbValueName / 2); if (py_pValueName == NULL) { return NULL; } { int pValueName_cntr_1; for (pValueName_cntr_1 = 0; pValueName_cntr_1 < (object->in.cbValueName / 2); pValueName_cntr_1++) { PyObject *py_pValueName_1; py_pValueName_1 = PyLong_FromLong((uint16_t)object->out.pValueName[pValueName_cntr_1]); PyList_SetItem(py_pValueName, pValueName_cntr_1, py_pValueName_1); } } return py_pValueName; } static int py_winspool_AsyncEnumPrinterData_out_set_pValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pValueName)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pValueName"); return -1; } object->out.pValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pValueName); if (object->out.pValueName == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pValueName_cntr_1; object->out.pValueName = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pValueName, PyList_GET_SIZE(value)); if (!object->out.pValueName) { return -1;; } talloc_set_name_const(object->out.pValueName, "ARRAY: object->out.pValueName"); for (pValueName_cntr_1 = 0; pValueName_cntr_1 < PyList_GET_SIZE(value); pValueName_cntr_1++) { if (PyList_GET_ITEM(value, pValueName_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pValueName[pValueName_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pValueName[pValueName_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pValueName_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pValueName_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.pValueName[pValueName_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_in_get_cbValueName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_cbValueName; py_cbValueName = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbValueName); return py_cbValueName; } static int py_winspool_AsyncEnumPrinterData_in_set_cbValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbValueName"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbValueName)); 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.cbValueName = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_out_get_pcbValueName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pcbValueName; if (object->out.pcbValueName == NULL) { Py_RETURN_NONE; } py_pcbValueName = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbValueName); return py_pcbValueName; } static int py_winspool_AsyncEnumPrinterData_out_set_pcbValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbValueName)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbValueName"); return -1; } object->out.pcbValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbValueName); if (object->out.pcbValueName == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbValueName)); 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.pcbValueName = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_out_get_pType(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pType; if (object->out.pType == NULL) { Py_RETURN_NONE; } py_pType = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pType); return py_pType; } static int py_winspool_AsyncEnumPrinterData_out_set_pType(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pType)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pType"); return -1; } object->out.pType = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pType); if (object->out.pType == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pType)); 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.pType = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_out_get_pData(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pData; if (object->out.pData == NULL) { Py_RETURN_NONE; } py_pData = PyList_New(object->in.cbData); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (object->in.cbData); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)object->out.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } return py_pData; } static int py_winspool_AsyncEnumPrinterData_out_set_pData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pData"); return -1; } object->out.pData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pData); if (object->out.pData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pData_cntr_1; object->out.pData = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pData, PyList_GET_SIZE(value)); if (!object->out.pData) { return -1;; } talloc_set_name_const(object->out.pData, "ARRAY: object->out.pData"); for (pData_cntr_1 = 0; pData_cntr_1 < PyList_GET_SIZE(value); pData_cntr_1++) { if (PyList_GET_ITEM(value, pData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pData[pData_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pData[pData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pData_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.pData[pData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_in_get_cbData(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_cbData; py_cbData = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbData); return py_cbData; } static int py_winspool_AsyncEnumPrinterData_in_set_cbData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbData"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbData)); 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.cbData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_out_get_pcbData(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_pcbData; if (object->out.pcbData == NULL) { Py_RETURN_NONE; } py_pcbData = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbData); return py_pcbData; } static int py_winspool_AsyncEnumPrinterData_out_set_pcbData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbData"); return -1; } object->out.pcbData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbData); if (object->out.pcbData == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbData)); 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.pcbData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterData_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPrinterData_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)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_winspool_AsyncEnumPrinterData_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEnumPrinterData_in_get_hPrinter, .set = py_winspool_AsyncEnumPrinterData_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_dwIndex"), .get = py_winspool_AsyncEnumPrinterData_in_get_dwIndex, .set = py_winspool_AsyncEnumPrinterData_in_set_dwIndex, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pValueName"), .get = py_winspool_AsyncEnumPrinterData_out_get_pValueName, .set = py_winspool_AsyncEnumPrinterData_out_set_pValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_cbValueName"), .get = py_winspool_AsyncEnumPrinterData_in_get_cbValueName, .set = py_winspool_AsyncEnumPrinterData_in_set_cbValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbValueName"), .get = py_winspool_AsyncEnumPrinterData_out_get_pcbValueName, .set = py_winspool_AsyncEnumPrinterData_out_set_pcbValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pType"), .get = py_winspool_AsyncEnumPrinterData_out_get_pType, .set = py_winspool_AsyncEnumPrinterData_out_set_pType, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pData"), .get = py_winspool_AsyncEnumPrinterData_out_get_pData, .set = py_winspool_AsyncEnumPrinterData_out_set_pData, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbData"), .get = py_winspool_AsyncEnumPrinterData_in_get_cbData, .set = py_winspool_AsyncEnumPrinterData_in_set_cbData, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbData"), .get = py_winspool_AsyncEnumPrinterData_out_get_pcbData, .set = py_winspool_AsyncEnumPrinterData_out_set_pcbData, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPrinterData_get_result, .set = py_winspool_AsyncEnumPrinterData_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPrinterData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPrinterData, type); struct winspool_AsyncEnumPrinterData *_self = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pValueName = talloc_zero(mem_ctx, uint16_t); _self->out.pcbValueName = talloc_zero(mem_ctx, uint32_t); _self->out.pType = talloc_zero(mem_ctx, uint32_t); _self->out.pData = talloc_zero(mem_ctx, uint8_t); _self->out.pcbData = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPrinterData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(27); } static PyObject *py_winspool_AsyncEnumPrinterData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 28) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterData_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[27]; 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_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterData_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 winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 28) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterData_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[27]; 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_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterData *object = (struct winspool_AsyncEnumPrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 28) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterData_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[27]; 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_winspool_AsyncEnumPrinterData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterData_ndr_print(py_obj, "winspool_AsyncEnumPrinterData_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPrinterData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterData_ndr_print(py_obj, "winspool_AsyncEnumPrinterData_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPrinterData_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPrinterData_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPrinterData.opnum() -> 27 (0x1b) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_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_winspool_AsyncEnumPrinterData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPrinterData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPrinterData_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPrinterData", .tp_getset = py_winspool_AsyncEnumPrinterData_getsetters, .tp_methods = py_winspool_AsyncEnumPrinterData_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPrinterData_new, }; static bool pack_py_winspool_AsyncEnumPrinterData_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPrinterData *r) { PyObject *py_hPrinter; PyObject *py_dwIndex; PyObject *py_cbValueName; PyObject *py_cbData; const char *kwnames[] = { "hPrinter", "dwIndex", "cbValueName", "cbData", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncEnumPrinterData", discard_const_p(char *, kwnames), &py_hPrinter, &py_dwIndex, &py_cbValueName, &py_cbData)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_dwIndex == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwIndex"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwIndex)); if (PyLong_Check(py_dwIndex)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwIndex); 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.dwIndex = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_cbValueName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cbValueName"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cbValueName)); if (PyLong_Check(py_cbValueName)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cbValueName); 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.cbValueName = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_cbData == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cbData"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cbData)); if (PyLong_Check(py_cbData)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cbData); 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.cbData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncEnumPrinterData_args_out(struct winspool_AsyncEnumPrinterData *r) { PyObject *result; PyObject *py_pValueName; PyObject *py_pcbValueName; PyObject *py_pType; PyObject *py_pData; PyObject *py_pcbData; result = PyTuple_New(5); py_pValueName = PyList_New(r->in.cbValueName / 2); if (py_pValueName == NULL) { return NULL; } { int pValueName_cntr_1; for (pValueName_cntr_1 = 0; pValueName_cntr_1 < (r->in.cbValueName / 2); pValueName_cntr_1++) { PyObject *py_pValueName_1; py_pValueName_1 = PyLong_FromLong((uint16_t)r->out.pValueName[pValueName_cntr_1]); PyList_SetItem(py_pValueName, pValueName_cntr_1, py_pValueName_1); } } PyTuple_SetItem(result, 0, py_pValueName); py_pcbValueName = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbValueName); PyTuple_SetItem(result, 1, py_pcbValueName); py_pType = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pType); PyTuple_SetItem(result, 2, py_pType); py_pData = PyList_New(r->in.cbData); if (py_pData == NULL) { return NULL; } { int pData_cntr_1; for (pData_cntr_1 = 0; pData_cntr_1 < (r->in.cbData); pData_cntr_1++) { PyObject *py_pData_1; py_pData_1 = PyLong_FromLong((uint16_t)r->out.pData[pData_cntr_1]); PyList_SetItem(py_pData, pData_cntr_1, py_pData_1); } } PyTuple_SetItem(result, 3, py_pData); py_pcbData = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbData); PyTuple_SetItem(result, 4, py_pcbData); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEnumPrinterDataEx_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_in_get_pKeyName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pKeyName; if (object->in.pKeyName == NULL) { Py_RETURN_NONE; } if (object->in.pKeyName == NULL) { py_pKeyName = Py_None; Py_INCREF(py_pKeyName); } else { py_pKeyName = PyUnicode_Decode(object->in.pKeyName, strlen(object->in.pKeyName), "utf-8", "ignore"); } return py_pKeyName; } static int py_winspool_AsyncEnumPrinterDataEx_in_set_pKeyName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pKeyName"); return -1; } object->in.pKeyName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pKeyName); if (object->in.pKeyName == 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.pKeyName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_out_get_pEnumValues(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pEnumValues; if (object->out.pEnumValues == NULL) { Py_RETURN_NONE; } py_pEnumValues = PyList_New(object->in.cbEnumValues); if (py_pEnumValues == NULL) { return NULL; } { int pEnumValues_cntr_1; for (pEnumValues_cntr_1 = 0; pEnumValues_cntr_1 < (object->in.cbEnumValues); pEnumValues_cntr_1++) { PyObject *py_pEnumValues_1; py_pEnumValues_1 = PyLong_FromLong((uint16_t)object->out.pEnumValues[pEnumValues_cntr_1]); PyList_SetItem(py_pEnumValues, pEnumValues_cntr_1, py_pEnumValues_1); } } return py_pEnumValues; } static int py_winspool_AsyncEnumPrinterDataEx_out_set_pEnumValues(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pEnumValues)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pEnumValues"); return -1; } object->out.pEnumValues = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pEnumValues); if (object->out.pEnumValues == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pEnumValues_cntr_1; object->out.pEnumValues = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pEnumValues, PyList_GET_SIZE(value)); if (!object->out.pEnumValues) { return -1;; } talloc_set_name_const(object->out.pEnumValues, "ARRAY: object->out.pEnumValues"); for (pEnumValues_cntr_1 = 0; pEnumValues_cntr_1 < PyList_GET_SIZE(value); pEnumValues_cntr_1++) { if (PyList_GET_ITEM(value, pEnumValues_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pEnumValues[pEnumValues_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pEnumValues[pEnumValues_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pEnumValues_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pEnumValues_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.pEnumValues[pEnumValues_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_in_get_cbEnumValues(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_cbEnumValues; py_cbEnumValues = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbEnumValues); return py_cbEnumValues; } static int py_winspool_AsyncEnumPrinterDataEx_in_set_cbEnumValues(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbEnumValues"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbEnumValues)); 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.cbEnumValues = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_out_get_pcbEnumValues(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pcbEnumValues; if (object->out.pcbEnumValues == NULL) { Py_RETURN_NONE; } py_pcbEnumValues = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbEnumValues); return py_pcbEnumValues; } static int py_winspool_AsyncEnumPrinterDataEx_out_set_pcbEnumValues(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbEnumValues)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbEnumValues"); return -1; } object->out.pcbEnumValues = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbEnumValues); if (object->out.pcbEnumValues == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbEnumValues)); 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.pcbEnumValues = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_out_get_pnEnumValues(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pnEnumValues; if (object->out.pnEnumValues == NULL) { Py_RETURN_NONE; } py_pnEnumValues = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pnEnumValues); return py_pnEnumValues; } static int py_winspool_AsyncEnumPrinterDataEx_out_set_pnEnumValues(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pnEnumValues)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pnEnumValues"); return -1; } object->out.pnEnumValues = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pnEnumValues); if (object->out.pnEnumValues == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pnEnumValues)); 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.pnEnumValues = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPrinterDataEx_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)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_winspool_AsyncEnumPrinterDataEx_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEnumPrinterDataEx_in_get_hPrinter, .set = py_winspool_AsyncEnumPrinterDataEx_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pKeyName"), .get = py_winspool_AsyncEnumPrinterDataEx_in_get_pKeyName, .set = py_winspool_AsyncEnumPrinterDataEx_in_set_pKeyName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pEnumValues"), .get = py_winspool_AsyncEnumPrinterDataEx_out_get_pEnumValues, .set = py_winspool_AsyncEnumPrinterDataEx_out_set_pEnumValues, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbEnumValues"), .get = py_winspool_AsyncEnumPrinterDataEx_in_get_cbEnumValues, .set = py_winspool_AsyncEnumPrinterDataEx_in_set_cbEnumValues, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbEnumValues"), .get = py_winspool_AsyncEnumPrinterDataEx_out_get_pcbEnumValues, .set = py_winspool_AsyncEnumPrinterDataEx_out_set_pcbEnumValues, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pnEnumValues"), .get = py_winspool_AsyncEnumPrinterDataEx_out_get_pnEnumValues, .set = py_winspool_AsyncEnumPrinterDataEx_out_set_pnEnumValues, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPrinterDataEx_get_result, .set = py_winspool_AsyncEnumPrinterDataEx_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPrinterDataEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPrinterDataEx, type); struct winspool_AsyncEnumPrinterDataEx *_self = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pEnumValues = talloc_zero(mem_ctx, uint8_t); _self->out.pcbEnumValues = talloc_zero(mem_ctx, uint32_t); _self->out.pnEnumValues = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPrinterDataEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(28); } static PyObject *py_winspool_AsyncEnumPrinterDataEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 29) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterDataEx_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[28]; 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_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterDataEx_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 winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 29) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterDataEx_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[28]; 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_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterDataEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterDataEx *object = (struct winspool_AsyncEnumPrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 29) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterDataEx_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[28]; 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_winspool_AsyncEnumPrinterDataEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterDataEx_ndr_print(py_obj, "winspool_AsyncEnumPrinterDataEx_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPrinterDataEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterDataEx_ndr_print(py_obj, "winspool_AsyncEnumPrinterDataEx_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPrinterDataEx_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPrinterDataEx_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPrinterDataEx.opnum() -> 28 (0x1c) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_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_winspool_AsyncEnumPrinterDataEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPrinterDataEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPrinterDataEx_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPrinterDataEx", .tp_getset = py_winspool_AsyncEnumPrinterDataEx_getsetters, .tp_methods = py_winspool_AsyncEnumPrinterDataEx_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPrinterDataEx_new, }; static bool pack_py_winspool_AsyncEnumPrinterDataEx_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPrinterDataEx *r) { PyObject *py_hPrinter; PyObject *py_pKeyName; PyObject *py_cbEnumValues; const char *kwnames[] = { "hPrinter", "pKeyName", "cbEnumValues", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncEnumPrinterDataEx", discard_const_p(char *, kwnames), &py_hPrinter, &py_pKeyName, &py_cbEnumValues)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pKeyName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pKeyName"); return false; } r->in.pKeyName = talloc_ptrtype(r, r->in.pKeyName); if (r->in.pKeyName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pKeyName)) { unicode = PyUnicode_AsEncodedString(py_pKeyName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pKeyName)) { test_str = PyBytes_AS_STRING(py_pKeyName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pKeyName)->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.pKeyName = talloc_str; } if (py_cbEnumValues == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cbEnumValues"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cbEnumValues)); if (PyLong_Check(py_cbEnumValues)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cbEnumValues); 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.cbEnumValues = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncEnumPrinterDataEx_args_out(struct winspool_AsyncEnumPrinterDataEx *r) { PyObject *result; PyObject *py_pEnumValues; PyObject *py_pcbEnumValues; PyObject *py_pnEnumValues; result = PyTuple_New(3); py_pEnumValues = PyList_New(r->in.cbEnumValues); if (py_pEnumValues == NULL) { return NULL; } { int pEnumValues_cntr_1; for (pEnumValues_cntr_1 = 0; pEnumValues_cntr_1 < (r->in.cbEnumValues); pEnumValues_cntr_1++) { PyObject *py_pEnumValues_1; py_pEnumValues_1 = PyLong_FromLong((uint16_t)r->out.pEnumValues[pEnumValues_cntr_1]); PyList_SetItem(py_pEnumValues, pEnumValues_cntr_1, py_pEnumValues_1); } } PyTuple_SetItem(result, 0, py_pEnumValues); py_pcbEnumValues = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbEnumValues); PyTuple_SetItem(result, 1, py_pcbEnumValues); py_pnEnumValues = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pnEnumValues); PyTuple_SetItem(result, 2, py_pnEnumValues); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEnumPrinterKey_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEnumPrinterKey_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEnumPrinterKey_in_get_pKeyName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(obj); PyObject *py_pKeyName; if (object->in.pKeyName == NULL) { Py_RETURN_NONE; } if (object->in.pKeyName == NULL) { py_pKeyName = Py_None; Py_INCREF(py_pKeyName); } else { py_pKeyName = PyUnicode_Decode(object->in.pKeyName, strlen(object->in.pKeyName), "utf-8", "ignore"); } return py_pKeyName; } static int py_winspool_AsyncEnumPrinterKey_in_set_pKeyName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pKeyName"); return -1; } object->in.pKeyName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pKeyName); if (object->in.pKeyName == 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.pKeyName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncEnumPrinterKey_out_get_pSubkey(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(obj); PyObject *py_pSubkey; if (object->out.pSubkey == NULL) { Py_RETURN_NONE; } py_pSubkey = PyList_New(object->in.cbSubkey / 2); if (py_pSubkey == NULL) { return NULL; } { int pSubkey_cntr_1; for (pSubkey_cntr_1 = 0; pSubkey_cntr_1 < (object->in.cbSubkey / 2); pSubkey_cntr_1++) { PyObject *py_pSubkey_1; py_pSubkey_1 = PyLong_FromLong((uint16_t)object->out.pSubkey[pSubkey_cntr_1]); PyList_SetItem(py_pSubkey, pSubkey_cntr_1, py_pSubkey_1); } } return py_pSubkey; } static int py_winspool_AsyncEnumPrinterKey_out_set_pSubkey(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pSubkey)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pSubkey"); return -1; } object->out.pSubkey = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pSubkey); if (object->out.pSubkey == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pSubkey_cntr_1; object->out.pSubkey = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pSubkey, PyList_GET_SIZE(value)); if (!object->out.pSubkey) { return -1;; } talloc_set_name_const(object->out.pSubkey, "ARRAY: object->out.pSubkey"); for (pSubkey_cntr_1 = 0; pSubkey_cntr_1 < PyList_GET_SIZE(value); pSubkey_cntr_1++) { if (PyList_GET_ITEM(value, pSubkey_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pSubkey[pSubkey_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pSubkey[pSubkey_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pSubkey_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pSubkey_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.pSubkey[pSubkey_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterKey_in_get_cbSubkey(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(obj); PyObject *py_cbSubkey; py_cbSubkey = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbSubkey); return py_cbSubkey; } static int py_winspool_AsyncEnumPrinterKey_in_set_cbSubkey(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbSubkey"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbSubkey)); 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.cbSubkey = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterKey_out_get_pcbSubkey(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(obj); PyObject *py_pcbSubkey; if (object->out.pcbSubkey == NULL) { Py_RETURN_NONE; } py_pcbSubkey = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbSubkey); return py_pcbSubkey; } static int py_winspool_AsyncEnumPrinterKey_out_set_pcbSubkey(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbSubkey)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbSubkey"); return -1; } object->out.pcbSubkey = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbSubkey); if (object->out.pcbSubkey == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbSubkey)); 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.pcbSubkey = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterKey_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPrinterKey_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)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_winspool_AsyncEnumPrinterKey_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEnumPrinterKey_in_get_hPrinter, .set = py_winspool_AsyncEnumPrinterKey_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pKeyName"), .get = py_winspool_AsyncEnumPrinterKey_in_get_pKeyName, .set = py_winspool_AsyncEnumPrinterKey_in_set_pKeyName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pSubkey"), .get = py_winspool_AsyncEnumPrinterKey_out_get_pSubkey, .set = py_winspool_AsyncEnumPrinterKey_out_set_pSubkey, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_cbSubkey"), .get = py_winspool_AsyncEnumPrinterKey_in_get_cbSubkey, .set = py_winspool_AsyncEnumPrinterKey_in_set_cbSubkey, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbSubkey"), .get = py_winspool_AsyncEnumPrinterKey_out_get_pcbSubkey, .set = py_winspool_AsyncEnumPrinterKey_out_set_pcbSubkey, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPrinterKey_get_result, .set = py_winspool_AsyncEnumPrinterKey_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPrinterKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPrinterKey, type); struct winspool_AsyncEnumPrinterKey *_self = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pSubkey = talloc_zero(mem_ctx, uint16_t); _self->out.pcbSubkey = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPrinterKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(29); } static PyObject *py_winspool_AsyncEnumPrinterKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 30) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterKey_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[29]; 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_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterKey_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 winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 30) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterKey_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[29]; 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_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterKey *object = (struct winspool_AsyncEnumPrinterKey *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 30) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterKey_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[29]; 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_winspool_AsyncEnumPrinterKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterKey_ndr_print(py_obj, "winspool_AsyncEnumPrinterKey_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPrinterKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterKey_ndr_print(py_obj, "winspool_AsyncEnumPrinterKey_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPrinterKey_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPrinterKey_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPrinterKey.opnum() -> 29 (0x1d) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_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_winspool_AsyncEnumPrinterKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPrinterKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPrinterKey_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPrinterKey", .tp_getset = py_winspool_AsyncEnumPrinterKey_getsetters, .tp_methods = py_winspool_AsyncEnumPrinterKey_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPrinterKey_new, }; static bool pack_py_winspool_AsyncEnumPrinterKey_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPrinterKey *r) { PyObject *py_hPrinter; PyObject *py_pKeyName; PyObject *py_cbSubkey; const char *kwnames[] = { "hPrinter", "pKeyName", "cbSubkey", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncEnumPrinterKey", discard_const_p(char *, kwnames), &py_hPrinter, &py_pKeyName, &py_cbSubkey)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pKeyName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pKeyName"); return false; } r->in.pKeyName = talloc_ptrtype(r, r->in.pKeyName); if (r->in.pKeyName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pKeyName)) { unicode = PyUnicode_AsEncodedString(py_pKeyName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pKeyName)) { test_str = PyBytes_AS_STRING(py_pKeyName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pKeyName)->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.pKeyName = talloc_str; } if (py_cbSubkey == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cbSubkey"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cbSubkey)); if (PyLong_Check(py_cbSubkey)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cbSubkey); 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.cbSubkey = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncEnumPrinterKey_args_out(struct winspool_AsyncEnumPrinterKey *r) { PyObject *result; PyObject *py_pSubkey; PyObject *py_pcbSubkey; result = PyTuple_New(2); py_pSubkey = PyList_New(r->in.cbSubkey / 2); if (py_pSubkey == NULL) { return NULL; } { int pSubkey_cntr_1; for (pSubkey_cntr_1 = 0; pSubkey_cntr_1 < (r->in.cbSubkey / 2); pSubkey_cntr_1++) { PyObject *py_pSubkey_1; py_pSubkey_1 = PyLong_FromLong((uint16_t)r->out.pSubkey[pSubkey_cntr_1]); PyList_SetItem(py_pSubkey, pSubkey_cntr_1, py_pSubkey_1); } } PyTuple_SetItem(result, 0, py_pSubkey); py_pcbSubkey = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbSubkey); PyTuple_SetItem(result, 1, py_pcbSubkey); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncDeletePrinterData_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncDeletePrinterData_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeletePrinterData_in_get_pValueName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(obj); PyObject *py_pValueName; if (object->in.pValueName == NULL) { Py_RETURN_NONE; } if (object->in.pValueName == NULL) { py_pValueName = Py_None; Py_INCREF(py_pValueName); } else { py_pValueName = PyUnicode_Decode(object->in.pValueName, strlen(object->in.pValueName), "utf-8", "ignore"); } return py_pValueName; } static int py_winspool_AsyncDeletePrinterData_in_set_pValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pValueName"); return -1; } object->in.pValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pValueName); if (object->in.pValueName == 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.pValueName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterData_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinterData_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)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_winspool_AsyncDeletePrinterData_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncDeletePrinterData_in_get_hPrinter, .set = py_winspool_AsyncDeletePrinterData_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pValueName"), .get = py_winspool_AsyncDeletePrinterData_in_get_pValueName, .set = py_winspool_AsyncDeletePrinterData_in_set_pValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinterData_get_result, .set = py_winspool_AsyncDeletePrinterData_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinterData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinterData, type); return self; } static PyObject *py_winspool_AsyncDeletePrinterData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(30); } static PyObject *py_winspool_AsyncDeletePrinterData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 31) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterData_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[30]; 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_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterData_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 winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 31) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterData_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[30]; 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_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterData *object = (struct winspool_AsyncDeletePrinterData *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 31) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterData_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[30]; 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_winspool_AsyncDeletePrinterData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterData_ndr_print(py_obj, "winspool_AsyncDeletePrinterData_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinterData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterData_ndr_print(py_obj, "winspool_AsyncDeletePrinterData_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinterData_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinterData_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinterData.opnum() -> 30 (0x1e) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_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_winspool_AsyncDeletePrinterData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinterData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinterData_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinterData", .tp_getset = py_winspool_AsyncDeletePrinterData_getsetters, .tp_methods = py_winspool_AsyncDeletePrinterData_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinterData_new, }; static bool pack_py_winspool_AsyncDeletePrinterData_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinterData *r) { PyObject *py_hPrinter; PyObject *py_pValueName; const char *kwnames[] = { "hPrinter", "pValueName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncDeletePrinterData", discard_const_p(char *, kwnames), &py_hPrinter, &py_pValueName)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pValueName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pValueName"); return false; } r->in.pValueName = talloc_ptrtype(r, r->in.pValueName); if (r->in.pValueName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pValueName)) { unicode = PyUnicode_AsEncodedString(py_pValueName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pValueName)) { test_str = PyBytes_AS_STRING(py_pValueName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pValueName)->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.pValueName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinterData_args_out(struct winspool_AsyncDeletePrinterData *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_winspool_AsyncDeletePrinterDataEx_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncDeletePrinterDataEx_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeletePrinterDataEx_in_get_pKeyName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pKeyName; if (object->in.pKeyName == NULL) { Py_RETURN_NONE; } if (object->in.pKeyName == NULL) { py_pKeyName = Py_None; Py_INCREF(py_pKeyName); } else { py_pKeyName = PyUnicode_Decode(object->in.pKeyName, strlen(object->in.pKeyName), "utf-8", "ignore"); } return py_pKeyName; } static int py_winspool_AsyncDeletePrinterDataEx_in_set_pKeyName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pKeyName"); return -1; } object->in.pKeyName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pKeyName); if (object->in.pKeyName == 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.pKeyName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDataEx_in_get_pValueName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_pValueName; if (object->in.pValueName == NULL) { Py_RETURN_NONE; } if (object->in.pValueName == NULL) { py_pValueName = Py_None; Py_INCREF(py_pValueName); } else { py_pValueName = PyUnicode_Decode(object->in.pValueName, strlen(object->in.pValueName), "utf-8", "ignore"); } return py_pValueName; } static int py_winspool_AsyncDeletePrinterDataEx_in_set_pValueName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pValueName"); return -1; } object->in.pValueName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pValueName); if (object->in.pValueName == 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.pValueName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDataEx_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinterDataEx_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)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_winspool_AsyncDeletePrinterDataEx_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncDeletePrinterDataEx_in_get_hPrinter, .set = py_winspool_AsyncDeletePrinterDataEx_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pKeyName"), .get = py_winspool_AsyncDeletePrinterDataEx_in_get_pKeyName, .set = py_winspool_AsyncDeletePrinterDataEx_in_set_pKeyName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pValueName"), .get = py_winspool_AsyncDeletePrinterDataEx_in_get_pValueName, .set = py_winspool_AsyncDeletePrinterDataEx_in_set_pValueName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinterDataEx_get_result, .set = py_winspool_AsyncDeletePrinterDataEx_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinterDataEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinterDataEx, type); return self; } static PyObject *py_winspool_AsyncDeletePrinterDataEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(31); } static PyObject *py_winspool_AsyncDeletePrinterDataEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 32) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDataEx_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[31]; 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_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDataEx_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 winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 32) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDataEx_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[31]; 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_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDataEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDataEx *object = (struct winspool_AsyncDeletePrinterDataEx *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 32) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDataEx_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[31]; 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_winspool_AsyncDeletePrinterDataEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDataEx_ndr_print(py_obj, "winspool_AsyncDeletePrinterDataEx_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinterDataEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDataEx_ndr_print(py_obj, "winspool_AsyncDeletePrinterDataEx_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinterDataEx_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinterDataEx_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinterDataEx.opnum() -> 31 (0x1f) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_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_winspool_AsyncDeletePrinterDataEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinterDataEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinterDataEx_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinterDataEx", .tp_getset = py_winspool_AsyncDeletePrinterDataEx_getsetters, .tp_methods = py_winspool_AsyncDeletePrinterDataEx_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinterDataEx_new, }; static bool pack_py_winspool_AsyncDeletePrinterDataEx_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinterDataEx *r) { PyObject *py_hPrinter; PyObject *py_pKeyName; PyObject *py_pValueName; const char *kwnames[] = { "hPrinter", "pKeyName", "pValueName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncDeletePrinterDataEx", discard_const_p(char *, kwnames), &py_hPrinter, &py_pKeyName, &py_pValueName)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pKeyName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pKeyName"); return false; } r->in.pKeyName = talloc_ptrtype(r, r->in.pKeyName); if (r->in.pKeyName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pKeyName)) { unicode = PyUnicode_AsEncodedString(py_pKeyName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pKeyName)) { test_str = PyBytes_AS_STRING(py_pKeyName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pKeyName)->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.pKeyName = talloc_str; } if (py_pValueName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pValueName"); return false; } r->in.pValueName = talloc_ptrtype(r, r->in.pValueName); if (r->in.pValueName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pValueName)) { unicode = PyUnicode_AsEncodedString(py_pValueName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pValueName)) { test_str = PyBytes_AS_STRING(py_pValueName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pValueName)->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.pValueName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinterDataEx_args_out(struct winspool_AsyncDeletePrinterDataEx *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_winspool_AsyncDeletePrinterKey_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncDeletePrinterKey_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeletePrinterKey_in_get_pKeyName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(obj); PyObject *py_pKeyName; if (object->in.pKeyName == NULL) { Py_RETURN_NONE; } if (object->in.pKeyName == NULL) { py_pKeyName = Py_None; Py_INCREF(py_pKeyName); } else { py_pKeyName = PyUnicode_Decode(object->in.pKeyName, strlen(object->in.pKeyName), "utf-8", "ignore"); } return py_pKeyName; } static int py_winspool_AsyncDeletePrinterKey_in_set_pKeyName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pKeyName"); return -1; } object->in.pKeyName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pKeyName); if (object->in.pKeyName == 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.pKeyName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterKey_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinterKey_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)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_winspool_AsyncDeletePrinterKey_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncDeletePrinterKey_in_get_hPrinter, .set = py_winspool_AsyncDeletePrinterKey_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pKeyName"), .get = py_winspool_AsyncDeletePrinterKey_in_get_pKeyName, .set = py_winspool_AsyncDeletePrinterKey_in_set_pKeyName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinterKey_get_result, .set = py_winspool_AsyncDeletePrinterKey_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinterKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinterKey, type); return self; } static PyObject *py_winspool_AsyncDeletePrinterKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(32); } static PyObject *py_winspool_AsyncDeletePrinterKey_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 33) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterKey_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[32]; 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_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterKey_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 winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 33) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterKey_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[32]; 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_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterKey_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterKey *object = (struct winspool_AsyncDeletePrinterKey *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 33) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterKey_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[32]; 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_winspool_AsyncDeletePrinterKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterKey_ndr_print(py_obj, "winspool_AsyncDeletePrinterKey_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinterKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterKey_ndr_print(py_obj, "winspool_AsyncDeletePrinterKey_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinterKey_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinterKey_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinterKey.opnum() -> 32 (0x20) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_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_winspool_AsyncDeletePrinterKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinterKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinterKey_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinterKey", .tp_getset = py_winspool_AsyncDeletePrinterKey_getsetters, .tp_methods = py_winspool_AsyncDeletePrinterKey_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinterKey_new, }; static bool pack_py_winspool_AsyncDeletePrinterKey_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinterKey *r) { PyObject *py_hPrinter; PyObject *py_pKeyName; const char *kwnames[] = { "hPrinter", "pKeyName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncDeletePrinterKey", discard_const_p(char *, kwnames), &py_hPrinter, &py_pKeyName)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pKeyName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pKeyName"); return false; } r->in.pKeyName = talloc_ptrtype(r, r->in.pKeyName); if (r->in.pKeyName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pKeyName)) { unicode = PyUnicode_AsEncodedString(py_pKeyName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pKeyName)) { test_str = PyBytes_AS_STRING(py_pKeyName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pKeyName)->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.pKeyName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinterKey_args_out(struct winspool_AsyncDeletePrinterKey *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_winspool_AsyncXcvData_in_get_hXcv(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_hXcv; py_hXcv = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hXcv); return py_hXcv; } static int py_winspool_AsyncXcvData_in_set_hXcv(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hXcv"); return -1; } PY_CHECK_TYPE(policy_handle_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.hXcv = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncXcvData_in_get_pszDataName(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_pszDataName; if (object->in.pszDataName == NULL) { Py_RETURN_NONE; } if (object->in.pszDataName == NULL) { py_pszDataName = Py_None; Py_INCREF(py_pszDataName); } else { py_pszDataName = PyUnicode_Decode(object->in.pszDataName, strlen(object->in.pszDataName), "utf-8", "ignore"); } return py_pszDataName; } static int py_winspool_AsyncXcvData_in_set_pszDataName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszDataName"); return -1; } object->in.pszDataName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszDataName); if (object->in.pszDataName == 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.pszDataName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncXcvData_in_get_pInputData(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_pInputData; if (object->in.pInputData == NULL) { Py_RETURN_NONE; } py_pInputData = PyList_New(object->in.cbInputData); if (py_pInputData == NULL) { return NULL; } { int pInputData_cntr_1; for (pInputData_cntr_1 = 0; pInputData_cntr_1 < (object->in.cbInputData); pInputData_cntr_1++) { PyObject *py_pInputData_1; py_pInputData_1 = PyLong_FromLong((uint16_t)object->in.pInputData[pInputData_cntr_1]); PyList_SetItem(py_pInputData, pInputData_cntr_1, py_pInputData_1); } } return py_pInputData; } static int py_winspool_AsyncXcvData_in_set_pInputData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pInputData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pInputData"); return -1; } object->in.pInputData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pInputData); if (object->in.pInputData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pInputData_cntr_1; object->in.pInputData = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pInputData, PyList_GET_SIZE(value)); if (!object->in.pInputData) { return -1;; } talloc_set_name_const(object->in.pInputData, "ARRAY: object->in.pInputData"); for (pInputData_cntr_1 = 0; pInputData_cntr_1 < PyList_GET_SIZE(value); pInputData_cntr_1++) { if (PyList_GET_ITEM(value, pInputData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pInputData[pInputData_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pInputData[pInputData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pInputData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pInputData_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->in.pInputData[pInputData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncXcvData_in_get_cbInputData(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_cbInputData; py_cbInputData = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbInputData); return py_cbInputData; } static int py_winspool_AsyncXcvData_in_set_cbInputData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbInputData"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbInputData)); 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.cbInputData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncXcvData_out_get_pOutputData(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_pOutputData; if (object->out.pOutputData == NULL) { Py_RETURN_NONE; } py_pOutputData = PyList_New(object->in.cbOutputData); if (py_pOutputData == NULL) { return NULL; } { int pOutputData_cntr_1; for (pOutputData_cntr_1 = 0; pOutputData_cntr_1 < (object->in.cbOutputData); pOutputData_cntr_1++) { PyObject *py_pOutputData_1; py_pOutputData_1 = PyLong_FromLong((uint16_t)object->out.pOutputData[pOutputData_cntr_1]); PyList_SetItem(py_pOutputData, pOutputData_cntr_1, py_pOutputData_1); } } return py_pOutputData; } static int py_winspool_AsyncXcvData_out_set_pOutputData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pOutputData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pOutputData"); return -1; } object->out.pOutputData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pOutputData); if (object->out.pOutputData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pOutputData_cntr_1; object->out.pOutputData = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pOutputData, PyList_GET_SIZE(value)); if (!object->out.pOutputData) { return -1;; } talloc_set_name_const(object->out.pOutputData, "ARRAY: object->out.pOutputData"); for (pOutputData_cntr_1 = 0; pOutputData_cntr_1 < PyList_GET_SIZE(value); pOutputData_cntr_1++) { if (PyList_GET_ITEM(value, pOutputData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pOutputData[pOutputData_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pOutputData[pOutputData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pOutputData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pOutputData_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.pOutputData[pOutputData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncXcvData_in_get_cbOutputData(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_cbOutputData; py_cbOutputData = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbOutputData); return py_cbOutputData; } static int py_winspool_AsyncXcvData_in_set_cbOutputData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbOutputData"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbOutputData)); 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.cbOutputData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncXcvData_out_get_pcbOutputNeeded(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_pcbOutputNeeded; if (object->out.pcbOutputNeeded == NULL) { Py_RETURN_NONE; } py_pcbOutputNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbOutputNeeded); return py_pcbOutputNeeded; } static int py_winspool_AsyncXcvData_out_set_pcbOutputNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbOutputNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbOutputNeeded"); return -1; } object->out.pcbOutputNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbOutputNeeded); if (object->out.pcbOutputNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbOutputNeeded)); 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.pcbOutputNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncXcvData_in_get_pdwStatus(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_pdwStatus; if (object->in.pdwStatus == NULL) { Py_RETURN_NONE; } py_pdwStatus = PyLong_FromUnsignedLongLong((uint32_t)*object->in.pdwStatus); return py_pdwStatus; } static int py_winspool_AsyncXcvData_in_set_pdwStatus(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pdwStatus)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pdwStatus"); return -1; } object->in.pdwStatus = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pdwStatus); if (object->in.pdwStatus == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.pdwStatus)); 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.pdwStatus = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncXcvData_out_get_pdwStatus(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_pdwStatus; if (object->out.pdwStatus == NULL) { Py_RETURN_NONE; } py_pdwStatus = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pdwStatus); return py_pdwStatus; } static int py_winspool_AsyncXcvData_out_set_pdwStatus(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pdwStatus)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pdwStatus"); return -1; } object->out.pdwStatus = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pdwStatus); if (object->out.pdwStatus == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pdwStatus)); 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.pdwStatus = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncXcvData_get_result(PyObject *obj, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncXcvData_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)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_winspool_AsyncXcvData_getsetters[] = { { .name = discard_const_p(char, "in_hXcv"), .get = py_winspool_AsyncXcvData_in_get_hXcv, .set = py_winspool_AsyncXcvData_in_set_hXcv, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pszDataName"), .get = py_winspool_AsyncXcvData_in_get_pszDataName, .set = py_winspool_AsyncXcvData_in_set_pszDataName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pInputData"), .get = py_winspool_AsyncXcvData_in_get_pInputData, .set = py_winspool_AsyncXcvData_in_set_pInputData, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbInputData"), .get = py_winspool_AsyncXcvData_in_get_cbInputData, .set = py_winspool_AsyncXcvData_in_set_cbInputData, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pOutputData"), .get = py_winspool_AsyncXcvData_out_get_pOutputData, .set = py_winspool_AsyncXcvData_out_set_pOutputData, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbOutputData"), .get = py_winspool_AsyncXcvData_in_get_cbOutputData, .set = py_winspool_AsyncXcvData_in_set_cbOutputData, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbOutputNeeded"), .get = py_winspool_AsyncXcvData_out_get_pcbOutputNeeded, .set = py_winspool_AsyncXcvData_out_set_pcbOutputNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pdwStatus"), .get = py_winspool_AsyncXcvData_in_get_pdwStatus, .set = py_winspool_AsyncXcvData_in_set_pdwStatus, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pdwStatus"), .get = py_winspool_AsyncXcvData_out_get_pdwStatus, .set = py_winspool_AsyncXcvData_out_set_pdwStatus, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncXcvData_get_result, .set = py_winspool_AsyncXcvData_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncXcvData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncXcvData, type); struct winspool_AsyncXcvData *_self = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pInputData = talloc_zero(mem_ctx, uint8_t); _self->out.pOutputData = talloc_zero(mem_ctx, uint8_t); _self->out.pcbOutputNeeded = talloc_zero(mem_ctx, uint32_t); _self->in.pdwStatus = talloc_zero(mem_ctx, uint32_t); _self->out.pdwStatus = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncXcvData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(33); } static PyObject *py_winspool_AsyncXcvData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 34) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncXcvData_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[33]; 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_winspool_AsyncXcvData_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_winspool_AsyncXcvData_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncXcvData_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_winspool_AsyncXcvData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncXcvData_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 winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 34) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncXcvData_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[33]; 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_winspool_AsyncXcvData_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_winspool_AsyncXcvData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncXcvData_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_winspool_AsyncXcvData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncXcvData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncXcvData *object = (struct winspool_AsyncXcvData *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 34) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncXcvData_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[33]; 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_winspool_AsyncXcvData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncXcvData_ndr_print(py_obj, "winspool_AsyncXcvData_in", NDR_IN); } static PyObject *py_winspool_AsyncXcvData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncXcvData_ndr_print(py_obj, "winspool_AsyncXcvData_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncXcvData_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncXcvData_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncXcvData.opnum() -> 33 (0x21) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncXcvData_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_winspool_AsyncXcvData_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_winspool_AsyncXcvData_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_winspool_AsyncXcvData_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_winspool_AsyncXcvData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncXcvData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncXcvData_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncXcvData", .tp_getset = py_winspool_AsyncXcvData_getsetters, .tp_methods = py_winspool_AsyncXcvData_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncXcvData_new, }; static bool pack_py_winspool_AsyncXcvData_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncXcvData *r) { PyObject *py_hXcv; PyObject *py_pszDataName; PyObject *py_pInputData; PyObject *py_cbOutputData; PyObject *py_pdwStatus; const char *kwnames[] = { "hXcv", "pszDataName", "pInputData", "cbOutputData", "pdwStatus", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncXcvData", discard_const_p(char *, kwnames), &py_hXcv, &py_pszDataName, &py_pInputData, &py_cbOutputData, &py_pdwStatus)) { return false; } if (py_hXcv == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hXcv"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hXcv, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hXcv)) == NULL) { PyErr_NoMemory(); return false; } r->in.hXcv = *(struct policy_handle *)pytalloc_get_ptr(py_hXcv); if (py_pszDataName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszDataName"); return false; } r->in.pszDataName = talloc_ptrtype(r, r->in.pszDataName); if (r->in.pszDataName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszDataName)) { unicode = PyUnicode_AsEncodedString(py_pszDataName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszDataName)) { test_str = PyBytes_AS_STRING(py_pszDataName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszDataName)->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.pszDataName = talloc_str; } if (py_pInputData == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pInputData"); return false; } r->in.pInputData = talloc_ptrtype(r, r->in.pInputData); if (r->in.pInputData == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PyList_Type, py_pInputData, return false;); { int pInputData_cntr_1; r->in.pInputData = talloc_array_ptrtype(r, r->in.pInputData, PyList_GET_SIZE(py_pInputData)); if (!r->in.pInputData) { return false;; } talloc_set_name_const(r->in.pInputData, "ARRAY: r->in.pInputData"); for (pInputData_cntr_1 = 0; pInputData_cntr_1 < PyList_GET_SIZE(py_pInputData); pInputData_cntr_1++) { if (PyList_GET_ITEM(py_pInputData, pInputData_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pInputData[pInputData_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pInputData[pInputData_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pInputData, pInputData_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pInputData, pInputData_cntr_1)); 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.pInputData[pInputData_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } PY_CHECK_TYPE(&PyList_Type, py_pInputData, return false;); r->in.cbInputData = PyList_GET_SIZE(py_pInputData); if (py_cbOutputData == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cbOutputData"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cbOutputData)); if (PyLong_Check(py_cbOutputData)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cbOutputData); 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.cbOutputData = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pdwStatus == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pdwStatus"); return false; } r->in.pdwStatus = talloc_ptrtype(r, r->in.pdwStatus); if (r->in.pdwStatus == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.pdwStatus)); if (PyLong_Check(py_pdwStatus)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_pdwStatus); 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.pdwStatus = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncXcvData_args_out(struct winspool_AsyncXcvData *r) { PyObject *result; PyObject *py_pOutputData; PyObject *py_pcbOutputNeeded; PyObject *py_pdwStatus; result = PyTuple_New(3); py_pOutputData = PyList_New(r->in.cbOutputData); if (py_pOutputData == NULL) { return NULL; } { int pOutputData_cntr_1; for (pOutputData_cntr_1 = 0; pOutputData_cntr_1 < (r->in.cbOutputData); pOutputData_cntr_1++) { PyObject *py_pOutputData_1; py_pOutputData_1 = PyLong_FromLong((uint16_t)r->out.pOutputData[pOutputData_cntr_1]); PyList_SetItem(py_pOutputData, pOutputData_cntr_1, py_pOutputData_1); } } PyTuple_SetItem(result, 0, py_pOutputData); py_pcbOutputNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbOutputNeeded); PyTuple_SetItem(result, 1, py_pcbOutputNeeded); py_pdwStatus = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pdwStatus); PyTuple_SetItem(result, 2, py_pdwStatus); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncSendRecvBidiData_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncSendRecvBidiData_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSendRecvBidiData_in_get_pAction(PyObject *obj, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(obj); PyObject *py_pAction; if (object->in.pAction == NULL) { Py_RETURN_NONE; } if (object->in.pAction == NULL) { py_pAction = Py_None; Py_INCREF(py_pAction); } else { if (object->in.pAction == NULL) { py_pAction = Py_None; Py_INCREF(py_pAction); } else { py_pAction = PyUnicode_Decode(object->in.pAction, strlen(object->in.pAction), "utf-8", "ignore"); } } return py_pAction; } static int py_winspool_AsyncSendRecvBidiData_in_set_pAction(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pAction"); return -1; } if (value == Py_None) { object->in.pAction = NULL; } else { object->in.pAction = 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.pAction = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncSendRecvBidiData_in_get_pReqData(PyObject *obj, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(obj); PyObject *py_pReqData; if (object->in.pReqData == NULL) { Py_RETURN_NONE; } py_pReqData = pytalloc_reference_ex(RPC_BIDI_REQUEST_CONTAINER_Type, object->in.pReqData, object->in.pReqData); return py_pReqData; } static int py_winspool_AsyncSendRecvBidiData_in_set_pReqData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pReqData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pReqData"); return -1; } object->in.pReqData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pReqData); if (object->in.pReqData == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(RPC_BIDI_REQUEST_CONTAINER_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.pReqData = (struct RPC_BIDI_REQUEST_CONTAINER *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSendRecvBidiData_out_get_ppRespData(PyObject *obj, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(obj); PyObject *py_ppRespData; if (object->out.ppRespData == NULL) { Py_RETURN_NONE; } if (*object->out.ppRespData == NULL) { py_ppRespData = Py_None; Py_INCREF(py_ppRespData); } else { py_ppRespData = pytalloc_reference_ex(RPC_BIDI_RESPONSE_CONTAINER_Type, *object->out.ppRespData, *object->out.ppRespData); } return py_ppRespData; } static int py_winspool_AsyncSendRecvBidiData_out_set_ppRespData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.ppRespData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.ppRespData"); return -1; } object->out.ppRespData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.ppRespData); if (object->out.ppRespData == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.ppRespData = NULL; } else { *object->out.ppRespData = NULL; PY_CHECK_TYPE(RPC_BIDI_RESPONSE_CONTAINER_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.ppRespData = (struct RPC_BIDI_RESPONSE_CONTAINER *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_winspool_AsyncSendRecvBidiData_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSendRecvBidiData_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)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_winspool_AsyncSendRecvBidiData_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncSendRecvBidiData_in_get_hPrinter, .set = py_winspool_AsyncSendRecvBidiData_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pAction"), .get = py_winspool_AsyncSendRecvBidiData_in_get_pAction, .set = py_winspool_AsyncSendRecvBidiData_in_set_pAction, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pReqData"), .get = py_winspool_AsyncSendRecvBidiData_in_get_pReqData, .set = py_winspool_AsyncSendRecvBidiData_in_set_pReqData, .doc = discard_const_p(char, "PIDL-generated element of base type RPC_BIDI_REQUEST_CONTAINER") }, { .name = discard_const_p(char, "out_ppRespData"), .get = py_winspool_AsyncSendRecvBidiData_out_get_ppRespData, .set = py_winspool_AsyncSendRecvBidiData_out_set_ppRespData, .doc = discard_const_p(char, "PIDL-generated element of base type RPC_BIDI_RESPONSE_CONTAINER") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSendRecvBidiData_get_result, .set = py_winspool_AsyncSendRecvBidiData_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSendRecvBidiData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSendRecvBidiData, type); struct winspool_AsyncSendRecvBidiData *_self = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pReqData = talloc_zero(mem_ctx, struct RPC_BIDI_REQUEST_CONTAINER); /* a pointer to a NULL pointer */ _self->out.ppRespData = talloc_zero(mem_ctx, struct RPC_BIDI_RESPONSE_CONTAINER *); return self; } static PyObject *py_winspool_AsyncSendRecvBidiData_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(34); } static PyObject *py_winspool_AsyncSendRecvBidiData_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 35) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSendRecvBidiData_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[34]; 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_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSendRecvBidiData_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 winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 35) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSendRecvBidiData_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[34]; 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_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSendRecvBidiData_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSendRecvBidiData *object = (struct winspool_AsyncSendRecvBidiData *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 35) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSendRecvBidiData_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[34]; 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_winspool_AsyncSendRecvBidiData_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSendRecvBidiData_ndr_print(py_obj, "winspool_AsyncSendRecvBidiData_in", NDR_IN); } static PyObject *py_winspool_AsyncSendRecvBidiData_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSendRecvBidiData_ndr_print(py_obj, "winspool_AsyncSendRecvBidiData_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSendRecvBidiData_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSendRecvBidiData_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSendRecvBidiData.opnum() -> 34 (0x22) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_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_winspool_AsyncSendRecvBidiData_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSendRecvBidiData_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSendRecvBidiData_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSendRecvBidiData", .tp_getset = py_winspool_AsyncSendRecvBidiData_getsetters, .tp_methods = py_winspool_AsyncSendRecvBidiData_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSendRecvBidiData_new, }; static bool pack_py_winspool_AsyncSendRecvBidiData_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSendRecvBidiData *r) { PyObject *py_hPrinter; PyObject *py_pAction; PyObject *py_pReqData; const char *kwnames[] = { "hPrinter", "pAction", "pReqData", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncSendRecvBidiData", discard_const_p(char *, kwnames), &py_hPrinter, &py_pAction, &py_pReqData)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pAction == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pAction"); return false; } if (py_pAction == Py_None) { r->in.pAction = NULL; } else { r->in.pAction = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pAction)) { unicode = PyUnicode_AsEncodedString(py_pAction, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pAction)) { test_str = PyBytes_AS_STRING(py_pAction); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pAction)->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.pAction = talloc_str; } } if (py_pReqData == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pReqData"); return false; } r->in.pReqData = talloc_ptrtype(r, r->in.pReqData); if (r->in.pReqData == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(RPC_BIDI_REQUEST_CONTAINER_Type, py_pReqData, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pReqData)) == NULL) { PyErr_NoMemory(); return false; } r->in.pReqData = (struct RPC_BIDI_REQUEST_CONTAINER *)pytalloc_get_ptr(py_pReqData); return true; } static PyObject *unpack_py_winspool_AsyncSendRecvBidiData_args_out(struct winspool_AsyncSendRecvBidiData *r) { PyObject *result; PyObject *py_ppRespData; if (*r->out.ppRespData == NULL) { py_ppRespData = Py_None; Py_INCREF(py_ppRespData); } else { py_ppRespData = pytalloc_reference_ex(RPC_BIDI_RESPONSE_CONTAINER_Type, *r->out.ppRespData, *r->out.ppRespData); } result = py_ppRespData; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncCreatePrinterIC_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncCreatePrinterIC_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncCreatePrinterIC_out_get_pHandle(PyObject *obj, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(obj); PyObject *py_pHandle; if (object->out.pHandle == NULL) { Py_RETURN_NONE; } py_pHandle = pytalloc_reference_ex(policy_handle_Type, object->out.pHandle, object->out.pHandle); return py_pHandle; } static int py_winspool_AsyncCreatePrinterIC_out_set_pHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pHandle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pHandle"); return -1; } object->out.pHandle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pHandle); if (object->out.pHandle == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.pHandle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncCreatePrinterIC_in_get_pDevModeContainer(PyObject *obj, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(obj); PyObject *py_pDevModeContainer; if (object->in.pDevModeContainer == NULL) { Py_RETURN_NONE; } py_pDevModeContainer = pytalloc_reference_ex(spoolss_DevmodeContainer_Type, object->in.pDevModeContainer, object->in.pDevModeContainer); return py_pDevModeContainer; } static int py_winspool_AsyncCreatePrinterIC_in_set_pDevModeContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDevModeContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDevModeContainer"); return -1; } object->in.pDevModeContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDevModeContainer); if (object->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_DevmodeContainer_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.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncCreatePrinterIC_get_result(PyObject *obj, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncCreatePrinterIC_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)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_winspool_AsyncCreatePrinterIC_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncCreatePrinterIC_in_get_hPrinter, .set = py_winspool_AsyncCreatePrinterIC_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_pHandle"), .get = py_winspool_AsyncCreatePrinterIC_out_get_pHandle, .set = py_winspool_AsyncCreatePrinterIC_out_set_pHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pDevModeContainer"), .get = py_winspool_AsyncCreatePrinterIC_in_get_pDevModeContainer, .set = py_winspool_AsyncCreatePrinterIC_in_set_pDevModeContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_DevmodeContainer") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncCreatePrinterIC_get_result, .set = py_winspool_AsyncCreatePrinterIC_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncCreatePrinterIC_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncCreatePrinterIC, type); struct winspool_AsyncCreatePrinterIC *_self = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pHandle = talloc_zero(mem_ctx, struct policy_handle); _self->in.pDevModeContainer = talloc_zero(mem_ctx, struct spoolss_DevmodeContainer); return self; } static PyObject *py_winspool_AsyncCreatePrinterIC_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(35); } static PyObject *py_winspool_AsyncCreatePrinterIC_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 36) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncCreatePrinterIC_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[35]; 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_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncCreatePrinterIC_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 winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 36) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncCreatePrinterIC_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[35]; 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_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncCreatePrinterIC_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncCreatePrinterIC *object = (struct winspool_AsyncCreatePrinterIC *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 36) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncCreatePrinterIC_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[35]; 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_winspool_AsyncCreatePrinterIC_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncCreatePrinterIC_ndr_print(py_obj, "winspool_AsyncCreatePrinterIC_in", NDR_IN); } static PyObject *py_winspool_AsyncCreatePrinterIC_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncCreatePrinterIC_ndr_print(py_obj, "winspool_AsyncCreatePrinterIC_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncCreatePrinterIC_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncCreatePrinterIC_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncCreatePrinterIC.opnum() -> 35 (0x23) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_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_winspool_AsyncCreatePrinterIC_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncCreatePrinterIC_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncCreatePrinterIC_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncCreatePrinterIC", .tp_getset = py_winspool_AsyncCreatePrinterIC_getsetters, .tp_methods = py_winspool_AsyncCreatePrinterIC_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncCreatePrinterIC_new, }; static bool pack_py_winspool_AsyncCreatePrinterIC_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncCreatePrinterIC *r) { PyObject *py_hPrinter; PyObject *py_pDevModeContainer; const char *kwnames[] = { "hPrinter", "pDevModeContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncCreatePrinterIC", discard_const_p(char *, kwnames), &py_hPrinter, &py_pDevModeContainer)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pDevModeContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDevModeContainer"); return false; } r->in.pDevModeContainer = talloc_ptrtype(r, r->in.pDevModeContainer); if (r->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_DevmodeContainer_Type, py_pDevModeContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pDevModeContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(py_pDevModeContainer); return true; } static PyObject *unpack_py_winspool_AsyncCreatePrinterIC_args_out(struct winspool_AsyncCreatePrinterIC *r) { PyObject *result; PyObject *py_pHandle; py_pHandle = pytalloc_reference_ex(policy_handle_Type, r->out.pHandle, r->out.pHandle); result = py_pHandle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_hPrinterIC(PyObject *obj, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(obj); PyObject *py_hPrinterIC; py_hPrinterIC = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinterIC); return py_hPrinterIC; } static int py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_hPrinterIC(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinterIC"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinterIC = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_pIn(PyObject *obj, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(obj); PyObject *py_pIn; if (object->in.pIn == NULL) { Py_RETURN_NONE; } py_pIn = PyList_New(object->in.cIn); if (py_pIn == NULL) { return NULL; } { int pIn_cntr_1; for (pIn_cntr_1 = 0; pIn_cntr_1 < (object->in.cIn); pIn_cntr_1++) { PyObject *py_pIn_1; py_pIn_1 = PyLong_FromLong((uint16_t)object->in.pIn[pIn_cntr_1]); PyList_SetItem(py_pIn, pIn_cntr_1, py_pIn_1); } } return py_pIn; } static int py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_pIn(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pIn)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pIn"); return -1; } object->in.pIn = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pIn); if (object->in.pIn == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pIn_cntr_1; object->in.pIn = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pIn, PyList_GET_SIZE(value)); if (!object->in.pIn) { return -1;; } talloc_set_name_const(object->in.pIn, "ARRAY: object->in.pIn"); for (pIn_cntr_1 = 0; pIn_cntr_1 < PyList_GET_SIZE(value); pIn_cntr_1++) { if (PyList_GET_ITEM(value, pIn_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pIn[pIn_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pIn[pIn_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pIn_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pIn_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->in.pIn[pIn_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_cIn(PyObject *obj, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(obj); PyObject *py_cIn; py_cIn = PyLong_FromUnsignedLongLong((uint32_t)object->in.cIn); return py_cIn; } static int py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_cIn(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cIn"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cIn)); 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.cIn = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_out_get_pOut(PyObject *obj, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(obj); PyObject *py_pOut; if (object->out.pOut == NULL) { Py_RETURN_NONE; } py_pOut = PyList_New(object->in.cOut); if (py_pOut == NULL) { return NULL; } { int pOut_cntr_1; for (pOut_cntr_1 = 0; pOut_cntr_1 < (object->in.cOut); pOut_cntr_1++) { PyObject *py_pOut_1; py_pOut_1 = PyLong_FromLong((uint16_t)object->out.pOut[pOut_cntr_1]); PyList_SetItem(py_pOut, pOut_cntr_1, py_pOut_1); } } return py_pOut; } static int py_winspool_AsyncPlayGdiScriptOnPrinterIC_out_set_pOut(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pOut)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pOut"); return -1; } object->out.pOut = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pOut); if (object->out.pOut == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pOut_cntr_1; object->out.pOut = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pOut, PyList_GET_SIZE(value)); if (!object->out.pOut) { return -1;; } talloc_set_name_const(object->out.pOut, "ARRAY: object->out.pOut"); for (pOut_cntr_1 = 0; pOut_cntr_1 < PyList_GET_SIZE(value); pOut_cntr_1++) { if (PyList_GET_ITEM(value, pOut_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pOut[pOut_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pOut[pOut_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pOut_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pOut_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.pOut[pOut_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_cOut(PyObject *obj, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(obj); PyObject *py_cOut; py_cOut = PyLong_FromUnsignedLongLong((uint32_t)object->in.cOut); return py_cOut; } static int py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_cOut(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cOut"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cOut)); 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.cOut = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_ul(PyObject *obj, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(obj); PyObject *py_ul; py_ul = PyLong_FromUnsignedLongLong((uint32_t)object->in.ul); return py_ul; } static int py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_ul(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.ul"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.ul)); 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.ul = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_get_result(PyObject *obj, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncPlayGdiScriptOnPrinterIC_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)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_winspool_AsyncPlayGdiScriptOnPrinterIC_getsetters[] = { { .name = discard_const_p(char, "in_hPrinterIC"), .get = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_hPrinterIC, .set = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_hPrinterIC, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pIn"), .get = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_pIn, .set = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_pIn, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cIn"), .get = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_cIn, .set = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_cIn, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pOut"), .get = py_winspool_AsyncPlayGdiScriptOnPrinterIC_out_get_pOut, .set = py_winspool_AsyncPlayGdiScriptOnPrinterIC_out_set_pOut, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cOut"), .get = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_cOut, .set = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_cOut, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_ul"), .get = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_get_ul, .set = py_winspool_AsyncPlayGdiScriptOnPrinterIC_in_set_ul, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncPlayGdiScriptOnPrinterIC_get_result, .set = py_winspool_AsyncPlayGdiScriptOnPrinterIC_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncPlayGdiScriptOnPrinterIC, type); struct winspool_AsyncPlayGdiScriptOnPrinterIC *_self = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pIn = talloc_zero(mem_ctx, uint8_t); _self->out.pOut = talloc_zero(mem_ctx, uint8_t); return self; } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(36); } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 37) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[36]; 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_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_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 winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 37) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[36]; 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_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncPlayGdiScriptOnPrinterIC *object = (struct winspool_AsyncPlayGdiScriptOnPrinterIC *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 37) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[36]; 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_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print(py_obj, "winspool_AsyncPlayGdiScriptOnPrinterIC_in", NDR_IN); } static PyObject *py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print(py_obj, "winspool_AsyncPlayGdiScriptOnPrinterIC_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncPlayGdiScriptOnPrinterIC_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncPlayGdiScriptOnPrinterIC.opnum() -> 36 (0x24) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_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_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncPlayGdiScriptOnPrinterIC_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncPlayGdiScriptOnPrinterIC_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncPlayGdiScriptOnPrinterIC", .tp_getset = py_winspool_AsyncPlayGdiScriptOnPrinterIC_getsetters, .tp_methods = py_winspool_AsyncPlayGdiScriptOnPrinterIC_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncPlayGdiScriptOnPrinterIC_new, }; static bool pack_py_winspool_AsyncPlayGdiScriptOnPrinterIC_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncPlayGdiScriptOnPrinterIC *r) { PyObject *py_hPrinterIC; PyObject *py_pIn; PyObject *py_cOut; PyObject *py_ul; const char *kwnames[] = { "hPrinterIC", "pIn", "cOut", "ul", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncPlayGdiScriptOnPrinterIC", discard_const_p(char *, kwnames), &py_hPrinterIC, &py_pIn, &py_cOut, &py_ul)) { return false; } if (py_hPrinterIC == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinterIC"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinterIC, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinterIC)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinterIC = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinterIC); if (py_pIn == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pIn"); return false; } r->in.pIn = talloc_ptrtype(r, r->in.pIn); if (r->in.pIn == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PyList_Type, py_pIn, return false;); { int pIn_cntr_1; r->in.pIn = talloc_array_ptrtype(r, r->in.pIn, PyList_GET_SIZE(py_pIn)); if (!r->in.pIn) { return false;; } talloc_set_name_const(r->in.pIn, "ARRAY: r->in.pIn"); for (pIn_cntr_1 = 0; pIn_cntr_1 < PyList_GET_SIZE(py_pIn); pIn_cntr_1++) { if (PyList_GET_ITEM(py_pIn, pIn_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pIn[pIn_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pIn[pIn_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pIn, pIn_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pIn, pIn_cntr_1)); 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.pIn[pIn_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } PY_CHECK_TYPE(&PyList_Type, py_pIn, return false;); r->in.cIn = PyList_GET_SIZE(py_pIn); if (py_cOut == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cOut"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cOut)); if (PyLong_Check(py_cOut)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cOut); 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.cOut = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_ul == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.ul"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.ul)); if (PyLong_Check(py_ul)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_ul); 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.ul = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncPlayGdiScriptOnPrinterIC_args_out(struct winspool_AsyncPlayGdiScriptOnPrinterIC *r) { PyObject *result; PyObject *py_pOut; py_pOut = PyList_New(r->in.cOut); if (py_pOut == NULL) { return NULL; } { int pOut_cntr_1; for (pOut_cntr_1 = 0; pOut_cntr_1 < (r->in.cOut); pOut_cntr_1++) { PyObject *py_pOut_1; py_pOut_1 = PyLong_FromLong((uint16_t)r->out.pOut[pOut_cntr_1]); PyList_SetItem(py_pOut, pOut_cntr_1, py_pOut_1); } } result = py_pOut; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncDeletePrinterIC_in_get_phPrinterIC(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(obj); PyObject *py_phPrinterIC; if (object->in.phPrinterIC == NULL) { Py_RETURN_NONE; } py_phPrinterIC = pytalloc_reference_ex(policy_handle_Type, object->in.phPrinterIC, object->in.phPrinterIC); return py_phPrinterIC; } static int py_winspool_AsyncDeletePrinterIC_in_set_phPrinterIC(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.phPrinterIC)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.phPrinterIC"); return -1; } object->in.phPrinterIC = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.phPrinterIC); if (object->in.phPrinterIC == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.phPrinterIC = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeletePrinterIC_out_get_phPrinterIC(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(obj); PyObject *py_phPrinterIC; if (object->out.phPrinterIC == NULL) { Py_RETURN_NONE; } py_phPrinterIC = pytalloc_reference_ex(policy_handle_Type, object->out.phPrinterIC, object->out.phPrinterIC); return py_phPrinterIC; } static int py_winspool_AsyncDeletePrinterIC_out_set_phPrinterIC(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.phPrinterIC)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.phPrinterIC"); return -1; } object->out.phPrinterIC = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.phPrinterIC); if (object->out.phPrinterIC == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.phPrinterIC = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeletePrinterIC_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinterIC_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)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_winspool_AsyncDeletePrinterIC_getsetters[] = { { .name = discard_const_p(char, "in_phPrinterIC"), .get = py_winspool_AsyncDeletePrinterIC_in_get_phPrinterIC, .set = py_winspool_AsyncDeletePrinterIC_in_set_phPrinterIC, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_phPrinterIC"), .get = py_winspool_AsyncDeletePrinterIC_out_get_phPrinterIC, .set = py_winspool_AsyncDeletePrinterIC_out_set_phPrinterIC, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinterIC_get_result, .set = py_winspool_AsyncDeletePrinterIC_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinterIC_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinterIC, type); struct winspool_AsyncDeletePrinterIC *_self = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.phPrinterIC = talloc_zero(mem_ctx, struct policy_handle); _self->out.phPrinterIC = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_winspool_AsyncDeletePrinterIC_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(37); } static PyObject *py_winspool_AsyncDeletePrinterIC_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 38) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterIC_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[37]; 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_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterIC_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 winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 38) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterIC_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[37]; 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_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterIC_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterIC *object = (struct winspool_AsyncDeletePrinterIC *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 38) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterIC_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[37]; 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_winspool_AsyncDeletePrinterIC_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterIC_ndr_print(py_obj, "winspool_AsyncDeletePrinterIC_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinterIC_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterIC_ndr_print(py_obj, "winspool_AsyncDeletePrinterIC_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinterIC_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinterIC_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinterIC.opnum() -> 37 (0x25) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_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_winspool_AsyncDeletePrinterIC_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinterIC_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinterIC_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinterIC", .tp_getset = py_winspool_AsyncDeletePrinterIC_getsetters, .tp_methods = py_winspool_AsyncDeletePrinterIC_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinterIC_new, }; static bool pack_py_winspool_AsyncDeletePrinterIC_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinterIC *r) { PyObject *py_phPrinterIC; const char *kwnames[] = { "phPrinterIC", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncDeletePrinterIC", discard_const_p(char *, kwnames), &py_phPrinterIC)) { return false; } if (py_phPrinterIC == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.phPrinterIC"); return false; } r->in.phPrinterIC = talloc_ptrtype(r, r->in.phPrinterIC); if (r->in.phPrinterIC == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_phPrinterIC, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_phPrinterIC)) == NULL) { PyErr_NoMemory(); return false; } r->in.phPrinterIC = (struct policy_handle *)pytalloc_get_ptr(py_phPrinterIC); return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinterIC_args_out(struct winspool_AsyncDeletePrinterIC *r) { PyObject *result; PyObject *py_phPrinterIC; py_phPrinterIC = pytalloc_reference_ex(policy_handle_Type, r->out.phPrinterIC, r->out.phPrinterIC); result = py_phPrinterIC; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEnumPrinters_in_get_Flags(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_Flags; py_Flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.Flags); return py_Flags; } static int py_winspool_AsyncEnumPrinters_in_set_Flags(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)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_winspool_AsyncEnumPrinters_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncEnumPrinters_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinters_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumPrinters_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinters_in_get_pPrinterEnum(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_pPrinterEnum; if (object->in.pPrinterEnum == NULL) { Py_RETURN_NONE; } if (object->in.pPrinterEnum == NULL) { py_pPrinterEnum = Py_None; Py_INCREF(py_pPrinterEnum); } else { py_pPrinterEnum = PyList_New(object->in.cbBuf); if (py_pPrinterEnum == NULL) { return NULL; } { int pPrinterEnum_cntr_1; for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < (object->in.cbBuf); pPrinterEnum_cntr_1++) { PyObject *py_pPrinterEnum_1; py_pPrinterEnum_1 = PyLong_FromLong((uint16_t)object->in.pPrinterEnum[pPrinterEnum_cntr_1]); PyList_SetItem(py_pPrinterEnum, pPrinterEnum_cntr_1, py_pPrinterEnum_1); } } } return py_pPrinterEnum; } static int py_winspool_AsyncEnumPrinters_in_set_pPrinterEnum(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPrinterEnum)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterEnum"); return -1; } if (value == Py_None) { object->in.pPrinterEnum = NULL; } else { object->in.pPrinterEnum = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrinterEnum_cntr_1; object->in.pPrinterEnum = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrinterEnum, PyList_GET_SIZE(value)); if (!object->in.pPrinterEnum) { return -1;; } talloc_set_name_const(object->in.pPrinterEnum, "ARRAY: object->in.pPrinterEnum"); for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < PyList_GET_SIZE(value); pPrinterEnum_cntr_1++) { if (PyList_GET_ITEM(value, pPrinterEnum_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterEnum[pPrinterEnum_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pPrinterEnum[pPrinterEnum_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrinterEnum_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrinterEnum_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->in.pPrinterEnum[pPrinterEnum_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinters_out_get_pPrinterEnum(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_pPrinterEnum; if (object->out.pPrinterEnum == NULL) { Py_RETURN_NONE; } if (object->out.pPrinterEnum == NULL) { py_pPrinterEnum = Py_None; Py_INCREF(py_pPrinterEnum); } else { py_pPrinterEnum = PyList_New(object->in.cbBuf); if (py_pPrinterEnum == NULL) { return NULL; } { int pPrinterEnum_cntr_1; for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < (object->in.cbBuf); pPrinterEnum_cntr_1++) { PyObject *py_pPrinterEnum_1; py_pPrinterEnum_1 = PyLong_FromLong((uint16_t)object->out.pPrinterEnum[pPrinterEnum_cntr_1]); PyList_SetItem(py_pPrinterEnum, pPrinterEnum_cntr_1, py_pPrinterEnum_1); } } } return py_pPrinterEnum; } static int py_winspool_AsyncEnumPrinters_out_set_pPrinterEnum(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pPrinterEnum)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrinterEnum"); return -1; } if (value == Py_None) { object->out.pPrinterEnum = NULL; } else { object->out.pPrinterEnum = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrinterEnum_cntr_1; object->out.pPrinterEnum = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pPrinterEnum, PyList_GET_SIZE(value)); if (!object->out.pPrinterEnum) { return -1;; } talloc_set_name_const(object->out.pPrinterEnum, "ARRAY: object->out.pPrinterEnum"); for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < PyList_GET_SIZE(value); pPrinterEnum_cntr_1++) { if (PyList_GET_ITEM(value, pPrinterEnum_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrinterEnum[pPrinterEnum_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pPrinterEnum[pPrinterEnum_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrinterEnum_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrinterEnum_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.pPrinterEnum[pPrinterEnum_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinters_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumPrinters_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinters_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumPrinters_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinters_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumPrinters_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinters_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPrinters_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)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_winspool_AsyncEnumPrinters_getsetters[] = { { .name = discard_const_p(char, "in_Flags"), .get = py_winspool_AsyncEnumPrinters_in_get_Flags, .set = py_winspool_AsyncEnumPrinters_in_set_Flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncEnumPrinters_in_get_pName, .set = py_winspool_AsyncEnumPrinters_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumPrinters_in_get_Level, .set = py_winspool_AsyncEnumPrinters_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pPrinterEnum"), .get = py_winspool_AsyncEnumPrinters_in_get_pPrinterEnum, .set = py_winspool_AsyncEnumPrinters_in_set_pPrinterEnum, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pPrinterEnum"), .get = py_winspool_AsyncEnumPrinters_out_get_pPrinterEnum, .set = py_winspool_AsyncEnumPrinters_out_set_pPrinterEnum, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumPrinters_in_get_cbBuf, .set = py_winspool_AsyncEnumPrinters_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumPrinters_out_get_pcbNeeded, .set = py_winspool_AsyncEnumPrinters_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumPrinters_out_get_pcReturned, .set = py_winspool_AsyncEnumPrinters_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPrinters_get_result, .set = py_winspool_AsyncEnumPrinters_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPrinters_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPrinters, type); struct winspool_AsyncEnumPrinters *_self = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPrinters_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(38); } static PyObject *py_winspool_AsyncEnumPrinters_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 39) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinters_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[38]; 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_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinters_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 winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 39) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinters_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[38]; 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_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinters_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinters *object = (struct winspool_AsyncEnumPrinters *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 39) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinters_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[38]; 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_winspool_AsyncEnumPrinters_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinters_ndr_print(py_obj, "winspool_AsyncEnumPrinters_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPrinters_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinters_ndr_print(py_obj, "winspool_AsyncEnumPrinters_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPrinters_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPrinters_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPrinters.opnum() -> 38 (0x26) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_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_winspool_AsyncEnumPrinters_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPrinters_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPrinters_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPrinters", .tp_getset = py_winspool_AsyncEnumPrinters_getsetters, .tp_methods = py_winspool_AsyncEnumPrinters_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPrinters_new, }; static bool pack_py_winspool_AsyncEnumPrinters_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPrinters *r) { PyObject *py_Flags; PyObject *py_pName; PyObject *py_Level; PyObject *py_pPrinterEnum; const char *kwnames[] = { "Flags", "pName", "Level", "pPrinterEnum", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncEnumPrinters", discard_const_p(char *, kwnames), &py_Flags, &py_pName, &py_Level, &py_pPrinterEnum)) { 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; } } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pPrinterEnum == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterEnum"); return false; } if (py_pPrinterEnum == Py_None) { r->in.pPrinterEnum = NULL; } else { r->in.pPrinterEnum = NULL; PY_CHECK_TYPE(&PyList_Type, py_pPrinterEnum, return false;); { int pPrinterEnum_cntr_1; r->in.pPrinterEnum = talloc_array_ptrtype(r, r->in.pPrinterEnum, PyList_GET_SIZE(py_pPrinterEnum)); if (!r->in.pPrinterEnum) { return false;; } talloc_set_name_const(r->in.pPrinterEnum, "ARRAY: r->in.pPrinterEnum"); for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < PyList_GET_SIZE(py_pPrinterEnum); pPrinterEnum_cntr_1++) { if (PyList_GET_ITEM(py_pPrinterEnum, pPrinterEnum_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterEnum[pPrinterEnum_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pPrinterEnum[pPrinterEnum_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pPrinterEnum, pPrinterEnum_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pPrinterEnum, pPrinterEnum_cntr_1)); 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.pPrinterEnum[pPrinterEnum_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pPrinterEnum, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pPrinterEnum); return true; } static PyObject *unpack_py_winspool_AsyncEnumPrinters_args_out(struct winspool_AsyncEnumPrinters *r) { PyObject *result; PyObject *py_pPrinterEnum; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pPrinterEnum == NULL) { py_pPrinterEnum = Py_None; Py_INCREF(py_pPrinterEnum); } else { py_pPrinterEnum = PyList_New(r->in.cbBuf); if (py_pPrinterEnum == NULL) { return NULL; } { int pPrinterEnum_cntr_1; for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < (r->in.cbBuf); pPrinterEnum_cntr_1++) { PyObject *py_pPrinterEnum_1; py_pPrinterEnum_1 = PyLong_FromLong((uint16_t)r->out.pPrinterEnum[pPrinterEnum_cntr_1]); PyList_SetItem(py_pPrinterEnum, pPrinterEnum_cntr_1, py_pPrinterEnum_1); } } } PyTuple_SetItem(result, 0, py_pPrinterEnum); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncAddPrinterDriver_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncAddPrinterDriver_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncAddPrinterDriver_in_get_pDriverContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pDriverContainer; if (object->in.pDriverContainer == NULL) { Py_RETURN_NONE; } py_pDriverContainer = pytalloc_reference_ex(spoolss_AddDriverInfoCtr_Type, object->in.pDriverContainer, object->in.pDriverContainer); return py_pDriverContainer; } static int py_winspool_AsyncAddPrinterDriver_in_set_pDriverContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDriverContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDriverContainer"); return -1; } object->in.pDriverContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDriverContainer); if (object->in.pDriverContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_AddDriverInfoCtr_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.pDriverContainer = (struct spoolss_AddDriverInfoCtr *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPrinterDriver_in_get_dwFileCopyFlags(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_dwFileCopyFlags; py_dwFileCopyFlags = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwFileCopyFlags); return py_dwFileCopyFlags; } static int py_winspool_AsyncAddPrinterDriver_in_set_dwFileCopyFlags(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwFileCopyFlags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwFileCopyFlags)); 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.dwFileCopyFlags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncAddPrinterDriver_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddPrinterDriver_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)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_winspool_AsyncAddPrinterDriver_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncAddPrinterDriver_in_get_pName, .set = py_winspool_AsyncAddPrinterDriver_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pDriverContainer"), .get = py_winspool_AsyncAddPrinterDriver_in_get_pDriverContainer, .set = py_winspool_AsyncAddPrinterDriver_in_set_pDriverContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_AddDriverInfoCtr") }, { .name = discard_const_p(char, "in_dwFileCopyFlags"), .get = py_winspool_AsyncAddPrinterDriver_in_get_dwFileCopyFlags, .set = py_winspool_AsyncAddPrinterDriver_in_set_dwFileCopyFlags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddPrinterDriver_get_result, .set = py_winspool_AsyncAddPrinterDriver_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddPrinterDriver_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddPrinterDriver, type); struct winspool_AsyncAddPrinterDriver *_self = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pDriverContainer = talloc_zero(mem_ctx, struct spoolss_AddDriverInfoCtr); return self; } static PyObject *py_winspool_AsyncAddPrinterDriver_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(39); } static PyObject *py_winspool_AsyncAddPrinterDriver_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 40) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrinterDriver_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[39]; 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_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPrinterDriver_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 winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 40) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrinterDriver_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[39]; 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_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPrinterDriver_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPrinterDriver *object = (struct winspool_AsyncAddPrinterDriver *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 40) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrinterDriver_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[39]; 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_winspool_AsyncAddPrinterDriver_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPrinterDriver_ndr_print(py_obj, "winspool_AsyncAddPrinterDriver_in", NDR_IN); } static PyObject *py_winspool_AsyncAddPrinterDriver_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPrinterDriver_ndr_print(py_obj, "winspool_AsyncAddPrinterDriver_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddPrinterDriver_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddPrinterDriver_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddPrinterDriver.opnum() -> 39 (0x27) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_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_winspool_AsyncAddPrinterDriver_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddPrinterDriver_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddPrinterDriver_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddPrinterDriver", .tp_getset = py_winspool_AsyncAddPrinterDriver_getsetters, .tp_methods = py_winspool_AsyncAddPrinterDriver_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddPrinterDriver_new, }; static bool pack_py_winspool_AsyncAddPrinterDriver_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddPrinterDriver *r) { PyObject *py_pName; PyObject *py_pDriverContainer; PyObject *py_dwFileCopyFlags; const char *kwnames[] = { "pName", "pDriverContainer", "dwFileCopyFlags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncAddPrinterDriver", discard_const_p(char *, kwnames), &py_pName, &py_pDriverContainer, &py_dwFileCopyFlags)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pDriverContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDriverContainer"); return false; } r->in.pDriverContainer = talloc_ptrtype(r, r->in.pDriverContainer); if (r->in.pDriverContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_AddDriverInfoCtr_Type, py_pDriverContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pDriverContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pDriverContainer = (struct spoolss_AddDriverInfoCtr *)pytalloc_get_ptr(py_pDriverContainer); if (py_dwFileCopyFlags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwFileCopyFlags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwFileCopyFlags)); if (PyLong_Check(py_dwFileCopyFlags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwFileCopyFlags); 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.dwFileCopyFlags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncAddPrinterDriver_args_out(struct winspool_AsyncAddPrinterDriver *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_winspool_AsyncEnumPrinterDrivers_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncEnumPrinterDrivers_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } } return py_pEnvironment; } static int py_winspool_AsyncEnumPrinterDrivers_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } if (value == Py_None) { object->in.pEnvironment = NULL; } else { object->in.pEnvironment = 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.pEnvironment = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumPrinterDrivers_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_in_get_pDrivers(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pDrivers; if (object->in.pDrivers == NULL) { Py_RETURN_NONE; } if (object->in.pDrivers == NULL) { py_pDrivers = Py_None; Py_INCREF(py_pDrivers); } else { py_pDrivers = PyList_New(object->in.cbBuf); if (py_pDrivers == NULL) { return NULL; } { int pDrivers_cntr_1; for (pDrivers_cntr_1 = 0; pDrivers_cntr_1 < (object->in.cbBuf); pDrivers_cntr_1++) { PyObject *py_pDrivers_1; py_pDrivers_1 = PyLong_FromLong((uint16_t)object->in.pDrivers[pDrivers_cntr_1]); PyList_SetItem(py_pDrivers, pDrivers_cntr_1, py_pDrivers_1); } } } return py_pDrivers; } static int py_winspool_AsyncEnumPrinterDrivers_in_set_pDrivers(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDrivers)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDrivers"); return -1; } if (value == Py_None) { object->in.pDrivers = NULL; } else { object->in.pDrivers = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDrivers_cntr_1; object->in.pDrivers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDrivers, PyList_GET_SIZE(value)); if (!object->in.pDrivers) { return -1;; } talloc_set_name_const(object->in.pDrivers, "ARRAY: object->in.pDrivers"); for (pDrivers_cntr_1 = 0; pDrivers_cntr_1 < PyList_GET_SIZE(value); pDrivers_cntr_1++) { if (PyList_GET_ITEM(value, pDrivers_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDrivers[pDrivers_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pDrivers[pDrivers_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDrivers_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDrivers_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->in.pDrivers[pDrivers_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_out_get_pDrivers(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pDrivers; if (object->out.pDrivers == NULL) { Py_RETURN_NONE; } if (object->out.pDrivers == NULL) { py_pDrivers = Py_None; Py_INCREF(py_pDrivers); } else { py_pDrivers = PyList_New(object->in.cbBuf); if (py_pDrivers == NULL) { return NULL; } { int pDrivers_cntr_1; for (pDrivers_cntr_1 = 0; pDrivers_cntr_1 < (object->in.cbBuf); pDrivers_cntr_1++) { PyObject *py_pDrivers_1; py_pDrivers_1 = PyLong_FromLong((uint16_t)object->out.pDrivers[pDrivers_cntr_1]); PyList_SetItem(py_pDrivers, pDrivers_cntr_1, py_pDrivers_1); } } } return py_pDrivers; } static int py_winspool_AsyncEnumPrinterDrivers_out_set_pDrivers(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pDrivers)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDrivers"); return -1; } if (value == Py_None) { object->out.pDrivers = NULL; } else { object->out.pDrivers = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDrivers_cntr_1; object->out.pDrivers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pDrivers, PyList_GET_SIZE(value)); if (!object->out.pDrivers) { return -1;; } talloc_set_name_const(object->out.pDrivers, "ARRAY: object->out.pDrivers"); for (pDrivers_cntr_1 = 0; pDrivers_cntr_1 < PyList_GET_SIZE(value); pDrivers_cntr_1++) { if (PyList_GET_ITEM(value, pDrivers_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDrivers[pDrivers_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pDrivers[pDrivers_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDrivers_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDrivers_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.pDrivers[pDrivers_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumPrinterDrivers_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumPrinterDrivers_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumPrinterDrivers_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPrinterDrivers_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)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_winspool_AsyncEnumPrinterDrivers_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncEnumPrinterDrivers_in_get_pName, .set = py_winspool_AsyncEnumPrinterDrivers_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncEnumPrinterDrivers_in_get_pEnvironment, .set = py_winspool_AsyncEnumPrinterDrivers_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumPrinterDrivers_in_get_Level, .set = py_winspool_AsyncEnumPrinterDrivers_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pDrivers"), .get = py_winspool_AsyncEnumPrinterDrivers_in_get_pDrivers, .set = py_winspool_AsyncEnumPrinterDrivers_in_set_pDrivers, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pDrivers"), .get = py_winspool_AsyncEnumPrinterDrivers_out_get_pDrivers, .set = py_winspool_AsyncEnumPrinterDrivers_out_set_pDrivers, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumPrinterDrivers_in_get_cbBuf, .set = py_winspool_AsyncEnumPrinterDrivers_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumPrinterDrivers_out_get_pcbNeeded, .set = py_winspool_AsyncEnumPrinterDrivers_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumPrinterDrivers_out_get_pcReturned, .set = py_winspool_AsyncEnumPrinterDrivers_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPrinterDrivers_get_result, .set = py_winspool_AsyncEnumPrinterDrivers_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPrinterDrivers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPrinterDrivers, type); struct winspool_AsyncEnumPrinterDrivers *_self = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPrinterDrivers_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(40); } static PyObject *py_winspool_AsyncEnumPrinterDrivers_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterDrivers_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrinterDrivers_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 winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterDrivers_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrinterDrivers_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrinterDrivers *object = (struct winspool_AsyncEnumPrinterDrivers *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrinterDrivers_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncEnumPrinterDrivers_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterDrivers_ndr_print(py_obj, "winspool_AsyncEnumPrinterDrivers_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPrinterDrivers_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrinterDrivers_ndr_print(py_obj, "winspool_AsyncEnumPrinterDrivers_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPrinterDrivers_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPrinterDrivers_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPrinterDrivers.opnum() -> 40 (0x28) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_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_winspool_AsyncEnumPrinterDrivers_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPrinterDrivers_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPrinterDrivers_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPrinterDrivers", .tp_getset = py_winspool_AsyncEnumPrinterDrivers_getsetters, .tp_methods = py_winspool_AsyncEnumPrinterDrivers_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPrinterDrivers_new, }; static bool pack_py_winspool_AsyncEnumPrinterDrivers_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPrinterDrivers *r) { PyObject *py_pName; PyObject *py_pEnvironment; PyObject *py_Level; PyObject *py_pDrivers; const char *kwnames[] = { "pName", "pEnvironment", "Level", "pDrivers", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncEnumPrinterDrivers", discard_const_p(char *, kwnames), &py_pName, &py_pEnvironment, &py_Level, &py_pDrivers)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } if (py_pEnvironment == Py_None) { r->in.pEnvironment = NULL; } else { r->in.pEnvironment = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pDrivers == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDrivers"); return false; } if (py_pDrivers == Py_None) { r->in.pDrivers = NULL; } else { r->in.pDrivers = NULL; PY_CHECK_TYPE(&PyList_Type, py_pDrivers, return false;); { int pDrivers_cntr_1; r->in.pDrivers = talloc_array_ptrtype(r, r->in.pDrivers, PyList_GET_SIZE(py_pDrivers)); if (!r->in.pDrivers) { return false;; } talloc_set_name_const(r->in.pDrivers, "ARRAY: r->in.pDrivers"); for (pDrivers_cntr_1 = 0; pDrivers_cntr_1 < PyList_GET_SIZE(py_pDrivers); pDrivers_cntr_1++) { if (PyList_GET_ITEM(py_pDrivers, pDrivers_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDrivers[pDrivers_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pDrivers[pDrivers_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pDrivers, pDrivers_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pDrivers, pDrivers_cntr_1)); 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.pDrivers[pDrivers_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pDrivers, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pDrivers); return true; } static PyObject *unpack_py_winspool_AsyncEnumPrinterDrivers_args_out(struct winspool_AsyncEnumPrinterDrivers *r) { PyObject *result; PyObject *py_pDrivers; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pDrivers == NULL) { py_pDrivers = Py_None; Py_INCREF(py_pDrivers); } else { py_pDrivers = PyList_New(r->in.cbBuf); if (py_pDrivers == NULL) { return NULL; } { int pDrivers_cntr_1; for (pDrivers_cntr_1 = 0; pDrivers_cntr_1 < (r->in.cbBuf); pDrivers_cntr_1++) { PyObject *py_pDrivers_1; py_pDrivers_1 = PyLong_FromLong((uint16_t)r->out.pDrivers[pDrivers_cntr_1]); PyList_SetItem(py_pDrivers, pDrivers_cntr_1, py_pDrivers_1); } } } PyTuple_SetItem(result, 0, py_pDrivers); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncGetPrinterDriverDirectory_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } } return py_pEnvironment; } static int py_winspool_AsyncGetPrinterDriverDirectory_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } if (value == Py_None) { object->in.pEnvironment = NULL; } else { object->in.pEnvironment = 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.pEnvironment = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncGetPrinterDriverDirectory_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_in_get_pDriverDirectory(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_pDriverDirectory; if (object->in.pDriverDirectory == NULL) { Py_RETURN_NONE; } if (object->in.pDriverDirectory == NULL) { py_pDriverDirectory = Py_None; Py_INCREF(py_pDriverDirectory); } else { py_pDriverDirectory = PyList_New(object->in.cbBuf); if (py_pDriverDirectory == NULL) { return NULL; } { int pDriverDirectory_cntr_1; for (pDriverDirectory_cntr_1 = 0; pDriverDirectory_cntr_1 < (object->in.cbBuf); pDriverDirectory_cntr_1++) { PyObject *py_pDriverDirectory_1; py_pDriverDirectory_1 = PyLong_FromLong((uint16_t)object->in.pDriverDirectory[pDriverDirectory_cntr_1]); PyList_SetItem(py_pDriverDirectory, pDriverDirectory_cntr_1, py_pDriverDirectory_1); } } } return py_pDriverDirectory; } static int py_winspool_AsyncGetPrinterDriverDirectory_in_set_pDriverDirectory(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDriverDirectory)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDriverDirectory"); return -1; } if (value == Py_None) { object->in.pDriverDirectory = NULL; } else { object->in.pDriverDirectory = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDriverDirectory_cntr_1; object->in.pDriverDirectory = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDriverDirectory, PyList_GET_SIZE(value)); if (!object->in.pDriverDirectory) { return -1;; } talloc_set_name_const(object->in.pDriverDirectory, "ARRAY: object->in.pDriverDirectory"); for (pDriverDirectory_cntr_1 = 0; pDriverDirectory_cntr_1 < PyList_GET_SIZE(value); pDriverDirectory_cntr_1++) { if (PyList_GET_ITEM(value, pDriverDirectory_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDriverDirectory[pDriverDirectory_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pDriverDirectory[pDriverDirectory_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDriverDirectory_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDriverDirectory_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->in.pDriverDirectory[pDriverDirectory_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_out_get_pDriverDirectory(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_pDriverDirectory; if (object->out.pDriverDirectory == NULL) { Py_RETURN_NONE; } if (object->out.pDriverDirectory == NULL) { py_pDriverDirectory = Py_None; Py_INCREF(py_pDriverDirectory); } else { py_pDriverDirectory = PyList_New(object->in.cbBuf); if (py_pDriverDirectory == NULL) { return NULL; } { int pDriverDirectory_cntr_1; for (pDriverDirectory_cntr_1 = 0; pDriverDirectory_cntr_1 < (object->in.cbBuf); pDriverDirectory_cntr_1++) { PyObject *py_pDriverDirectory_1; py_pDriverDirectory_1 = PyLong_FromLong((uint16_t)object->out.pDriverDirectory[pDriverDirectory_cntr_1]); PyList_SetItem(py_pDriverDirectory, pDriverDirectory_cntr_1, py_pDriverDirectory_1); } } } return py_pDriverDirectory; } static int py_winspool_AsyncGetPrinterDriverDirectory_out_set_pDriverDirectory(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pDriverDirectory)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDriverDirectory"); return -1; } if (value == Py_None) { object->out.pDriverDirectory = NULL; } else { object->out.pDriverDirectory = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDriverDirectory_cntr_1; object->out.pDriverDirectory = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pDriverDirectory, PyList_GET_SIZE(value)); if (!object->out.pDriverDirectory) { return -1;; } talloc_set_name_const(object->out.pDriverDirectory, "ARRAY: object->out.pDriverDirectory"); for (pDriverDirectory_cntr_1 = 0; pDriverDirectory_cntr_1 < PyList_GET_SIZE(value); pDriverDirectory_cntr_1++) { if (PyList_GET_ITEM(value, pDriverDirectory_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDriverDirectory[pDriverDirectory_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pDriverDirectory[pDriverDirectory_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDriverDirectory_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDriverDirectory_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.pDriverDirectory[pDriverDirectory_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncGetPrinterDriverDirectory_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetPrinterDriverDirectory_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetPrinterDriverDirectory_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)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_winspool_AsyncGetPrinterDriverDirectory_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncGetPrinterDriverDirectory_in_get_pName, .set = py_winspool_AsyncGetPrinterDriverDirectory_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncGetPrinterDriverDirectory_in_get_pEnvironment, .set = py_winspool_AsyncGetPrinterDriverDirectory_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncGetPrinterDriverDirectory_in_get_Level, .set = py_winspool_AsyncGetPrinterDriverDirectory_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pDriverDirectory"), .get = py_winspool_AsyncGetPrinterDriverDirectory_in_get_pDriverDirectory, .set = py_winspool_AsyncGetPrinterDriverDirectory_in_set_pDriverDirectory, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pDriverDirectory"), .get = py_winspool_AsyncGetPrinterDriverDirectory_out_get_pDriverDirectory, .set = py_winspool_AsyncGetPrinterDriverDirectory_out_set_pDriverDirectory, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncGetPrinterDriverDirectory_in_get_cbBuf, .set = py_winspool_AsyncGetPrinterDriverDirectory_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetPrinterDriverDirectory_out_get_pcbNeeded, .set = py_winspool_AsyncGetPrinterDriverDirectory_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetPrinterDriverDirectory_get_result, .set = py_winspool_AsyncGetPrinterDriverDirectory_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetPrinterDriverDirectory, type); struct winspool_AsyncGetPrinterDriverDirectory *_self = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(41); } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriverDirectory_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_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 winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriverDirectory_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDriverDirectory *object = (struct winspool_AsyncGetPrinterDriverDirectory *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriverDirectory_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.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_winspool_AsyncGetPrinterDriverDirectory_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDriverDirectory_ndr_print(py_obj, "winspool_AsyncGetPrinterDriverDirectory_in", NDR_IN); } static PyObject *py_winspool_AsyncGetPrinterDriverDirectory_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDriverDirectory_ndr_print(py_obj, "winspool_AsyncGetPrinterDriverDirectory_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetPrinterDriverDirectory_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetPrinterDriverDirectory_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetPrinterDriverDirectory.opnum() -> 41 (0x29) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_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_winspool_AsyncGetPrinterDriverDirectory_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetPrinterDriverDirectory_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetPrinterDriverDirectory_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetPrinterDriverDirectory", .tp_getset = py_winspool_AsyncGetPrinterDriverDirectory_getsetters, .tp_methods = py_winspool_AsyncGetPrinterDriverDirectory_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetPrinterDriverDirectory_new, }; static bool pack_py_winspool_AsyncGetPrinterDriverDirectory_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetPrinterDriverDirectory *r) { PyObject *py_pName; PyObject *py_pEnvironment; PyObject *py_Level; PyObject *py_pDriverDirectory; const char *kwnames[] = { "pName", "pEnvironment", "Level", "pDriverDirectory", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncGetPrinterDriverDirectory", discard_const_p(char *, kwnames), &py_pName, &py_pEnvironment, &py_Level, &py_pDriverDirectory)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } if (py_pEnvironment == Py_None) { r->in.pEnvironment = NULL; } else { r->in.pEnvironment = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pDriverDirectory == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDriverDirectory"); return false; } if (py_pDriverDirectory == Py_None) { r->in.pDriverDirectory = NULL; } else { r->in.pDriverDirectory = NULL; PY_CHECK_TYPE(&PyList_Type, py_pDriverDirectory, return false;); { int pDriverDirectory_cntr_1; r->in.pDriverDirectory = talloc_array_ptrtype(r, r->in.pDriverDirectory, PyList_GET_SIZE(py_pDriverDirectory)); if (!r->in.pDriverDirectory) { return false;; } talloc_set_name_const(r->in.pDriverDirectory, "ARRAY: r->in.pDriverDirectory"); for (pDriverDirectory_cntr_1 = 0; pDriverDirectory_cntr_1 < PyList_GET_SIZE(py_pDriverDirectory); pDriverDirectory_cntr_1++) { if (PyList_GET_ITEM(py_pDriverDirectory, pDriverDirectory_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDriverDirectory[pDriverDirectory_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pDriverDirectory[pDriverDirectory_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pDriverDirectory, pDriverDirectory_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pDriverDirectory, pDriverDirectory_cntr_1)); 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.pDriverDirectory[pDriverDirectory_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pDriverDirectory, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pDriverDirectory); return true; } static PyObject *unpack_py_winspool_AsyncGetPrinterDriverDirectory_args_out(struct winspool_AsyncGetPrinterDriverDirectory *r) { PyObject *result; PyObject *py_pDriverDirectory; PyObject *py_pcbNeeded; result = PyTuple_New(2); if (r->out.pDriverDirectory == NULL) { py_pDriverDirectory = Py_None; Py_INCREF(py_pDriverDirectory); } else { py_pDriverDirectory = PyList_New(r->in.cbBuf); if (py_pDriverDirectory == NULL) { return NULL; } { int pDriverDirectory_cntr_1; for (pDriverDirectory_cntr_1 = 0; pDriverDirectory_cntr_1 < (r->in.cbBuf); pDriverDirectory_cntr_1++) { PyObject *py_pDriverDirectory_1; py_pDriverDirectory_1 = PyLong_FromLong((uint16_t)r->out.pDriverDirectory[pDriverDirectory_cntr_1]); PyList_SetItem(py_pDriverDirectory, pDriverDirectory_cntr_1, py_pDriverDirectory_1); } } } PyTuple_SetItem(result, 0, py_pDriverDirectory); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncDeletePrinterDriver_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncDeletePrinterDriver_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriver_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } return py_pEnvironment; } static int py_winspool_AsyncDeletePrinterDriver_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } object->in.pEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pEnvironment); if (object->in.pEnvironment == 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.pEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriver_in_get_pDriverName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_pDriverName; if (object->in.pDriverName == NULL) { Py_RETURN_NONE; } if (object->in.pDriverName == NULL) { py_pDriverName = Py_None; Py_INCREF(py_pDriverName); } else { py_pDriverName = PyUnicode_Decode(object->in.pDriverName, strlen(object->in.pDriverName), "utf-8", "ignore"); } return py_pDriverName; } static int py_winspool_AsyncDeletePrinterDriver_in_set_pDriverName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDriverName"); return -1; } object->in.pDriverName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDriverName); if (object->in.pDriverName == 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.pDriverName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriver_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinterDriver_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)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_winspool_AsyncDeletePrinterDriver_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncDeletePrinterDriver_in_get_pName, .set = py_winspool_AsyncDeletePrinterDriver_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncDeletePrinterDriver_in_get_pEnvironment, .set = py_winspool_AsyncDeletePrinterDriver_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pDriverName"), .get = py_winspool_AsyncDeletePrinterDriver_in_get_pDriverName, .set = py_winspool_AsyncDeletePrinterDriver_in_set_pDriverName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinterDriver_get_result, .set = py_winspool_AsyncDeletePrinterDriver_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinterDriver_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinterDriver, type); return self; } static PyObject *py_winspool_AsyncDeletePrinterDriver_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(42); } static PyObject *py_winspool_AsyncDeletePrinterDriver_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 43) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriver_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[42]; 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_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDriver_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 winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 43) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriver_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[42]; 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_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDriver_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDriver *object = (struct winspool_AsyncDeletePrinterDriver *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 43) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriver_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[42]; 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_winspool_AsyncDeletePrinterDriver_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDriver_ndr_print(py_obj, "winspool_AsyncDeletePrinterDriver_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinterDriver_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDriver_ndr_print(py_obj, "winspool_AsyncDeletePrinterDriver_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinterDriver_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinterDriver_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinterDriver.opnum() -> 42 (0x2a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_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_winspool_AsyncDeletePrinterDriver_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinterDriver_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinterDriver_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinterDriver", .tp_getset = py_winspool_AsyncDeletePrinterDriver_getsetters, .tp_methods = py_winspool_AsyncDeletePrinterDriver_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinterDriver_new, }; static bool pack_py_winspool_AsyncDeletePrinterDriver_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinterDriver *r) { PyObject *py_pName; PyObject *py_pEnvironment; PyObject *py_pDriverName; const char *kwnames[] = { "pName", "pEnvironment", "pDriverName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncDeletePrinterDriver", discard_const_p(char *, kwnames), &py_pName, &py_pEnvironment, &py_pDriverName)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } r->in.pEnvironment = talloc_ptrtype(r, r->in.pEnvironment); if (r->in.pEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } if (py_pDriverName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDriverName"); return false; } r->in.pDriverName = talloc_ptrtype(r, r->in.pDriverName); if (r->in.pDriverName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pDriverName)) { unicode = PyUnicode_AsEncodedString(py_pDriverName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pDriverName)) { test_str = PyBytes_AS_STRING(py_pDriverName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pDriverName)->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.pDriverName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinterDriver_args_out(struct winspool_AsyncDeletePrinterDriver *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_winspool_AsyncDeletePrinterDriverEx_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncDeletePrinterDriverEx_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } return py_pEnvironment; } static int py_winspool_AsyncDeletePrinterDriverEx_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } object->in.pEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pEnvironment); if (object->in.pEnvironment == 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.pEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_in_get_pDriverName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(obj); PyObject *py_pDriverName; if (object->in.pDriverName == NULL) { Py_RETURN_NONE; } if (object->in.pDriverName == NULL) { py_pDriverName = Py_None; Py_INCREF(py_pDriverName); } else { py_pDriverName = PyUnicode_Decode(object->in.pDriverName, strlen(object->in.pDriverName), "utf-8", "ignore"); } return py_pDriverName; } static int py_winspool_AsyncDeletePrinterDriverEx_in_set_pDriverName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDriverName"); return -1; } object->in.pDriverName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDriverName); if (object->in.pDriverName == 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.pDriverName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_in_get_dwDeleteFlag(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(obj); PyObject *py_dwDeleteFlag; py_dwDeleteFlag = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwDeleteFlag); return py_dwDeleteFlag; } static int py_winspool_AsyncDeletePrinterDriverEx_in_set_dwDeleteFlag(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwDeleteFlag"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwDeleteFlag)); 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.dwDeleteFlag = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_in_get_dwVersionNum(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(obj); PyObject *py_dwVersionNum; py_dwVersionNum = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwVersionNum); return py_dwVersionNum; } static int py_winspool_AsyncDeletePrinterDriverEx_in_set_dwVersionNum(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwVersionNum"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwVersionNum)); 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.dwVersionNum = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinterDriverEx_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)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_winspool_AsyncDeletePrinterDriverEx_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncDeletePrinterDriverEx_in_get_pName, .set = py_winspool_AsyncDeletePrinterDriverEx_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncDeletePrinterDriverEx_in_get_pEnvironment, .set = py_winspool_AsyncDeletePrinterDriverEx_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pDriverName"), .get = py_winspool_AsyncDeletePrinterDriverEx_in_get_pDriverName, .set = py_winspool_AsyncDeletePrinterDriverEx_in_set_pDriverName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_dwDeleteFlag"), .get = py_winspool_AsyncDeletePrinterDriverEx_in_get_dwDeleteFlag, .set = py_winspool_AsyncDeletePrinterDriverEx_in_set_dwDeleteFlag, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_dwVersionNum"), .get = py_winspool_AsyncDeletePrinterDriverEx_in_get_dwVersionNum, .set = py_winspool_AsyncDeletePrinterDriverEx_in_set_dwVersionNum, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinterDriverEx_get_result, .set = py_winspool_AsyncDeletePrinterDriverEx_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinterDriverEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinterDriverEx, type); return self; } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(43); } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 44) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriverEx_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[43]; 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_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_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 winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 44) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriverEx_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[43]; 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_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDriverEx *object = (struct winspool_AsyncDeletePrinterDriverEx *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 44) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriverEx_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[43]; 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_winspool_AsyncDeletePrinterDriverEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDriverEx_ndr_print(py_obj, "winspool_AsyncDeletePrinterDriverEx_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinterDriverEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDriverEx_ndr_print(py_obj, "winspool_AsyncDeletePrinterDriverEx_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinterDriverEx_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinterDriverEx_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinterDriverEx.opnum() -> 43 (0x2b) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_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_winspool_AsyncDeletePrinterDriverEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinterDriverEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinterDriverEx_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinterDriverEx", .tp_getset = py_winspool_AsyncDeletePrinterDriverEx_getsetters, .tp_methods = py_winspool_AsyncDeletePrinterDriverEx_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinterDriverEx_new, }; static bool pack_py_winspool_AsyncDeletePrinterDriverEx_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinterDriverEx *r) { PyObject *py_pName; PyObject *py_pEnvironment; PyObject *py_pDriverName; PyObject *py_dwDeleteFlag; PyObject *py_dwVersionNum; const char *kwnames[] = { "pName", "pEnvironment", "pDriverName", "dwDeleteFlag", "dwVersionNum", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncDeletePrinterDriverEx", discard_const_p(char *, kwnames), &py_pName, &py_pEnvironment, &py_pDriverName, &py_dwDeleteFlag, &py_dwVersionNum)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } r->in.pEnvironment = talloc_ptrtype(r, r->in.pEnvironment); if (r->in.pEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } if (py_pDriverName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDriverName"); return false; } r->in.pDriverName = talloc_ptrtype(r, r->in.pDriverName); if (r->in.pDriverName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pDriverName)) { unicode = PyUnicode_AsEncodedString(py_pDriverName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pDriverName)) { test_str = PyBytes_AS_STRING(py_pDriverName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pDriverName)->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.pDriverName = talloc_str; } if (py_dwDeleteFlag == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwDeleteFlag"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwDeleteFlag)); if (PyLong_Check(py_dwDeleteFlag)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwDeleteFlag); 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.dwDeleteFlag = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_dwVersionNum == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwVersionNum"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwVersionNum)); if (PyLong_Check(py_dwVersionNum)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwVersionNum); 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.dwVersionNum = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinterDriverEx_args_out(struct winspool_AsyncDeletePrinterDriverEx *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_winspool_AsyncAddPrintProcessor_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncAddPrintProcessor_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncAddPrintProcessor_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } return py_pEnvironment; } static int py_winspool_AsyncAddPrintProcessor_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } object->in.pEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pEnvironment); if (object->in.pEnvironment == 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.pEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncAddPrintProcessor_in_get_pPathName(PyObject *obj, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_pPathName; if (object->in.pPathName == NULL) { Py_RETURN_NONE; } if (object->in.pPathName == NULL) { py_pPathName = Py_None; Py_INCREF(py_pPathName); } else { py_pPathName = PyUnicode_Decode(object->in.pPathName, strlen(object->in.pPathName), "utf-8", "ignore"); } return py_pPathName; } static int py_winspool_AsyncAddPrintProcessor_in_set_pPathName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPathName"); return -1; } object->in.pPathName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPathName); if (object->in.pPathName == 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.pPathName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncAddPrintProcessor_in_get_pPrintProcessorName(PyObject *obj, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_pPrintProcessorName; if (object->in.pPrintProcessorName == NULL) { Py_RETURN_NONE; } if (object->in.pPrintProcessorName == NULL) { py_pPrintProcessorName = Py_None; Py_INCREF(py_pPrintProcessorName); } else { py_pPrintProcessorName = PyUnicode_Decode(object->in.pPrintProcessorName, strlen(object->in.pPrintProcessorName), "utf-8", "ignore"); } return py_pPrintProcessorName; } static int py_winspool_AsyncAddPrintProcessor_in_set_pPrintProcessorName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintProcessorName"); return -1; } object->in.pPrintProcessorName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrintProcessorName); if (object->in.pPrintProcessorName == 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.pPrintProcessorName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncAddPrintProcessor_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddPrintProcessor_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)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_winspool_AsyncAddPrintProcessor_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncAddPrintProcessor_in_get_pName, .set = py_winspool_AsyncAddPrintProcessor_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncAddPrintProcessor_in_get_pEnvironment, .set = py_winspool_AsyncAddPrintProcessor_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPathName"), .get = py_winspool_AsyncAddPrintProcessor_in_get_pPathName, .set = py_winspool_AsyncAddPrintProcessor_in_set_pPathName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrintProcessorName"), .get = py_winspool_AsyncAddPrintProcessor_in_get_pPrintProcessorName, .set = py_winspool_AsyncAddPrintProcessor_in_set_pPrintProcessorName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddPrintProcessor_get_result, .set = py_winspool_AsyncAddPrintProcessor_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddPrintProcessor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddPrintProcessor, type); return self; } static PyObject *py_winspool_AsyncAddPrintProcessor_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(44); } static PyObject *py_winspool_AsyncAddPrintProcessor_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 45) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrintProcessor_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[44]; 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_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPrintProcessor_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 winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 45) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrintProcessor_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[44]; 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_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPrintProcessor_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPrintProcessor *object = (struct winspool_AsyncAddPrintProcessor *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 45) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPrintProcessor_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[44]; 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_winspool_AsyncAddPrintProcessor_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPrintProcessor_ndr_print(py_obj, "winspool_AsyncAddPrintProcessor_in", NDR_IN); } static PyObject *py_winspool_AsyncAddPrintProcessor_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPrintProcessor_ndr_print(py_obj, "winspool_AsyncAddPrintProcessor_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddPrintProcessor_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddPrintProcessor_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddPrintProcessor.opnum() -> 44 (0x2c) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_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_winspool_AsyncAddPrintProcessor_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddPrintProcessor_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddPrintProcessor_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddPrintProcessor", .tp_getset = py_winspool_AsyncAddPrintProcessor_getsetters, .tp_methods = py_winspool_AsyncAddPrintProcessor_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddPrintProcessor_new, }; static bool pack_py_winspool_AsyncAddPrintProcessor_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddPrintProcessor *r) { PyObject *py_pName; PyObject *py_pEnvironment; PyObject *py_pPathName; PyObject *py_pPrintProcessorName; const char *kwnames[] = { "pName", "pEnvironment", "pPathName", "pPrintProcessorName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncAddPrintProcessor", discard_const_p(char *, kwnames), &py_pName, &py_pEnvironment, &py_pPathName, &py_pPrintProcessorName)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } r->in.pEnvironment = talloc_ptrtype(r, r->in.pEnvironment); if (r->in.pEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } if (py_pPathName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPathName"); return false; } r->in.pPathName = talloc_ptrtype(r, r->in.pPathName); if (r->in.pPathName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPathName)) { unicode = PyUnicode_AsEncodedString(py_pPathName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPathName)) { test_str = PyBytes_AS_STRING(py_pPathName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPathName)->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.pPathName = talloc_str; } if (py_pPrintProcessorName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintProcessorName"); return false; } r->in.pPrintProcessorName = talloc_ptrtype(r, r->in.pPrintProcessorName); if (r->in.pPrintProcessorName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPrintProcessorName)) { unicode = PyUnicode_AsEncodedString(py_pPrintProcessorName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPrintProcessorName)) { test_str = PyBytes_AS_STRING(py_pPrintProcessorName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPrintProcessorName)->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.pPrintProcessorName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncAddPrintProcessor_args_out(struct winspool_AsyncAddPrintProcessor *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_winspool_AsyncEnumPrintProcessors_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncEnumPrintProcessors_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } } return py_pEnvironment; } static int py_winspool_AsyncEnumPrintProcessors_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } if (value == Py_None) { object->in.pEnvironment = NULL; } else { object->in.pEnvironment = 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.pEnvironment = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumPrintProcessors_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_in_get_pPrintProcessorInfo(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_pPrintProcessorInfo; if (object->in.pPrintProcessorInfo == NULL) { Py_RETURN_NONE; } if (object->in.pPrintProcessorInfo == NULL) { py_pPrintProcessorInfo = Py_None; Py_INCREF(py_pPrintProcessorInfo); } else { py_pPrintProcessorInfo = PyList_New(object->in.cbBuf); if (py_pPrintProcessorInfo == NULL) { return NULL; } { int pPrintProcessorInfo_cntr_1; for (pPrintProcessorInfo_cntr_1 = 0; pPrintProcessorInfo_cntr_1 < (object->in.cbBuf); pPrintProcessorInfo_cntr_1++) { PyObject *py_pPrintProcessorInfo_1; py_pPrintProcessorInfo_1 = PyLong_FromLong((uint16_t)object->in.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1]); PyList_SetItem(py_pPrintProcessorInfo, pPrintProcessorInfo_cntr_1, py_pPrintProcessorInfo_1); } } } return py_pPrintProcessorInfo; } static int py_winspool_AsyncEnumPrintProcessors_in_set_pPrintProcessorInfo(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPrintProcessorInfo)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintProcessorInfo"); return -1; } if (value == Py_None) { object->in.pPrintProcessorInfo = NULL; } else { object->in.pPrintProcessorInfo = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrintProcessorInfo_cntr_1; object->in.pPrintProcessorInfo = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrintProcessorInfo, PyList_GET_SIZE(value)); if (!object->in.pPrintProcessorInfo) { return -1;; } talloc_set_name_const(object->in.pPrintProcessorInfo, "ARRAY: object->in.pPrintProcessorInfo"); for (pPrintProcessorInfo_cntr_1 = 0; pPrintProcessorInfo_cntr_1 < PyList_GET_SIZE(value); pPrintProcessorInfo_cntr_1++) { if (PyList_GET_ITEM(value, pPrintProcessorInfo_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrintProcessorInfo_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrintProcessorInfo_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->in.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_out_get_pPrintProcessorInfo(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_pPrintProcessorInfo; if (object->out.pPrintProcessorInfo == NULL) { Py_RETURN_NONE; } if (object->out.pPrintProcessorInfo == NULL) { py_pPrintProcessorInfo = Py_None; Py_INCREF(py_pPrintProcessorInfo); } else { py_pPrintProcessorInfo = PyList_New(object->in.cbBuf); if (py_pPrintProcessorInfo == NULL) { return NULL; } { int pPrintProcessorInfo_cntr_1; for (pPrintProcessorInfo_cntr_1 = 0; pPrintProcessorInfo_cntr_1 < (object->in.cbBuf); pPrintProcessorInfo_cntr_1++) { PyObject *py_pPrintProcessorInfo_1; py_pPrintProcessorInfo_1 = PyLong_FromLong((uint16_t)object->out.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1]); PyList_SetItem(py_pPrintProcessorInfo, pPrintProcessorInfo_cntr_1, py_pPrintProcessorInfo_1); } } } return py_pPrintProcessorInfo; } static int py_winspool_AsyncEnumPrintProcessors_out_set_pPrintProcessorInfo(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pPrintProcessorInfo)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrintProcessorInfo"); return -1; } if (value == Py_None) { object->out.pPrintProcessorInfo = NULL; } else { object->out.pPrintProcessorInfo = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrintProcessorInfo_cntr_1; object->out.pPrintProcessorInfo = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pPrintProcessorInfo, PyList_GET_SIZE(value)); if (!object->out.pPrintProcessorInfo) { return -1;; } talloc_set_name_const(object->out.pPrintProcessorInfo, "ARRAY: object->out.pPrintProcessorInfo"); for (pPrintProcessorInfo_cntr_1 = 0; pPrintProcessorInfo_cntr_1 < PyList_GET_SIZE(value); pPrintProcessorInfo_cntr_1++) { if (PyList_GET_ITEM(value, pPrintProcessorInfo_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrintProcessorInfo_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrintProcessorInfo_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.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumPrintProcessors_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumPrintProcessors_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumPrintProcessors_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessors_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPrintProcessors_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)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_winspool_AsyncEnumPrintProcessors_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncEnumPrintProcessors_in_get_pName, .set = py_winspool_AsyncEnumPrintProcessors_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncEnumPrintProcessors_in_get_pEnvironment, .set = py_winspool_AsyncEnumPrintProcessors_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumPrintProcessors_in_get_Level, .set = py_winspool_AsyncEnumPrintProcessors_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pPrintProcessorInfo"), .get = py_winspool_AsyncEnumPrintProcessors_in_get_pPrintProcessorInfo, .set = py_winspool_AsyncEnumPrintProcessors_in_set_pPrintProcessorInfo, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pPrintProcessorInfo"), .get = py_winspool_AsyncEnumPrintProcessors_out_get_pPrintProcessorInfo, .set = py_winspool_AsyncEnumPrintProcessors_out_set_pPrintProcessorInfo, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumPrintProcessors_in_get_cbBuf, .set = py_winspool_AsyncEnumPrintProcessors_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumPrintProcessors_out_get_pcbNeeded, .set = py_winspool_AsyncEnumPrintProcessors_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumPrintProcessors_out_get_pcReturned, .set = py_winspool_AsyncEnumPrintProcessors_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPrintProcessors_get_result, .set = py_winspool_AsyncEnumPrintProcessors_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPrintProcessors_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPrintProcessors, type); struct winspool_AsyncEnumPrintProcessors *_self = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPrintProcessors_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(45); } static PyObject *py_winspool_AsyncEnumPrintProcessors_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 46) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrintProcessors_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[45]; 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_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrintProcessors_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 winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 46) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrintProcessors_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[45]; 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_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrintProcessors_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrintProcessors *object = (struct winspool_AsyncEnumPrintProcessors *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 46) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrintProcessors_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[45]; 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_winspool_AsyncEnumPrintProcessors_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrintProcessors_ndr_print(py_obj, "winspool_AsyncEnumPrintProcessors_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPrintProcessors_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrintProcessors_ndr_print(py_obj, "winspool_AsyncEnumPrintProcessors_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPrintProcessors_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPrintProcessors_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPrintProcessors.opnum() -> 45 (0x2d) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_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_winspool_AsyncEnumPrintProcessors_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPrintProcessors_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPrintProcessors_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPrintProcessors", .tp_getset = py_winspool_AsyncEnumPrintProcessors_getsetters, .tp_methods = py_winspool_AsyncEnumPrintProcessors_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPrintProcessors_new, }; static bool pack_py_winspool_AsyncEnumPrintProcessors_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPrintProcessors *r) { PyObject *py_pName; PyObject *py_pEnvironment; PyObject *py_Level; PyObject *py_pPrintProcessorInfo; const char *kwnames[] = { "pName", "pEnvironment", "Level", "pPrintProcessorInfo", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncEnumPrintProcessors", discard_const_p(char *, kwnames), &py_pName, &py_pEnvironment, &py_Level, &py_pPrintProcessorInfo)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } if (py_pEnvironment == Py_None) { r->in.pEnvironment = NULL; } else { r->in.pEnvironment = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pPrintProcessorInfo == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintProcessorInfo"); return false; } if (py_pPrintProcessorInfo == Py_None) { r->in.pPrintProcessorInfo = NULL; } else { r->in.pPrintProcessorInfo = NULL; PY_CHECK_TYPE(&PyList_Type, py_pPrintProcessorInfo, return false;); { int pPrintProcessorInfo_cntr_1; r->in.pPrintProcessorInfo = talloc_array_ptrtype(r, r->in.pPrintProcessorInfo, PyList_GET_SIZE(py_pPrintProcessorInfo)); if (!r->in.pPrintProcessorInfo) { return false;; } talloc_set_name_const(r->in.pPrintProcessorInfo, "ARRAY: r->in.pPrintProcessorInfo"); for (pPrintProcessorInfo_cntr_1 = 0; pPrintProcessorInfo_cntr_1 < PyList_GET_SIZE(py_pPrintProcessorInfo); pPrintProcessorInfo_cntr_1++) { if (PyList_GET_ITEM(py_pPrintProcessorInfo, pPrintProcessorInfo_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pPrintProcessorInfo, pPrintProcessorInfo_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pPrintProcessorInfo, pPrintProcessorInfo_cntr_1)); 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.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pPrintProcessorInfo, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pPrintProcessorInfo); return true; } static PyObject *unpack_py_winspool_AsyncEnumPrintProcessors_args_out(struct winspool_AsyncEnumPrintProcessors *r) { PyObject *result; PyObject *py_pPrintProcessorInfo; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pPrintProcessorInfo == NULL) { py_pPrintProcessorInfo = Py_None; Py_INCREF(py_pPrintProcessorInfo); } else { py_pPrintProcessorInfo = PyList_New(r->in.cbBuf); if (py_pPrintProcessorInfo == NULL) { return NULL; } { int pPrintProcessorInfo_cntr_1; for (pPrintProcessorInfo_cntr_1 = 0; pPrintProcessorInfo_cntr_1 < (r->in.cbBuf); pPrintProcessorInfo_cntr_1++) { PyObject *py_pPrintProcessorInfo_1; py_pPrintProcessorInfo_1 = PyLong_FromLong((uint16_t)r->out.pPrintProcessorInfo[pPrintProcessorInfo_cntr_1]); PyList_SetItem(py_pPrintProcessorInfo, pPrintProcessorInfo_cntr_1, py_pPrintProcessorInfo_1); } } } PyTuple_SetItem(result, 0, py_pPrintProcessorInfo); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncGetPrintProcessorDirectory_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } } return py_pEnvironment; } static int py_winspool_AsyncGetPrintProcessorDirectory_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } if (value == Py_None) { object->in.pEnvironment = NULL; } else { object->in.pEnvironment = 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.pEnvironment = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncGetPrintProcessorDirectory_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_in_get_pPrintProcessorDirectory(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_pPrintProcessorDirectory; if (object->in.pPrintProcessorDirectory == NULL) { Py_RETURN_NONE; } if (object->in.pPrintProcessorDirectory == NULL) { py_pPrintProcessorDirectory = Py_None; Py_INCREF(py_pPrintProcessorDirectory); } else { py_pPrintProcessorDirectory = PyList_New(object->in.cbBuf); if (py_pPrintProcessorDirectory == NULL) { return NULL; } { int pPrintProcessorDirectory_cntr_1; for (pPrintProcessorDirectory_cntr_1 = 0; pPrintProcessorDirectory_cntr_1 < (object->in.cbBuf); pPrintProcessorDirectory_cntr_1++) { PyObject *py_pPrintProcessorDirectory_1; py_pPrintProcessorDirectory_1 = PyLong_FromLong((uint16_t)object->in.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1]); PyList_SetItem(py_pPrintProcessorDirectory, pPrintProcessorDirectory_cntr_1, py_pPrintProcessorDirectory_1); } } } return py_pPrintProcessorDirectory; } static int py_winspool_AsyncGetPrintProcessorDirectory_in_set_pPrintProcessorDirectory(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPrintProcessorDirectory)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintProcessorDirectory"); return -1; } if (value == Py_None) { object->in.pPrintProcessorDirectory = NULL; } else { object->in.pPrintProcessorDirectory = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrintProcessorDirectory_cntr_1; object->in.pPrintProcessorDirectory = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrintProcessorDirectory, PyList_GET_SIZE(value)); if (!object->in.pPrintProcessorDirectory) { return -1;; } talloc_set_name_const(object->in.pPrintProcessorDirectory, "ARRAY: object->in.pPrintProcessorDirectory"); for (pPrintProcessorDirectory_cntr_1 = 0; pPrintProcessorDirectory_cntr_1 < PyList_GET_SIZE(value); pPrintProcessorDirectory_cntr_1++) { if (PyList_GET_ITEM(value, pPrintProcessorDirectory_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrintProcessorDirectory_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrintProcessorDirectory_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->in.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_out_get_pPrintProcessorDirectory(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_pPrintProcessorDirectory; if (object->out.pPrintProcessorDirectory == NULL) { Py_RETURN_NONE; } if (object->out.pPrintProcessorDirectory == NULL) { py_pPrintProcessorDirectory = Py_None; Py_INCREF(py_pPrintProcessorDirectory); } else { py_pPrintProcessorDirectory = PyList_New(object->in.cbBuf); if (py_pPrintProcessorDirectory == NULL) { return NULL; } { int pPrintProcessorDirectory_cntr_1; for (pPrintProcessorDirectory_cntr_1 = 0; pPrintProcessorDirectory_cntr_1 < (object->in.cbBuf); pPrintProcessorDirectory_cntr_1++) { PyObject *py_pPrintProcessorDirectory_1; py_pPrintProcessorDirectory_1 = PyLong_FromLong((uint16_t)object->out.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1]); PyList_SetItem(py_pPrintProcessorDirectory, pPrintProcessorDirectory_cntr_1, py_pPrintProcessorDirectory_1); } } } return py_pPrintProcessorDirectory; } static int py_winspool_AsyncGetPrintProcessorDirectory_out_set_pPrintProcessorDirectory(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pPrintProcessorDirectory)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrintProcessorDirectory"); return -1; } if (value == Py_None) { object->out.pPrintProcessorDirectory = NULL; } else { object->out.pPrintProcessorDirectory = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrintProcessorDirectory_cntr_1; object->out.pPrintProcessorDirectory = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pPrintProcessorDirectory, PyList_GET_SIZE(value)); if (!object->out.pPrintProcessorDirectory) { return -1;; } talloc_set_name_const(object->out.pPrintProcessorDirectory, "ARRAY: object->out.pPrintProcessorDirectory"); for (pPrintProcessorDirectory_cntr_1 = 0; pPrintProcessorDirectory_cntr_1 < PyList_GET_SIZE(value); pPrintProcessorDirectory_cntr_1++) { if (PyList_GET_ITEM(value, pPrintProcessorDirectory_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrintProcessorDirectory_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrintProcessorDirectory_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.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncGetPrintProcessorDirectory_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncGetPrintProcessorDirectory_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetPrintProcessorDirectory_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)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_winspool_AsyncGetPrintProcessorDirectory_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncGetPrintProcessorDirectory_in_get_pName, .set = py_winspool_AsyncGetPrintProcessorDirectory_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncGetPrintProcessorDirectory_in_get_pEnvironment, .set = py_winspool_AsyncGetPrintProcessorDirectory_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncGetPrintProcessorDirectory_in_get_Level, .set = py_winspool_AsyncGetPrintProcessorDirectory_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pPrintProcessorDirectory"), .get = py_winspool_AsyncGetPrintProcessorDirectory_in_get_pPrintProcessorDirectory, .set = py_winspool_AsyncGetPrintProcessorDirectory_in_set_pPrintProcessorDirectory, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pPrintProcessorDirectory"), .get = py_winspool_AsyncGetPrintProcessorDirectory_out_get_pPrintProcessorDirectory, .set = py_winspool_AsyncGetPrintProcessorDirectory_out_set_pPrintProcessorDirectory, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncGetPrintProcessorDirectory_in_get_cbBuf, .set = py_winspool_AsyncGetPrintProcessorDirectory_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncGetPrintProcessorDirectory_out_get_pcbNeeded, .set = py_winspool_AsyncGetPrintProcessorDirectory_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetPrintProcessorDirectory_get_result, .set = py_winspool_AsyncGetPrintProcessorDirectory_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetPrintProcessorDirectory, type); struct winspool_AsyncGetPrintProcessorDirectory *_self = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(46); } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 47) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrintProcessorDirectory_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[46]; 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_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_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 winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 47) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrintProcessorDirectory_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[46]; 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_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrintProcessorDirectory *object = (struct winspool_AsyncGetPrintProcessorDirectory *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 47) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrintProcessorDirectory_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[46]; 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_winspool_AsyncGetPrintProcessorDirectory_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrintProcessorDirectory_ndr_print(py_obj, "winspool_AsyncGetPrintProcessorDirectory_in", NDR_IN); } static PyObject *py_winspool_AsyncGetPrintProcessorDirectory_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrintProcessorDirectory_ndr_print(py_obj, "winspool_AsyncGetPrintProcessorDirectory_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetPrintProcessorDirectory_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetPrintProcessorDirectory_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetPrintProcessorDirectory.opnum() -> 46 (0x2e) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_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_winspool_AsyncGetPrintProcessorDirectory_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetPrintProcessorDirectory_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetPrintProcessorDirectory_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetPrintProcessorDirectory", .tp_getset = py_winspool_AsyncGetPrintProcessorDirectory_getsetters, .tp_methods = py_winspool_AsyncGetPrintProcessorDirectory_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetPrintProcessorDirectory_new, }; static bool pack_py_winspool_AsyncGetPrintProcessorDirectory_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetPrintProcessorDirectory *r) { PyObject *py_pName; PyObject *py_pEnvironment; PyObject *py_Level; PyObject *py_pPrintProcessorDirectory; const char *kwnames[] = { "pName", "pEnvironment", "Level", "pPrintProcessorDirectory", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncGetPrintProcessorDirectory", discard_const_p(char *, kwnames), &py_pName, &py_pEnvironment, &py_Level, &py_pPrintProcessorDirectory)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } if (py_pEnvironment == Py_None) { r->in.pEnvironment = NULL; } else { r->in.pEnvironment = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pPrintProcessorDirectory == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintProcessorDirectory"); return false; } if (py_pPrintProcessorDirectory == Py_None) { r->in.pPrintProcessorDirectory = NULL; } else { r->in.pPrintProcessorDirectory = NULL; PY_CHECK_TYPE(&PyList_Type, py_pPrintProcessorDirectory, return false;); { int pPrintProcessorDirectory_cntr_1; r->in.pPrintProcessorDirectory = talloc_array_ptrtype(r, r->in.pPrintProcessorDirectory, PyList_GET_SIZE(py_pPrintProcessorDirectory)); if (!r->in.pPrintProcessorDirectory) { return false;; } talloc_set_name_const(r->in.pPrintProcessorDirectory, "ARRAY: r->in.pPrintProcessorDirectory"); for (pPrintProcessorDirectory_cntr_1 = 0; pPrintProcessorDirectory_cntr_1 < PyList_GET_SIZE(py_pPrintProcessorDirectory); pPrintProcessorDirectory_cntr_1++) { if (PyList_GET_ITEM(py_pPrintProcessorDirectory, pPrintProcessorDirectory_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pPrintProcessorDirectory, pPrintProcessorDirectory_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pPrintProcessorDirectory, pPrintProcessorDirectory_cntr_1)); 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.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pPrintProcessorDirectory, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pPrintProcessorDirectory); return true; } static PyObject *unpack_py_winspool_AsyncGetPrintProcessorDirectory_args_out(struct winspool_AsyncGetPrintProcessorDirectory *r) { PyObject *result; PyObject *py_pPrintProcessorDirectory; PyObject *py_pcbNeeded; result = PyTuple_New(2); if (r->out.pPrintProcessorDirectory == NULL) { py_pPrintProcessorDirectory = Py_None; Py_INCREF(py_pPrintProcessorDirectory); } else { py_pPrintProcessorDirectory = PyList_New(r->in.cbBuf); if (py_pPrintProcessorDirectory == NULL) { return NULL; } { int pPrintProcessorDirectory_cntr_1; for (pPrintProcessorDirectory_cntr_1 = 0; pPrintProcessorDirectory_cntr_1 < (r->in.cbBuf); pPrintProcessorDirectory_cntr_1++) { PyObject *py_pPrintProcessorDirectory_1; py_pPrintProcessorDirectory_1 = PyLong_FromLong((uint16_t)r->out.pPrintProcessorDirectory[pPrintProcessorDirectory_cntr_1]); PyList_SetItem(py_pPrintProcessorDirectory, pPrintProcessorDirectory_cntr_1, py_pPrintProcessorDirectory_1); } } } PyTuple_SetItem(result, 0, py_pPrintProcessorDirectory); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEnumPorts_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncEnumPorts_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPorts_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumPorts_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPorts_in_get_pPort(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_pPort; if (object->in.pPort == NULL) { Py_RETURN_NONE; } if (object->in.pPort == NULL) { py_pPort = Py_None; Py_INCREF(py_pPort); } else { py_pPort = PyList_New(object->in.cbBuf); if (py_pPort == NULL) { return NULL; } { int pPort_cntr_1; for (pPort_cntr_1 = 0; pPort_cntr_1 < (object->in.cbBuf); pPort_cntr_1++) { PyObject *py_pPort_1; py_pPort_1 = PyLong_FromLong((uint16_t)object->in.pPort[pPort_cntr_1]); PyList_SetItem(py_pPort, pPort_cntr_1, py_pPort_1); } } } return py_pPort; } static int py_winspool_AsyncEnumPorts_in_set_pPort(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPort)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPort"); return -1; } if (value == Py_None) { object->in.pPort = NULL; } else { object->in.pPort = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPort_cntr_1; object->in.pPort = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPort, PyList_GET_SIZE(value)); if (!object->in.pPort) { return -1;; } talloc_set_name_const(object->in.pPort, "ARRAY: object->in.pPort"); for (pPort_cntr_1 = 0; pPort_cntr_1 < PyList_GET_SIZE(value); pPort_cntr_1++) { if (PyList_GET_ITEM(value, pPort_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPort[pPort_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pPort[pPort_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPort_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPort_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->in.pPort[pPort_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPorts_out_get_pPort(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_pPort; if (object->out.pPort == NULL) { Py_RETURN_NONE; } if (object->out.pPort == NULL) { py_pPort = Py_None; Py_INCREF(py_pPort); } else { py_pPort = PyList_New(object->in.cbBuf); if (py_pPort == NULL) { return NULL; } { int pPort_cntr_1; for (pPort_cntr_1 = 0; pPort_cntr_1 < (object->in.cbBuf); pPort_cntr_1++) { PyObject *py_pPort_1; py_pPort_1 = PyLong_FromLong((uint16_t)object->out.pPort[pPort_cntr_1]); PyList_SetItem(py_pPort, pPort_cntr_1, py_pPort_1); } } } return py_pPort; } static int py_winspool_AsyncEnumPorts_out_set_pPort(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pPort)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPort"); return -1; } if (value == Py_None) { object->out.pPort = NULL; } else { object->out.pPort = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPort_cntr_1; object->out.pPort = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pPort, PyList_GET_SIZE(value)); if (!object->out.pPort) { return -1;; } talloc_set_name_const(object->out.pPort, "ARRAY: object->out.pPort"); for (pPort_cntr_1 = 0; pPort_cntr_1 < PyList_GET_SIZE(value); pPort_cntr_1++) { if (PyList_GET_ITEM(value, pPort_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPort[pPort_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pPort[pPort_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPort_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPort_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.pPort[pPort_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPorts_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumPorts_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPorts_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumPorts_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPorts_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumPorts_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPorts_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPorts_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)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_winspool_AsyncEnumPorts_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncEnumPorts_in_get_pName, .set = py_winspool_AsyncEnumPorts_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumPorts_in_get_Level, .set = py_winspool_AsyncEnumPorts_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pPort"), .get = py_winspool_AsyncEnumPorts_in_get_pPort, .set = py_winspool_AsyncEnumPorts_in_set_pPort, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pPort"), .get = py_winspool_AsyncEnumPorts_out_get_pPort, .set = py_winspool_AsyncEnumPorts_out_set_pPort, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumPorts_in_get_cbBuf, .set = py_winspool_AsyncEnumPorts_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumPorts_out_get_pcbNeeded, .set = py_winspool_AsyncEnumPorts_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumPorts_out_get_pcReturned, .set = py_winspool_AsyncEnumPorts_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPorts_get_result, .set = py_winspool_AsyncEnumPorts_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPorts_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPorts, type); struct winspool_AsyncEnumPorts *_self = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPorts_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(47); } static PyObject *py_winspool_AsyncEnumPorts_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 48) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPorts_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[47]; 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_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPorts_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 winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 48) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPorts_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[47]; 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_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPorts_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPorts *object = (struct winspool_AsyncEnumPorts *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 48) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPorts_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[47]; 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_winspool_AsyncEnumPorts_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPorts_ndr_print(py_obj, "winspool_AsyncEnumPorts_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPorts_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPorts_ndr_print(py_obj, "winspool_AsyncEnumPorts_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPorts_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPorts_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPorts.opnum() -> 47 (0x2f) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_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_winspool_AsyncEnumPorts_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPorts_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPorts_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPorts", .tp_getset = py_winspool_AsyncEnumPorts_getsetters, .tp_methods = py_winspool_AsyncEnumPorts_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPorts_new, }; static bool pack_py_winspool_AsyncEnumPorts_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPorts *r) { PyObject *py_pName; PyObject *py_Level; PyObject *py_pPort; const char *kwnames[] = { "pName", "Level", "pPort", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncEnumPorts", discard_const_p(char *, kwnames), &py_pName, &py_Level, &py_pPort)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pPort == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPort"); return false; } if (py_pPort == Py_None) { r->in.pPort = NULL; } else { r->in.pPort = NULL; PY_CHECK_TYPE(&PyList_Type, py_pPort, return false;); { int pPort_cntr_1; r->in.pPort = talloc_array_ptrtype(r, r->in.pPort, PyList_GET_SIZE(py_pPort)); if (!r->in.pPort) { return false;; } talloc_set_name_const(r->in.pPort, "ARRAY: r->in.pPort"); for (pPort_cntr_1 = 0; pPort_cntr_1 < PyList_GET_SIZE(py_pPort); pPort_cntr_1++) { if (PyList_GET_ITEM(py_pPort, pPort_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPort[pPort_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pPort[pPort_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pPort, pPort_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pPort, pPort_cntr_1)); 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.pPort[pPort_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pPort, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pPort); return true; } static PyObject *unpack_py_winspool_AsyncEnumPorts_args_out(struct winspool_AsyncEnumPorts *r) { PyObject *result; PyObject *py_pPort; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pPort == NULL) { py_pPort = Py_None; Py_INCREF(py_pPort); } else { py_pPort = PyList_New(r->in.cbBuf); if (py_pPort == NULL) { return NULL; } { int pPort_cntr_1; for (pPort_cntr_1 = 0; pPort_cntr_1 < (r->in.cbBuf); pPort_cntr_1++) { PyObject *py_pPort_1; py_pPort_1 = PyLong_FromLong((uint16_t)r->out.pPort[pPort_cntr_1]); PyList_SetItem(py_pPort, pPort_cntr_1, py_pPort_1); } } } PyTuple_SetItem(result, 0, py_pPort); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncEnumMonitors_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncEnumMonitors_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumMonitors_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumMonitors_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumMonitors_in_get_pMonitor(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_pMonitor; if (object->in.pMonitor == NULL) { Py_RETURN_NONE; } if (object->in.pMonitor == NULL) { py_pMonitor = Py_None; Py_INCREF(py_pMonitor); } else { py_pMonitor = PyList_New(object->in.cbBuf); if (py_pMonitor == NULL) { return NULL; } { int pMonitor_cntr_1; for (pMonitor_cntr_1 = 0; pMonitor_cntr_1 < (object->in.cbBuf); pMonitor_cntr_1++) { PyObject *py_pMonitor_1; py_pMonitor_1 = PyLong_FromLong((uint16_t)object->in.pMonitor[pMonitor_cntr_1]); PyList_SetItem(py_pMonitor, pMonitor_cntr_1, py_pMonitor_1); } } } return py_pMonitor; } static int py_winspool_AsyncEnumMonitors_in_set_pMonitor(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pMonitor)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pMonitor"); return -1; } if (value == Py_None) { object->in.pMonitor = NULL; } else { object->in.pMonitor = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pMonitor_cntr_1; object->in.pMonitor = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pMonitor, PyList_GET_SIZE(value)); if (!object->in.pMonitor) { return -1;; } talloc_set_name_const(object->in.pMonitor, "ARRAY: object->in.pMonitor"); for (pMonitor_cntr_1 = 0; pMonitor_cntr_1 < PyList_GET_SIZE(value); pMonitor_cntr_1++) { if (PyList_GET_ITEM(value, pMonitor_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pMonitor[pMonitor_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pMonitor[pMonitor_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pMonitor_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pMonitor_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->in.pMonitor[pMonitor_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumMonitors_out_get_pMonitor(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_pMonitor; if (object->out.pMonitor == NULL) { Py_RETURN_NONE; } if (object->out.pMonitor == NULL) { py_pMonitor = Py_None; Py_INCREF(py_pMonitor); } else { py_pMonitor = PyList_New(object->in.cbBuf); if (py_pMonitor == NULL) { return NULL; } { int pMonitor_cntr_1; for (pMonitor_cntr_1 = 0; pMonitor_cntr_1 < (object->in.cbBuf); pMonitor_cntr_1++) { PyObject *py_pMonitor_1; py_pMonitor_1 = PyLong_FromLong((uint16_t)object->out.pMonitor[pMonitor_cntr_1]); PyList_SetItem(py_pMonitor, pMonitor_cntr_1, py_pMonitor_1); } } } return py_pMonitor; } static int py_winspool_AsyncEnumMonitors_out_set_pMonitor(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pMonitor)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pMonitor"); return -1; } if (value == Py_None) { object->out.pMonitor = NULL; } else { object->out.pMonitor = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pMonitor_cntr_1; object->out.pMonitor = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pMonitor, PyList_GET_SIZE(value)); if (!object->out.pMonitor) { return -1;; } talloc_set_name_const(object->out.pMonitor, "ARRAY: object->out.pMonitor"); for (pMonitor_cntr_1 = 0; pMonitor_cntr_1 < PyList_GET_SIZE(value); pMonitor_cntr_1++) { if (PyList_GET_ITEM(value, pMonitor_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pMonitor[pMonitor_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pMonitor[pMonitor_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pMonitor_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pMonitor_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.pMonitor[pMonitor_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumMonitors_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumMonitors_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumMonitors_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumMonitors_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumMonitors_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumMonitors_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumMonitors_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumMonitors_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)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_winspool_AsyncEnumMonitors_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncEnumMonitors_in_get_pName, .set = py_winspool_AsyncEnumMonitors_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumMonitors_in_get_Level, .set = py_winspool_AsyncEnumMonitors_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pMonitor"), .get = py_winspool_AsyncEnumMonitors_in_get_pMonitor, .set = py_winspool_AsyncEnumMonitors_in_set_pMonitor, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pMonitor"), .get = py_winspool_AsyncEnumMonitors_out_get_pMonitor, .set = py_winspool_AsyncEnumMonitors_out_set_pMonitor, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumMonitors_in_get_cbBuf, .set = py_winspool_AsyncEnumMonitors_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumMonitors_out_get_pcbNeeded, .set = py_winspool_AsyncEnumMonitors_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumMonitors_out_get_pcReturned, .set = py_winspool_AsyncEnumMonitors_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumMonitors_get_result, .set = py_winspool_AsyncEnumMonitors_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumMonitors_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumMonitors, type); struct winspool_AsyncEnumMonitors *_self = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumMonitors_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(48); } static PyObject *py_winspool_AsyncEnumMonitors_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 49) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumMonitors_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[48]; 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_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumMonitors_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 winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 49) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumMonitors_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[48]; 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_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumMonitors_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumMonitors *object = (struct winspool_AsyncEnumMonitors *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 49) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumMonitors_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[48]; 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_winspool_AsyncEnumMonitors_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumMonitors_ndr_print(py_obj, "winspool_AsyncEnumMonitors_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumMonitors_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumMonitors_ndr_print(py_obj, "winspool_AsyncEnumMonitors_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumMonitors_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumMonitors_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumMonitors.opnum() -> 48 (0x30) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_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_winspool_AsyncEnumMonitors_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumMonitors_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumMonitors_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumMonitors", .tp_getset = py_winspool_AsyncEnumMonitors_getsetters, .tp_methods = py_winspool_AsyncEnumMonitors_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumMonitors_new, }; static bool pack_py_winspool_AsyncEnumMonitors_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumMonitors *r) { PyObject *py_pName; PyObject *py_Level; PyObject *py_pMonitor; const char *kwnames[] = { "pName", "Level", "pMonitor", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncEnumMonitors", discard_const_p(char *, kwnames), &py_pName, &py_Level, &py_pMonitor)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pMonitor == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pMonitor"); return false; } if (py_pMonitor == Py_None) { r->in.pMonitor = NULL; } else { r->in.pMonitor = NULL; PY_CHECK_TYPE(&PyList_Type, py_pMonitor, return false;); { int pMonitor_cntr_1; r->in.pMonitor = talloc_array_ptrtype(r, r->in.pMonitor, PyList_GET_SIZE(py_pMonitor)); if (!r->in.pMonitor) { return false;; } talloc_set_name_const(r->in.pMonitor, "ARRAY: r->in.pMonitor"); for (pMonitor_cntr_1 = 0; pMonitor_cntr_1 < PyList_GET_SIZE(py_pMonitor); pMonitor_cntr_1++) { if (PyList_GET_ITEM(py_pMonitor, pMonitor_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pMonitor[pMonitor_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pMonitor[pMonitor_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pMonitor, pMonitor_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pMonitor, pMonitor_cntr_1)); 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.pMonitor[pMonitor_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pMonitor, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pMonitor); return true; } static PyObject *unpack_py_winspool_AsyncEnumMonitors_args_out(struct winspool_AsyncEnumMonitors *r) { PyObject *result; PyObject *py_pMonitor; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pMonitor == NULL) { py_pMonitor = Py_None; Py_INCREF(py_pMonitor); } else { py_pMonitor = PyList_New(r->in.cbBuf); if (py_pMonitor == NULL) { return NULL; } { int pMonitor_cntr_1; for (pMonitor_cntr_1 = 0; pMonitor_cntr_1 < (r->in.cbBuf); pMonitor_cntr_1++) { PyObject *py_pMonitor_1; py_pMonitor_1 = PyLong_FromLong((uint16_t)r->out.pMonitor[pMonitor_cntr_1]); PyList_SetItem(py_pMonitor, pMonitor_cntr_1, py_pMonitor_1); } } } PyTuple_SetItem(result, 0, py_pMonitor); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncAddPort_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncAddPort_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncAddPort_in_get_pPortContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(obj); PyObject *py_pPortContainer; if (object->in.pPortContainer == NULL) { Py_RETURN_NONE; } py_pPortContainer = pytalloc_reference_ex(spoolss_SetPortInfoContainer_Type, object->in.pPortContainer, object->in.pPortContainer); return py_pPortContainer; } static int py_winspool_AsyncAddPort_in_set_pPortContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPortContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPortContainer"); return -1; } object->in.pPortContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPortContainer); if (object->in.pPortContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_SetPortInfoContainer_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.pPortContainer = (struct spoolss_SetPortInfoContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPort_in_get_pPortVarContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(obj); PyObject *py_pPortVarContainer; if (object->in.pPortVarContainer == NULL) { Py_RETURN_NONE; } py_pPortVarContainer = pytalloc_reference_ex(spoolss_PortVarContainer_Type, object->in.pPortVarContainer, object->in.pPortVarContainer); return py_pPortVarContainer; } static int py_winspool_AsyncAddPort_in_set_pPortVarContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPortVarContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPortVarContainer"); return -1; } object->in.pPortVarContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPortVarContainer); if (object->in.pPortVarContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_PortVarContainer_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.pPortVarContainer = (struct spoolss_PortVarContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddPort_in_get_pMonitorName(PyObject *obj, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(obj); PyObject *py_pMonitorName; if (object->in.pMonitorName == NULL) { Py_RETURN_NONE; } if (object->in.pMonitorName == NULL) { py_pMonitorName = Py_None; Py_INCREF(py_pMonitorName); } else { py_pMonitorName = PyUnicode_Decode(object->in.pMonitorName, strlen(object->in.pMonitorName), "utf-8", "ignore"); } return py_pMonitorName; } static int py_winspool_AsyncAddPort_in_set_pMonitorName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pMonitorName"); return -1; } object->in.pMonitorName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pMonitorName); if (object->in.pMonitorName == 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.pMonitorName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncAddPort_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddPort_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)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_winspool_AsyncAddPort_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncAddPort_in_get_pName, .set = py_winspool_AsyncAddPort_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPortContainer"), .get = py_winspool_AsyncAddPort_in_get_pPortContainer, .set = py_winspool_AsyncAddPort_in_set_pPortContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_SetPortInfoContainer") }, { .name = discard_const_p(char, "in_pPortVarContainer"), .get = py_winspool_AsyncAddPort_in_get_pPortVarContainer, .set = py_winspool_AsyncAddPort_in_set_pPortVarContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_PortVarContainer") }, { .name = discard_const_p(char, "in_pMonitorName"), .get = py_winspool_AsyncAddPort_in_get_pMonitorName, .set = py_winspool_AsyncAddPort_in_set_pMonitorName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddPort_get_result, .set = py_winspool_AsyncAddPort_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddPort_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddPort, type); struct winspool_AsyncAddPort *_self = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pPortContainer = talloc_zero(mem_ctx, struct spoolss_SetPortInfoContainer); _self->in.pPortVarContainer = talloc_zero(mem_ctx, struct spoolss_PortVarContainer); return self; } static PyObject *py_winspool_AsyncAddPort_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(49); } static PyObject *py_winspool_AsyncAddPort_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 50) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPort_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[49]; 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_winspool_AsyncAddPort_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_winspool_AsyncAddPort_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPort_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_winspool_AsyncAddPort_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPort_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 winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 50) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPort_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[49]; 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_winspool_AsyncAddPort_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_winspool_AsyncAddPort_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPort_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_winspool_AsyncAddPort_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPort_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPort *object = (struct winspool_AsyncAddPort *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 50) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPort_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[49]; 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_winspool_AsyncAddPort_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPort_ndr_print(py_obj, "winspool_AsyncAddPort_in", NDR_IN); } static PyObject *py_winspool_AsyncAddPort_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPort_ndr_print(py_obj, "winspool_AsyncAddPort_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddPort_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddPort_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddPort.opnum() -> 49 (0x31) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddPort_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_winspool_AsyncAddPort_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_winspool_AsyncAddPort_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_winspool_AsyncAddPort_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_winspool_AsyncAddPort_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddPort_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddPort_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddPort", .tp_getset = py_winspool_AsyncAddPort_getsetters, .tp_methods = py_winspool_AsyncAddPort_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddPort_new, }; static bool pack_py_winspool_AsyncAddPort_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddPort *r) { PyObject *py_pName; PyObject *py_pPortContainer; PyObject *py_pPortVarContainer; PyObject *py_pMonitorName; const char *kwnames[] = { "pName", "pPortContainer", "pPortVarContainer", "pMonitorName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncAddPort", discard_const_p(char *, kwnames), &py_pName, &py_pPortContainer, &py_pPortVarContainer, &py_pMonitorName)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pPortContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPortContainer"); return false; } r->in.pPortContainer = talloc_ptrtype(r, r->in.pPortContainer); if (r->in.pPortContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_SetPortInfoContainer_Type, py_pPortContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pPortContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pPortContainer = (struct spoolss_SetPortInfoContainer *)pytalloc_get_ptr(py_pPortContainer); if (py_pPortVarContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPortVarContainer"); return false; } r->in.pPortVarContainer = talloc_ptrtype(r, r->in.pPortVarContainer); if (r->in.pPortVarContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_PortVarContainer_Type, py_pPortVarContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pPortVarContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pPortVarContainer = (struct spoolss_PortVarContainer *)pytalloc_get_ptr(py_pPortVarContainer); if (py_pMonitorName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pMonitorName"); return false; } r->in.pMonitorName = talloc_ptrtype(r, r->in.pMonitorName); if (r->in.pMonitorName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pMonitorName)) { unicode = PyUnicode_AsEncodedString(py_pMonitorName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pMonitorName)) { test_str = PyBytes_AS_STRING(py_pMonitorName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pMonitorName)->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.pMonitorName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncAddPort_args_out(struct winspool_AsyncAddPort *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_winspool_AsyncSetPort_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncSetPort_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncSetPort_in_get_pPortName(PyObject *obj, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(obj); PyObject *py_pPortName; if (object->in.pPortName == NULL) { Py_RETURN_NONE; } if (object->in.pPortName == NULL) { py_pPortName = Py_None; Py_INCREF(py_pPortName); } else { if (object->in.pPortName == NULL) { py_pPortName = Py_None; Py_INCREF(py_pPortName); } else { py_pPortName = PyUnicode_Decode(object->in.pPortName, strlen(object->in.pPortName), "utf-8", "ignore"); } } return py_pPortName; } static int py_winspool_AsyncSetPort_in_set_pPortName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPortName"); return -1; } if (value == Py_None) { object->in.pPortName = NULL; } else { object->in.pPortName = 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.pPortName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncSetPort_in_get_pPortContainer(PyObject *obj, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(obj); PyObject *py_pPortContainer; if (object->in.pPortContainer == NULL) { Py_RETURN_NONE; } py_pPortContainer = pytalloc_reference_ex(spoolss_SetPortInfoContainer_Type, object->in.pPortContainer, object->in.pPortContainer); return py_pPortContainer; } static int py_winspool_AsyncSetPort_in_set_pPortContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPortContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPortContainer"); return -1; } object->in.pPortContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPortContainer); if (object->in.pPortContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_SetPortInfoContainer_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.pPortContainer = (struct spoolss_SetPortInfoContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetPort_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSetPort_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)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_winspool_AsyncSetPort_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncSetPort_in_get_pName, .set = py_winspool_AsyncSetPort_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPortName"), .get = py_winspool_AsyncSetPort_in_get_pPortName, .set = py_winspool_AsyncSetPort_in_set_pPortName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPortContainer"), .get = py_winspool_AsyncSetPort_in_get_pPortContainer, .set = py_winspool_AsyncSetPort_in_set_pPortContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_SetPortInfoContainer") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSetPort_get_result, .set = py_winspool_AsyncSetPort_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSetPort_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSetPort, type); struct winspool_AsyncSetPort *_self = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pPortContainer = talloc_zero(mem_ctx, struct spoolss_SetPortInfoContainer); return self; } static PyObject *py_winspool_AsyncSetPort_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(50); } static PyObject *py_winspool_AsyncSetPort_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 51) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPort_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[50]; 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_winspool_AsyncSetPort_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_winspool_AsyncSetPort_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPort_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_winspool_AsyncSetPort_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSetPort_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 winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 51) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPort_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[50]; 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_winspool_AsyncSetPort_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_winspool_AsyncSetPort_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPort_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_winspool_AsyncSetPort_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetPort_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetPort *object = (struct winspool_AsyncSetPort *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 51) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetPort_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[50]; 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_winspool_AsyncSetPort_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPort_ndr_print(py_obj, "winspool_AsyncSetPort_in", NDR_IN); } static PyObject *py_winspool_AsyncSetPort_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetPort_ndr_print(py_obj, "winspool_AsyncSetPort_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSetPort_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSetPort_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSetPort.opnum() -> 50 (0x32) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSetPort_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_winspool_AsyncSetPort_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_winspool_AsyncSetPort_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_winspool_AsyncSetPort_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_winspool_AsyncSetPort_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSetPort_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSetPort_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSetPort", .tp_getset = py_winspool_AsyncSetPort_getsetters, .tp_methods = py_winspool_AsyncSetPort_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSetPort_new, }; static bool pack_py_winspool_AsyncSetPort_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSetPort *r) { PyObject *py_pName; PyObject *py_pPortName; PyObject *py_pPortContainer; const char *kwnames[] = { "pName", "pPortName", "pPortContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncSetPort", discard_const_p(char *, kwnames), &py_pName, &py_pPortName, &py_pPortContainer)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pPortName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPortName"); return false; } if (py_pPortName == Py_None) { r->in.pPortName = NULL; } else { r->in.pPortName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPortName)) { unicode = PyUnicode_AsEncodedString(py_pPortName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPortName)) { test_str = PyBytes_AS_STRING(py_pPortName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPortName)->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.pPortName = talloc_str; } } if (py_pPortContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPortContainer"); return false; } r->in.pPortContainer = talloc_ptrtype(r, r->in.pPortContainer); if (r->in.pPortContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_SetPortInfoContainer_Type, py_pPortContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pPortContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pPortContainer = (struct spoolss_SetPortInfoContainer *)pytalloc_get_ptr(py_pPortContainer); return true; } static PyObject *unpack_py_winspool_AsyncSetPort_args_out(struct winspool_AsyncSetPort *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_winspool_AsyncAddMonitor_in_get_Name(PyObject *obj, void *closure) { struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(obj); PyObject *py_Name; if (object->in.Name == NULL) { Py_RETURN_NONE; } if (object->in.Name == NULL) { py_Name = Py_None; Py_INCREF(py_Name); } else { if (object->in.Name == NULL) { py_Name = Py_None; Py_INCREF(py_Name); } else { py_Name = PyUnicode_Decode(object->in.Name, strlen(object->in.Name), "utf-8", "ignore"); } } return py_Name; } static int py_winspool_AsyncAddMonitor_in_set_Name(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Name"); return -1; } if (value == Py_None) { object->in.Name = NULL; } else { object->in.Name = 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.Name = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncAddMonitor_in_get_pMonitorContainer(PyObject *obj, void *closure) { struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(obj); PyObject *py_pMonitorContainer; if (object->in.pMonitorContainer == NULL) { Py_RETURN_NONE; } py_pMonitorContainer = pytalloc_reference_ex(spoolss_MonitorContainer_Type, object->in.pMonitorContainer, object->in.pMonitorContainer); return py_pMonitorContainer; } static int py_winspool_AsyncAddMonitor_in_set_pMonitorContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pMonitorContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pMonitorContainer"); return -1; } object->in.pMonitorContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pMonitorContainer); if (object->in.pMonitorContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_MonitorContainer_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.pMonitorContainer = (struct spoolss_MonitorContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncAddMonitor_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddMonitor_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)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_winspool_AsyncAddMonitor_getsetters[] = { { .name = discard_const_p(char, "in_Name"), .get = py_winspool_AsyncAddMonitor_in_get_Name, .set = py_winspool_AsyncAddMonitor_in_set_Name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pMonitorContainer"), .get = py_winspool_AsyncAddMonitor_in_get_pMonitorContainer, .set = py_winspool_AsyncAddMonitor_in_set_pMonitorContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_MonitorContainer") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddMonitor_get_result, .set = py_winspool_AsyncAddMonitor_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddMonitor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddMonitor, type); struct winspool_AsyncAddMonitor *_self = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pMonitorContainer = talloc_zero(mem_ctx, struct spoolss_MonitorContainer); return self; } static PyObject *py_winspool_AsyncAddMonitor_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(51); } static PyObject *py_winspool_AsyncAddMonitor_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 52) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddMonitor_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[51]; 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_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddMonitor_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 winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 52) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddMonitor_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[51]; 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_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddMonitor_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddMonitor *object = (struct winspool_AsyncAddMonitor *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 52) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddMonitor_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[51]; 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_winspool_AsyncAddMonitor_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddMonitor_ndr_print(py_obj, "winspool_AsyncAddMonitor_in", NDR_IN); } static PyObject *py_winspool_AsyncAddMonitor_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddMonitor_ndr_print(py_obj, "winspool_AsyncAddMonitor_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddMonitor_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddMonitor_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddMonitor.opnum() -> 51 (0x33) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_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_winspool_AsyncAddMonitor_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddMonitor_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddMonitor_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddMonitor", .tp_getset = py_winspool_AsyncAddMonitor_getsetters, .tp_methods = py_winspool_AsyncAddMonitor_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddMonitor_new, }; static bool pack_py_winspool_AsyncAddMonitor_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddMonitor *r) { PyObject *py_Name; PyObject *py_pMonitorContainer; const char *kwnames[] = { "Name", "pMonitorContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncAddMonitor", discard_const_p(char *, kwnames), &py_Name, &py_pMonitorContainer)) { return false; } if (py_Name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Name"); return false; } if (py_Name == Py_None) { r->in.Name = NULL; } else { r->in.Name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_Name)) { unicode = PyUnicode_AsEncodedString(py_Name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_Name)) { test_str = PyBytes_AS_STRING(py_Name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_Name)->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.Name = talloc_str; } } if (py_pMonitorContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pMonitorContainer"); return false; } r->in.pMonitorContainer = talloc_ptrtype(r, r->in.pMonitorContainer); if (r->in.pMonitorContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_MonitorContainer_Type, py_pMonitorContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pMonitorContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pMonitorContainer = (struct spoolss_MonitorContainer *)pytalloc_get_ptr(py_pMonitorContainer); return true; } static PyObject *unpack_py_winspool_AsyncAddMonitor_args_out(struct winspool_AsyncAddMonitor *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_winspool_AsyncDeleteMonitor_in_get_Name(PyObject *obj, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(obj); PyObject *py_Name; if (object->in.Name == NULL) { Py_RETURN_NONE; } if (object->in.Name == NULL) { py_Name = Py_None; Py_INCREF(py_Name); } else { if (object->in.Name == NULL) { py_Name = Py_None; Py_INCREF(py_Name); } else { py_Name = PyUnicode_Decode(object->in.Name, strlen(object->in.Name), "utf-8", "ignore"); } } return py_Name; } static int py_winspool_AsyncDeleteMonitor_in_set_Name(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Name"); return -1; } if (value == Py_None) { object->in.Name = NULL; } else { object->in.Name = 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.Name = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeleteMonitor_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } } return py_pEnvironment; } static int py_winspool_AsyncDeleteMonitor_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } if (value == Py_None) { object->in.pEnvironment = NULL; } else { object->in.pEnvironment = 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.pEnvironment = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeleteMonitor_in_get_pMonitorName(PyObject *obj, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(obj); PyObject *py_pMonitorName; if (object->in.pMonitorName == NULL) { Py_RETURN_NONE; } if (object->in.pMonitorName == NULL) { py_pMonitorName = Py_None; Py_INCREF(py_pMonitorName); } else { py_pMonitorName = PyUnicode_Decode(object->in.pMonitorName, strlen(object->in.pMonitorName), "utf-8", "ignore"); } return py_pMonitorName; } static int py_winspool_AsyncDeleteMonitor_in_set_pMonitorName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pMonitorName"); return -1; } object->in.pMonitorName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pMonitorName); if (object->in.pMonitorName == 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.pMonitorName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeleteMonitor_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeleteMonitor_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)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_winspool_AsyncDeleteMonitor_getsetters[] = { { .name = discard_const_p(char, "in_Name"), .get = py_winspool_AsyncDeleteMonitor_in_get_Name, .set = py_winspool_AsyncDeleteMonitor_in_set_Name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncDeleteMonitor_in_get_pEnvironment, .set = py_winspool_AsyncDeleteMonitor_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pMonitorName"), .get = py_winspool_AsyncDeleteMonitor_in_get_pMonitorName, .set = py_winspool_AsyncDeleteMonitor_in_set_pMonitorName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeleteMonitor_get_result, .set = py_winspool_AsyncDeleteMonitor_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeleteMonitor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeleteMonitor, type); return self; } static PyObject *py_winspool_AsyncDeleteMonitor_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(52); } static PyObject *py_winspool_AsyncDeleteMonitor_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 53) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteMonitor_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[52]; 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_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeleteMonitor_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 winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 53) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteMonitor_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[52]; 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_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeleteMonitor_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeleteMonitor *object = (struct winspool_AsyncDeleteMonitor *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 53) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteMonitor_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[52]; 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_winspool_AsyncDeleteMonitor_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeleteMonitor_ndr_print(py_obj, "winspool_AsyncDeleteMonitor_in", NDR_IN); } static PyObject *py_winspool_AsyncDeleteMonitor_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeleteMonitor_ndr_print(py_obj, "winspool_AsyncDeleteMonitor_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeleteMonitor_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeleteMonitor_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeleteMonitor.opnum() -> 52 (0x34) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_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_winspool_AsyncDeleteMonitor_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeleteMonitor_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeleteMonitor_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeleteMonitor", .tp_getset = py_winspool_AsyncDeleteMonitor_getsetters, .tp_methods = py_winspool_AsyncDeleteMonitor_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeleteMonitor_new, }; static bool pack_py_winspool_AsyncDeleteMonitor_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeleteMonitor *r) { PyObject *py_Name; PyObject *py_pEnvironment; PyObject *py_pMonitorName; const char *kwnames[] = { "Name", "pEnvironment", "pMonitorName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncDeleteMonitor", discard_const_p(char *, kwnames), &py_Name, &py_pEnvironment, &py_pMonitorName)) { return false; } if (py_Name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Name"); return false; } if (py_Name == Py_None) { r->in.Name = NULL; } else { r->in.Name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_Name)) { unicode = PyUnicode_AsEncodedString(py_Name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_Name)) { test_str = PyBytes_AS_STRING(py_Name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_Name)->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.Name = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } if (py_pEnvironment == Py_None) { r->in.pEnvironment = NULL; } else { r->in.pEnvironment = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } } if (py_pMonitorName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pMonitorName"); return false; } r->in.pMonitorName = talloc_ptrtype(r, r->in.pMonitorName); if (r->in.pMonitorName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pMonitorName)) { unicode = PyUnicode_AsEncodedString(py_pMonitorName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pMonitorName)) { test_str = PyBytes_AS_STRING(py_pMonitorName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pMonitorName)->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.pMonitorName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeleteMonitor_args_out(struct winspool_AsyncDeleteMonitor *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_winspool_AsyncDeletePrintProcessor_in_get_Name(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_Name; if (object->in.Name == NULL) { Py_RETURN_NONE; } if (object->in.Name == NULL) { py_Name = Py_None; Py_INCREF(py_Name); } else { if (object->in.Name == NULL) { py_Name = Py_None; Py_INCREF(py_Name); } else { py_Name = PyUnicode_Decode(object->in.Name, strlen(object->in.Name), "utf-8", "ignore"); } } return py_Name; } static int py_winspool_AsyncDeletePrintProcessor_in_set_Name(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Name"); return -1; } if (value == Py_None) { object->in.Name = NULL; } else { object->in.Name = 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.Name = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeletePrintProcessor_in_get_pEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_pEnvironment; if (object->in.pEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { if (object->in.pEnvironment == NULL) { py_pEnvironment = Py_None; Py_INCREF(py_pEnvironment); } else { py_pEnvironment = PyUnicode_Decode(object->in.pEnvironment, strlen(object->in.pEnvironment), "utf-8", "ignore"); } } return py_pEnvironment; } static int py_winspool_AsyncDeletePrintProcessor_in_set_pEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pEnvironment"); return -1; } if (value == Py_None) { object->in.pEnvironment = NULL; } else { object->in.pEnvironment = 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.pEnvironment = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeletePrintProcessor_in_get_pPrintProcessorName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_pPrintProcessorName; if (object->in.pPrintProcessorName == NULL) { Py_RETURN_NONE; } if (object->in.pPrintProcessorName == NULL) { py_pPrintProcessorName = Py_None; Py_INCREF(py_pPrintProcessorName); } else { py_pPrintProcessorName = PyUnicode_Decode(object->in.pPrintProcessorName, strlen(object->in.pPrintProcessorName), "utf-8", "ignore"); } return py_pPrintProcessorName; } static int py_winspool_AsyncDeletePrintProcessor_in_set_pPrintProcessorName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintProcessorName"); return -1; } object->in.pPrintProcessorName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrintProcessorName); if (object->in.pPrintProcessorName == 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.pPrintProcessorName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrintProcessor_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrintProcessor_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)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_winspool_AsyncDeletePrintProcessor_getsetters[] = { { .name = discard_const_p(char, "in_Name"), .get = py_winspool_AsyncDeletePrintProcessor_in_get_Name, .set = py_winspool_AsyncDeletePrintProcessor_in_set_Name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pEnvironment"), .get = py_winspool_AsyncDeletePrintProcessor_in_get_pEnvironment, .set = py_winspool_AsyncDeletePrintProcessor_in_set_pEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrintProcessorName"), .get = py_winspool_AsyncDeletePrintProcessor_in_get_pPrintProcessorName, .set = py_winspool_AsyncDeletePrintProcessor_in_set_pPrintProcessorName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrintProcessor_get_result, .set = py_winspool_AsyncDeletePrintProcessor_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrintProcessor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrintProcessor, type); return self; } static PyObject *py_winspool_AsyncDeletePrintProcessor_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(53); } static PyObject *py_winspool_AsyncDeletePrintProcessor_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 54) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrintProcessor_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[53]; 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_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrintProcessor_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 winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 54) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrintProcessor_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[53]; 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_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrintProcessor_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrintProcessor *object = (struct winspool_AsyncDeletePrintProcessor *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 54) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrintProcessor_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[53]; 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_winspool_AsyncDeletePrintProcessor_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrintProcessor_ndr_print(py_obj, "winspool_AsyncDeletePrintProcessor_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrintProcessor_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrintProcessor_ndr_print(py_obj, "winspool_AsyncDeletePrintProcessor_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrintProcessor_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrintProcessor_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrintProcessor.opnum() -> 53 (0x35) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_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_winspool_AsyncDeletePrintProcessor_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrintProcessor_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrintProcessor_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrintProcessor", .tp_getset = py_winspool_AsyncDeletePrintProcessor_getsetters, .tp_methods = py_winspool_AsyncDeletePrintProcessor_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrintProcessor_new, }; static bool pack_py_winspool_AsyncDeletePrintProcessor_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrintProcessor *r) { PyObject *py_Name; PyObject *py_pEnvironment; PyObject *py_pPrintProcessorName; const char *kwnames[] = { "Name", "pEnvironment", "pPrintProcessorName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncDeletePrintProcessor", discard_const_p(char *, kwnames), &py_Name, &py_pEnvironment, &py_pPrintProcessorName)) { return false; } if (py_Name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Name"); return false; } if (py_Name == Py_None) { r->in.Name = NULL; } else { r->in.Name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_Name)) { unicode = PyUnicode_AsEncodedString(py_Name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_Name)) { test_str = PyBytes_AS_STRING(py_Name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_Name)->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.Name = talloc_str; } } if (py_pEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pEnvironment"); return false; } if (py_pEnvironment == Py_None) { r->in.pEnvironment = NULL; } else { r->in.pEnvironment = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pEnvironment)) { test_str = PyBytes_AS_STRING(py_pEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pEnvironment)->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.pEnvironment = talloc_str; } } if (py_pPrintProcessorName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintProcessorName"); return false; } r->in.pPrintProcessorName = talloc_ptrtype(r, r->in.pPrintProcessorName); if (r->in.pPrintProcessorName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPrintProcessorName)) { unicode = PyUnicode_AsEncodedString(py_pPrintProcessorName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPrintProcessorName)) { test_str = PyBytes_AS_STRING(py_pPrintProcessorName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPrintProcessorName)->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.pPrintProcessorName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeletePrintProcessor_args_out(struct winspool_AsyncDeletePrintProcessor *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_winspool_AsyncEnumPrintProcessorDatatypes_in_get_pName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_pName; if (object->in.pName == NULL) { Py_RETURN_NONE; } if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { if (object->in.pName == NULL) { py_pName = Py_None; Py_INCREF(py_pName); } else { py_pName = PyUnicode_Decode(object->in.pName, strlen(object->in.pName), "utf-8", "ignore"); } } return py_pName; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_pName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pName"); return -1; } if (value == Py_None) { object->in.pName = NULL; } else { object->in.pName = 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.pName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_pPrintProcessorName(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_pPrintProcessorName; if (object->in.pPrintProcessorName == NULL) { Py_RETURN_NONE; } if (object->in.pPrintProcessorName == NULL) { py_pPrintProcessorName = Py_None; Py_INCREF(py_pPrintProcessorName); } else { if (object->in.pPrintProcessorName == NULL) { py_pPrintProcessorName = Py_None; Py_INCREF(py_pPrintProcessorName); } else { py_pPrintProcessorName = PyUnicode_Decode(object->in.pPrintProcessorName, strlen(object->in.pPrintProcessorName), "utf-8", "ignore"); } } return py_pPrintProcessorName; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_pPrintProcessorName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintProcessorName"); return -1; } if (value == Py_None) { object->in.pPrintProcessorName = NULL; } else { object->in.pPrintProcessorName = 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.pPrintProcessorName = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_Level(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_Level; py_Level = PyLong_FromUnsignedLongLong((uint32_t)object->in.Level); return py_Level; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_Level(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.Level)); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_pDatatypes(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_pDatatypes; if (object->in.pDatatypes == NULL) { Py_RETURN_NONE; } if (object->in.pDatatypes == NULL) { py_pDatatypes = Py_None; Py_INCREF(py_pDatatypes); } else { py_pDatatypes = PyList_New(object->in.cbBuf); if (py_pDatatypes == NULL) { return NULL; } { int pDatatypes_cntr_1; for (pDatatypes_cntr_1 = 0; pDatatypes_cntr_1 < (object->in.cbBuf); pDatatypes_cntr_1++) { PyObject *py_pDatatypes_1; py_pDatatypes_1 = PyLong_FromLong((uint16_t)object->in.pDatatypes[pDatatypes_cntr_1]); PyList_SetItem(py_pDatatypes, pDatatypes_cntr_1, py_pDatatypes_1); } } } return py_pDatatypes; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_pDatatypes(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDatatypes)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDatatypes"); return -1; } if (value == Py_None) { object->in.pDatatypes = NULL; } else { object->in.pDatatypes = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDatatypes_cntr_1; object->in.pDatatypes = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDatatypes, PyList_GET_SIZE(value)); if (!object->in.pDatatypes) { return -1;; } talloc_set_name_const(object->in.pDatatypes, "ARRAY: object->in.pDatatypes"); for (pDatatypes_cntr_1 = 0; pDatatypes_cntr_1 < PyList_GET_SIZE(value); pDatatypes_cntr_1++) { if (PyList_GET_ITEM(value, pDatatypes_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDatatypes[pDatatypes_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pDatatypes[pDatatypes_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDatatypes_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDatatypes_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->in.pDatatypes[pDatatypes_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_out_get_pDatatypes(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_pDatatypes; if (object->out.pDatatypes == NULL) { Py_RETURN_NONE; } if (object->out.pDatatypes == NULL) { py_pDatatypes = Py_None; Py_INCREF(py_pDatatypes); } else { py_pDatatypes = PyList_New(object->in.cbBuf); if (py_pDatatypes == NULL) { return NULL; } { int pDatatypes_cntr_1; for (pDatatypes_cntr_1 = 0; pDatatypes_cntr_1 < (object->in.cbBuf); pDatatypes_cntr_1++) { PyObject *py_pDatatypes_1; py_pDatatypes_1 = PyLong_FromLong((uint16_t)object->out.pDatatypes[pDatatypes_cntr_1]); PyList_SetItem(py_pDatatypes, pDatatypes_cntr_1, py_pDatatypes_1); } } } return py_pDatatypes; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_out_set_pDatatypes(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pDatatypes)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDatatypes"); return -1; } if (value == Py_None) { object->out.pDatatypes = NULL; } else { object->out.pDatatypes = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pDatatypes_cntr_1; object->out.pDatatypes = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pDatatypes, PyList_GET_SIZE(value)); if (!object->out.pDatatypes) { return -1;; } talloc_set_name_const(object->out.pDatatypes, "ARRAY: object->out.pDatatypes"); for (pDatatypes_cntr_1 = 0; pDatatypes_cntr_1 < PyList_GET_SIZE(value); pDatatypes_cntr_1++) { if (PyList_GET_ITEM(value, pDatatypes_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pDatatypes[pDatatypes_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pDatatypes[pDatatypes_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pDatatypes_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pDatatypes_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.pDatatypes[pDatatypes_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPrintProcessorDatatypes_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)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_winspool_AsyncEnumPrintProcessorDatatypes_getsetters[] = { { .name = discard_const_p(char, "in_pName"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_pName, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_pName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrintProcessorName"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_pPrintProcessorName, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_pPrintProcessorName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_Level"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_Level, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_Level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pDatatypes"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_pDatatypes, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_pDatatypes, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pDatatypes"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_out_get_pDatatypes, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_out_set_pDatatypes, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_in_get_cbBuf, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_out_get_pcbNeeded, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_out_get_pcReturned, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPrintProcessorDatatypes_get_result, .set = py_winspool_AsyncEnumPrintProcessorDatatypes_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPrintProcessorDatatypes, type); struct winspool_AsyncEnumPrintProcessorDatatypes *_self = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(54); } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 55) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[54]; 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_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_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 winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 55) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[54]; 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_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPrintProcessorDatatypes *object = (struct winspool_AsyncEnumPrintProcessorDatatypes *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 55) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[54]; 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_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print(py_obj, "winspool_AsyncEnumPrintProcessorDatatypes_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print(py_obj, "winspool_AsyncEnumPrintProcessorDatatypes_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPrintProcessorDatatypes_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPrintProcessorDatatypes.opnum() -> 54 (0x36) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_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_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPrintProcessorDatatypes_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPrintProcessorDatatypes_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPrintProcessorDatatypes", .tp_getset = py_winspool_AsyncEnumPrintProcessorDatatypes_getsetters, .tp_methods = py_winspool_AsyncEnumPrintProcessorDatatypes_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPrintProcessorDatatypes_new, }; static bool pack_py_winspool_AsyncEnumPrintProcessorDatatypes_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPrintProcessorDatatypes *r) { PyObject *py_pName; PyObject *py_pPrintProcessorName; PyObject *py_Level; PyObject *py_pDatatypes; const char *kwnames[] = { "pName", "pPrintProcessorName", "Level", "pDatatypes", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncEnumPrintProcessorDatatypes", discard_const_p(char *, kwnames), &py_pName, &py_pPrintProcessorName, &py_Level, &py_pDatatypes)) { return false; } if (py_pName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pName"); return false; } if (py_pName == Py_None) { r->in.pName = NULL; } else { r->in.pName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pName)) { unicode = PyUnicode_AsEncodedString(py_pName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pName)) { test_str = PyBytes_AS_STRING(py_pName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pName)->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.pName = talloc_str; } } if (py_pPrintProcessorName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintProcessorName"); return false; } if (py_pPrintProcessorName == Py_None) { r->in.pPrintProcessorName = NULL; } else { r->in.pPrintProcessorName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPrintProcessorName)) { unicode = PyUnicode_AsEncodedString(py_pPrintProcessorName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPrintProcessorName)) { test_str = PyBytes_AS_STRING(py_pPrintProcessorName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPrintProcessorName)->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.pPrintProcessorName = talloc_str; } } if (py_Level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.Level)); if (PyLong_Check(py_Level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_Level); 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.Level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pDatatypes == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDatatypes"); return false; } if (py_pDatatypes == Py_None) { r->in.pDatatypes = NULL; } else { r->in.pDatatypes = NULL; PY_CHECK_TYPE(&PyList_Type, py_pDatatypes, return false;); { int pDatatypes_cntr_1; r->in.pDatatypes = talloc_array_ptrtype(r, r->in.pDatatypes, PyList_GET_SIZE(py_pDatatypes)); if (!r->in.pDatatypes) { return false;; } talloc_set_name_const(r->in.pDatatypes, "ARRAY: r->in.pDatatypes"); for (pDatatypes_cntr_1 = 0; pDatatypes_cntr_1 < PyList_GET_SIZE(py_pDatatypes); pDatatypes_cntr_1++) { if (PyList_GET_ITEM(py_pDatatypes, pDatatypes_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDatatypes[pDatatypes_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pDatatypes[pDatatypes_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pDatatypes, pDatatypes_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pDatatypes, pDatatypes_cntr_1)); 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.pDatatypes[pDatatypes_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pDatatypes, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pDatatypes); return true; } static PyObject *unpack_py_winspool_AsyncEnumPrintProcessorDatatypes_args_out(struct winspool_AsyncEnumPrintProcessorDatatypes *r) { PyObject *result; PyObject *py_pDatatypes; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pDatatypes == NULL) { py_pDatatypes = Py_None; Py_INCREF(py_pDatatypes); } else { py_pDatatypes = PyList_New(r->in.cbBuf); if (py_pDatatypes == NULL) { return NULL; } { int pDatatypes_cntr_1; for (pDatatypes_cntr_1 = 0; pDatatypes_cntr_1 < (r->in.cbBuf); pDatatypes_cntr_1++) { PyObject *py_pDatatypes_1; py_pDatatypes_1 = PyLong_FromLong((uint16_t)r->out.pDatatypes[pDatatypes_cntr_1]); PyList_SetItem(py_pDatatypes, pDatatypes_cntr_1, py_pDatatypes_1); } } } PyTuple_SetItem(result, 0, py_pDatatypes); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncAddPerMachineConnection_in_get_pServer(PyObject *obj, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_pServer; if (object->in.pServer == NULL) { Py_RETURN_NONE; } if (object->in.pServer == NULL) { py_pServer = Py_None; Py_INCREF(py_pServer); } else { if (object->in.pServer == NULL) { py_pServer = Py_None; Py_INCREF(py_pServer); } else { py_pServer = PyUnicode_Decode(object->in.pServer, strlen(object->in.pServer), "utf-8", "ignore"); } } return py_pServer; } static int py_winspool_AsyncAddPerMachineConnection_in_set_pServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pServer"); return -1; } if (value == Py_None) { object->in.pServer = NULL; } else { object->in.pServer = 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.pServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncAddPerMachineConnection_in_get_pPrinterName(PyObject *obj, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_pPrinterName; if (object->in.pPrinterName == NULL) { Py_RETURN_NONE; } if (object->in.pPrinterName == NULL) { py_pPrinterName = Py_None; Py_INCREF(py_pPrinterName); } else { py_pPrinterName = PyUnicode_Decode(object->in.pPrinterName, strlen(object->in.pPrinterName), "utf-8", "ignore"); } return py_pPrinterName; } static int py_winspool_AsyncAddPerMachineConnection_in_set_pPrinterName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterName"); return -1; } object->in.pPrinterName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrinterName); if (object->in.pPrinterName == 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.pPrinterName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncAddPerMachineConnection_in_get_pPrintServer(PyObject *obj, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_pPrintServer; if (object->in.pPrintServer == NULL) { Py_RETURN_NONE; } if (object->in.pPrintServer == NULL) { py_pPrintServer = Py_None; Py_INCREF(py_pPrintServer); } else { py_pPrintServer = PyUnicode_Decode(object->in.pPrintServer, strlen(object->in.pPrintServer), "utf-8", "ignore"); } return py_pPrintServer; } static int py_winspool_AsyncAddPerMachineConnection_in_set_pPrintServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrintServer"); return -1; } object->in.pPrintServer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrintServer); if (object->in.pPrintServer == 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.pPrintServer = talloc_str; } return 0; } static PyObject *py_winspool_AsyncAddPerMachineConnection_in_get_pProvider(PyObject *obj, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_pProvider; if (object->in.pProvider == NULL) { Py_RETURN_NONE; } if (object->in.pProvider == NULL) { py_pProvider = Py_None; Py_INCREF(py_pProvider); } else { py_pProvider = PyUnicode_Decode(object->in.pProvider, strlen(object->in.pProvider), "utf-8", "ignore"); } return py_pProvider; } static int py_winspool_AsyncAddPerMachineConnection_in_set_pProvider(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pProvider"); return -1; } object->in.pProvider = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pProvider); if (object->in.pProvider == 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.pProvider = talloc_str; } return 0; } static PyObject *py_winspool_AsyncAddPerMachineConnection_get_result(PyObject *obj, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncAddPerMachineConnection_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)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_winspool_AsyncAddPerMachineConnection_getsetters[] = { { .name = discard_const_p(char, "in_pServer"), .get = py_winspool_AsyncAddPerMachineConnection_in_get_pServer, .set = py_winspool_AsyncAddPerMachineConnection_in_set_pServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrinterName"), .get = py_winspool_AsyncAddPerMachineConnection_in_get_pPrinterName, .set = py_winspool_AsyncAddPerMachineConnection_in_set_pPrinterName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrintServer"), .get = py_winspool_AsyncAddPerMachineConnection_in_get_pPrintServer, .set = py_winspool_AsyncAddPerMachineConnection_in_set_pPrintServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pProvider"), .get = py_winspool_AsyncAddPerMachineConnection_in_get_pProvider, .set = py_winspool_AsyncAddPerMachineConnection_in_set_pProvider, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncAddPerMachineConnection_get_result, .set = py_winspool_AsyncAddPerMachineConnection_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncAddPerMachineConnection_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncAddPerMachineConnection, type); return self; } static PyObject *py_winspool_AsyncAddPerMachineConnection_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(55); } static PyObject *py_winspool_AsyncAddPerMachineConnection_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 56) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPerMachineConnection_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[55]; 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_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncAddPerMachineConnection_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 winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 56) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPerMachineConnection_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[55]; 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_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncAddPerMachineConnection_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncAddPerMachineConnection *object = (struct winspool_AsyncAddPerMachineConnection *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 56) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncAddPerMachineConnection_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[55]; 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_winspool_AsyncAddPerMachineConnection_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPerMachineConnection_ndr_print(py_obj, "winspool_AsyncAddPerMachineConnection_in", NDR_IN); } static PyObject *py_winspool_AsyncAddPerMachineConnection_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncAddPerMachineConnection_ndr_print(py_obj, "winspool_AsyncAddPerMachineConnection_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncAddPerMachineConnection_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncAddPerMachineConnection_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncAddPerMachineConnection.opnum() -> 55 (0x37) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_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_winspool_AsyncAddPerMachineConnection_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncAddPerMachineConnection_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncAddPerMachineConnection_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncAddPerMachineConnection", .tp_getset = py_winspool_AsyncAddPerMachineConnection_getsetters, .tp_methods = py_winspool_AsyncAddPerMachineConnection_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncAddPerMachineConnection_new, }; static bool pack_py_winspool_AsyncAddPerMachineConnection_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncAddPerMachineConnection *r) { PyObject *py_pServer; PyObject *py_pPrinterName; PyObject *py_pPrintServer; PyObject *py_pProvider; const char *kwnames[] = { "pServer", "pPrinterName", "pPrintServer", "pProvider", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncAddPerMachineConnection", discard_const_p(char *, kwnames), &py_pServer, &py_pPrinterName, &py_pPrintServer, &py_pProvider)) { return false; } if (py_pServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pServer"); return false; } if (py_pServer == Py_None) { r->in.pServer = NULL; } else { r->in.pServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pServer)) { unicode = PyUnicode_AsEncodedString(py_pServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pServer)) { test_str = PyBytes_AS_STRING(py_pServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pServer)->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.pServer = talloc_str; } } if (py_pPrinterName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterName"); return false; } r->in.pPrinterName = talloc_ptrtype(r, r->in.pPrinterName); if (r->in.pPrinterName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPrinterName)) { unicode = PyUnicode_AsEncodedString(py_pPrinterName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPrinterName)) { test_str = PyBytes_AS_STRING(py_pPrinterName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPrinterName)->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.pPrinterName = talloc_str; } if (py_pPrintServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrintServer"); return false; } r->in.pPrintServer = talloc_ptrtype(r, r->in.pPrintServer); if (r->in.pPrintServer == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPrintServer)) { unicode = PyUnicode_AsEncodedString(py_pPrintServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPrintServer)) { test_str = PyBytes_AS_STRING(py_pPrintServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPrintServer)->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.pPrintServer = talloc_str; } if (py_pProvider == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pProvider"); return false; } r->in.pProvider = talloc_ptrtype(r, r->in.pProvider); if (r->in.pProvider == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pProvider)) { unicode = PyUnicode_AsEncodedString(py_pProvider, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pProvider)) { test_str = PyBytes_AS_STRING(py_pProvider); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pProvider)->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.pProvider = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncAddPerMachineConnection_args_out(struct winspool_AsyncAddPerMachineConnection *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_winspool_AsyncDeletePerMachineConnection_in_get_pServer(PyObject *obj, void *closure) { struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_pServer; if (object->in.pServer == NULL) { Py_RETURN_NONE; } if (object->in.pServer == NULL) { py_pServer = Py_None; Py_INCREF(py_pServer); } else { if (object->in.pServer == NULL) { py_pServer = Py_None; Py_INCREF(py_pServer); } else { py_pServer = PyUnicode_Decode(object->in.pServer, strlen(object->in.pServer), "utf-8", "ignore"); } } return py_pServer; } static int py_winspool_AsyncDeletePerMachineConnection_in_set_pServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pServer"); return -1; } if (value == Py_None) { object->in.pServer = NULL; } else { object->in.pServer = 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.pServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeletePerMachineConnection_in_get_pPrinterName(PyObject *obj, void *closure) { struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_pPrinterName; if (object->in.pPrinterName == NULL) { Py_RETURN_NONE; } if (object->in.pPrinterName == NULL) { py_pPrinterName = Py_None; Py_INCREF(py_pPrinterName); } else { py_pPrinterName = PyUnicode_Decode(object->in.pPrinterName, strlen(object->in.pPrinterName), "utf-8", "ignore"); } return py_pPrinterName; } static int py_winspool_AsyncDeletePerMachineConnection_in_set_pPrinterName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterName"); return -1; } object->in.pPrinterName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrinterName); if (object->in.pPrinterName == 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.pPrinterName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePerMachineConnection_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeletePerMachineConnection_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)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_winspool_AsyncDeletePerMachineConnection_getsetters[] = { { .name = discard_const_p(char, "in_pServer"), .get = py_winspool_AsyncDeletePerMachineConnection_in_get_pServer, .set = py_winspool_AsyncDeletePerMachineConnection_in_set_pServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrinterName"), .get = py_winspool_AsyncDeletePerMachineConnection_in_get_pPrinterName, .set = py_winspool_AsyncDeletePerMachineConnection_in_set_pPrinterName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePerMachineConnection_get_result, .set = py_winspool_AsyncDeletePerMachineConnection_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePerMachineConnection_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePerMachineConnection, type); return self; } static PyObject *py_winspool_AsyncDeletePerMachineConnection_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(56); } static PyObject *py_winspool_AsyncDeletePerMachineConnection_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 57) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePerMachineConnection_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[56]; 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_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePerMachineConnection_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 winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 57) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePerMachineConnection_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[56]; 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_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePerMachineConnection_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePerMachineConnection *object = (struct winspool_AsyncDeletePerMachineConnection *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 57) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePerMachineConnection_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[56]; 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_winspool_AsyncDeletePerMachineConnection_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePerMachineConnection_ndr_print(py_obj, "winspool_AsyncDeletePerMachineConnection_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePerMachineConnection_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePerMachineConnection_ndr_print(py_obj, "winspool_AsyncDeletePerMachineConnection_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePerMachineConnection_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePerMachineConnection_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePerMachineConnection.opnum() -> 56 (0x38) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_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_winspool_AsyncDeletePerMachineConnection_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePerMachineConnection_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePerMachineConnection_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePerMachineConnection", .tp_getset = py_winspool_AsyncDeletePerMachineConnection_getsetters, .tp_methods = py_winspool_AsyncDeletePerMachineConnection_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePerMachineConnection_new, }; static bool pack_py_winspool_AsyncDeletePerMachineConnection_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePerMachineConnection *r) { PyObject *py_pServer; PyObject *py_pPrinterName; const char *kwnames[] = { "pServer", "pPrinterName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncDeletePerMachineConnection", discard_const_p(char *, kwnames), &py_pServer, &py_pPrinterName)) { return false; } if (py_pServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pServer"); return false; } if (py_pServer == Py_None) { r->in.pServer = NULL; } else { r->in.pServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pServer)) { unicode = PyUnicode_AsEncodedString(py_pServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pServer)) { test_str = PyBytes_AS_STRING(py_pServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pServer)->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.pServer = talloc_str; } } if (py_pPrinterName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterName"); return false; } r->in.pPrinterName = talloc_ptrtype(r, r->in.pPrinterName); if (r->in.pPrinterName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pPrinterName)) { unicode = PyUnicode_AsEncodedString(py_pPrinterName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pPrinterName)) { test_str = PyBytes_AS_STRING(py_pPrinterName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pPrinterName)->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.pPrinterName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeletePerMachineConnection_args_out(struct winspool_AsyncDeletePerMachineConnection *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_winspool_AsyncEnumPerMachineConnections_in_get_pServer(PyObject *obj, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(obj); PyObject *py_pServer; if (object->in.pServer == NULL) { Py_RETURN_NONE; } if (object->in.pServer == NULL) { py_pServer = Py_None; Py_INCREF(py_pServer); } else { if (object->in.pServer == NULL) { py_pServer = Py_None; Py_INCREF(py_pServer); } else { py_pServer = PyUnicode_Decode(object->in.pServer, strlen(object->in.pServer), "utf-8", "ignore"); } } return py_pServer; } static int py_winspool_AsyncEnumPerMachineConnections_in_set_pServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pServer"); return -1; } if (value == Py_None) { object->in.pServer = NULL; } else { object->in.pServer = 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.pServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncEnumPerMachineConnections_in_get_pPrinterEnum(PyObject *obj, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(obj); PyObject *py_pPrinterEnum; if (object->in.pPrinterEnum == NULL) { Py_RETURN_NONE; } if (object->in.pPrinterEnum == NULL) { py_pPrinterEnum = Py_None; Py_INCREF(py_pPrinterEnum); } else { py_pPrinterEnum = PyList_New(object->in.cbBuf); if (py_pPrinterEnum == NULL) { return NULL; } { int pPrinterEnum_cntr_1; for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < (object->in.cbBuf); pPrinterEnum_cntr_1++) { PyObject *py_pPrinterEnum_1; py_pPrinterEnum_1 = PyLong_FromLong((uint16_t)object->in.pPrinterEnum[pPrinterEnum_cntr_1]); PyList_SetItem(py_pPrinterEnum, pPrinterEnum_cntr_1, py_pPrinterEnum_1); } } } return py_pPrinterEnum; } static int py_winspool_AsyncEnumPerMachineConnections_in_set_pPrinterEnum(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pPrinterEnum)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterEnum"); return -1; } if (value == Py_None) { object->in.pPrinterEnum = NULL; } else { object->in.pPrinterEnum = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrinterEnum_cntr_1; object->in.pPrinterEnum = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pPrinterEnum, PyList_GET_SIZE(value)); if (!object->in.pPrinterEnum) { return -1;; } talloc_set_name_const(object->in.pPrinterEnum, "ARRAY: object->in.pPrinterEnum"); for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < PyList_GET_SIZE(value); pPrinterEnum_cntr_1++) { if (PyList_GET_ITEM(value, pPrinterEnum_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pPrinterEnum[pPrinterEnum_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pPrinterEnum[pPrinterEnum_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrinterEnum_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrinterEnum_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->in.pPrinterEnum[pPrinterEnum_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPerMachineConnections_out_get_pPrinterEnum(PyObject *obj, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(obj); PyObject *py_pPrinterEnum; if (object->out.pPrinterEnum == NULL) { Py_RETURN_NONE; } if (object->out.pPrinterEnum == NULL) { py_pPrinterEnum = Py_None; Py_INCREF(py_pPrinterEnum); } else { py_pPrinterEnum = PyList_New(object->in.cbBuf); if (py_pPrinterEnum == NULL) { return NULL; } { int pPrinterEnum_cntr_1; for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < (object->in.cbBuf); pPrinterEnum_cntr_1++) { PyObject *py_pPrinterEnum_1; py_pPrinterEnum_1 = PyLong_FromLong((uint16_t)object->out.pPrinterEnum[pPrinterEnum_cntr_1]); PyList_SetItem(py_pPrinterEnum, pPrinterEnum_cntr_1, py_pPrinterEnum_1); } } } return py_pPrinterEnum; } static int py_winspool_AsyncEnumPerMachineConnections_out_set_pPrinterEnum(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pPrinterEnum)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrinterEnum"); return -1; } if (value == Py_None) { object->out.pPrinterEnum = NULL; } else { object->out.pPrinterEnum = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pPrinterEnum_cntr_1; object->out.pPrinterEnum = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pPrinterEnum, PyList_GET_SIZE(value)); if (!object->out.pPrinterEnum) { return -1;; } talloc_set_name_const(object->out.pPrinterEnum, "ARRAY: object->out.pPrinterEnum"); for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < PyList_GET_SIZE(value); pPrinterEnum_cntr_1++) { if (PyList_GET_ITEM(value, pPrinterEnum_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pPrinterEnum[pPrinterEnum_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pPrinterEnum[pPrinterEnum_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pPrinterEnum_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pPrinterEnum_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.pPrinterEnum[pPrinterEnum_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncEnumPerMachineConnections_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncEnumPerMachineConnections_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPerMachineConnections_out_get_pcbNeeded(PyObject *obj, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(obj); PyObject *py_pcbNeeded; if (object->out.pcbNeeded == NULL) { Py_RETURN_NONE; } py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcbNeeded); return py_pcbNeeded; } static int py_winspool_AsyncEnumPerMachineConnections_out_set_pcbNeeded(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcbNeeded)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcbNeeded"); return -1; } object->out.pcbNeeded = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcbNeeded); if (object->out.pcbNeeded == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcbNeeded)); 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.pcbNeeded = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPerMachineConnections_out_get_pcReturned(PyObject *obj, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(obj); PyObject *py_pcReturned; if (object->out.pcReturned == NULL) { Py_RETURN_NONE; } py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcReturned); return py_pcReturned; } static int py_winspool_AsyncEnumPerMachineConnections_out_set_pcReturned(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcReturned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcReturned"); return -1; } object->out.pcReturned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcReturned); if (object->out.pcReturned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcReturned)); 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.pcReturned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumPerMachineConnections_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumPerMachineConnections_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)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_winspool_AsyncEnumPerMachineConnections_getsetters[] = { { .name = discard_const_p(char, "in_pServer"), .get = py_winspool_AsyncEnumPerMachineConnections_in_get_pServer, .set = py_winspool_AsyncEnumPerMachineConnections_in_set_pServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pPrinterEnum"), .get = py_winspool_AsyncEnumPerMachineConnections_in_get_pPrinterEnum, .set = py_winspool_AsyncEnumPerMachineConnections_in_set_pPrinterEnum, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_pPrinterEnum"), .get = py_winspool_AsyncEnumPerMachineConnections_out_get_pPrinterEnum, .set = py_winspool_AsyncEnumPerMachineConnections_out_set_pPrinterEnum, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncEnumPerMachineConnections_in_get_cbBuf, .set = py_winspool_AsyncEnumPerMachineConnections_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcbNeeded"), .get = py_winspool_AsyncEnumPerMachineConnections_out_get_pcbNeeded, .set = py_winspool_AsyncEnumPerMachineConnections_out_set_pcbNeeded, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcReturned"), .get = py_winspool_AsyncEnumPerMachineConnections_out_get_pcReturned, .set = py_winspool_AsyncEnumPerMachineConnections_out_set_pcReturned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumPerMachineConnections_get_result, .set = py_winspool_AsyncEnumPerMachineConnections_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumPerMachineConnections_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumPerMachineConnections, type); struct winspool_AsyncEnumPerMachineConnections *_self = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcbNeeded = talloc_zero(mem_ctx, uint32_t); _self->out.pcReturned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncEnumPerMachineConnections_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(57); } static PyObject *py_winspool_AsyncEnumPerMachineConnections_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 58) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPerMachineConnections_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[57]; 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_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumPerMachineConnections_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 winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 58) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPerMachineConnections_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[57]; 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_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumPerMachineConnections_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumPerMachineConnections *object = (struct winspool_AsyncEnumPerMachineConnections *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 58) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumPerMachineConnections_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[57]; 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_winspool_AsyncEnumPerMachineConnections_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPerMachineConnections_ndr_print(py_obj, "winspool_AsyncEnumPerMachineConnections_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumPerMachineConnections_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumPerMachineConnections_ndr_print(py_obj, "winspool_AsyncEnumPerMachineConnections_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumPerMachineConnections_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumPerMachineConnections_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumPerMachineConnections.opnum() -> 57 (0x39) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_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_winspool_AsyncEnumPerMachineConnections_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumPerMachineConnections_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumPerMachineConnections_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumPerMachineConnections", .tp_getset = py_winspool_AsyncEnumPerMachineConnections_getsetters, .tp_methods = py_winspool_AsyncEnumPerMachineConnections_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumPerMachineConnections_new, }; static bool pack_py_winspool_AsyncEnumPerMachineConnections_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumPerMachineConnections *r) { PyObject *py_pServer; PyObject *py_pPrinterEnum; const char *kwnames[] = { "pServer", "pPrinterEnum", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncEnumPerMachineConnections", discard_const_p(char *, kwnames), &py_pServer, &py_pPrinterEnum)) { return false; } if (py_pServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pServer"); return false; } if (py_pServer == Py_None) { r->in.pServer = NULL; } else { r->in.pServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pServer)) { unicode = PyUnicode_AsEncodedString(py_pServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pServer)) { test_str = PyBytes_AS_STRING(py_pServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pServer)->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.pServer = talloc_str; } } if (py_pPrinterEnum == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterEnum"); return false; } if (py_pPrinterEnum == Py_None) { r->in.pPrinterEnum = NULL; } else { r->in.pPrinterEnum = NULL; PY_CHECK_TYPE(&PyList_Type, py_pPrinterEnum, return false;); { int pPrinterEnum_cntr_1; r->in.pPrinterEnum = talloc_array_ptrtype(r, r->in.pPrinterEnum, PyList_GET_SIZE(py_pPrinterEnum)); if (!r->in.pPrinterEnum) { return false;; } talloc_set_name_const(r->in.pPrinterEnum, "ARRAY: r->in.pPrinterEnum"); for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < PyList_GET_SIZE(py_pPrinterEnum); pPrinterEnum_cntr_1++) { if (PyList_GET_ITEM(py_pPrinterEnum, pPrinterEnum_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pPrinterEnum[pPrinterEnum_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pPrinterEnum[pPrinterEnum_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pPrinterEnum, pPrinterEnum_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pPrinterEnum, pPrinterEnum_cntr_1)); 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.pPrinterEnum[pPrinterEnum_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pPrinterEnum, return false;); r->in.cbBuf = PyList_GET_SIZE(py_pPrinterEnum); return true; } static PyObject *unpack_py_winspool_AsyncEnumPerMachineConnections_args_out(struct winspool_AsyncEnumPerMachineConnections *r) { PyObject *result; PyObject *py_pPrinterEnum; PyObject *py_pcbNeeded; PyObject *py_pcReturned; result = PyTuple_New(3); if (r->out.pPrinterEnum == NULL) { py_pPrinterEnum = Py_None; Py_INCREF(py_pPrinterEnum); } else { py_pPrinterEnum = PyList_New(r->in.cbBuf); if (py_pPrinterEnum == NULL) { return NULL; } { int pPrinterEnum_cntr_1; for (pPrinterEnum_cntr_1 = 0; pPrinterEnum_cntr_1 < (r->in.cbBuf); pPrinterEnum_cntr_1++) { PyObject *py_pPrinterEnum_1; py_pPrinterEnum_1 = PyLong_FromLong((uint16_t)r->out.pPrinterEnum[pPrinterEnum_cntr_1]); PyList_SetItem(py_pPrinterEnum, pPrinterEnum_cntr_1, py_pPrinterEnum_1); } } } PyTuple_SetItem(result, 0, py_pPrinterEnum); py_pcbNeeded = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcbNeeded); PyTuple_SetItem(result, 1, py_pcbNeeded); py_pcReturned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcReturned); PyTuple_SetItem(result, 2, py_pcReturned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_SyncRegisterForRemoteNotifications_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_in_get_pNotifyFilter(PyObject *obj, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_pNotifyFilter; if (object->in.pNotifyFilter == NULL) { Py_RETURN_NONE; } py_pNotifyFilter = pytalloc_reference_ex(&winspool_PrintPropertiesCollection_Type, object->in.pNotifyFilter, object->in.pNotifyFilter); return py_pNotifyFilter; } static int py_winspool_SyncRegisterForRemoteNotifications_in_set_pNotifyFilter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pNotifyFilter)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pNotifyFilter"); return -1; } object->in.pNotifyFilter = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pNotifyFilter); if (object->in.pNotifyFilter == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&winspool_PrintPropertiesCollection_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.pNotifyFilter = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_out_get_phRpcHandle(PyObject *obj, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_phRpcHandle; if (object->out.phRpcHandle == NULL) { Py_RETURN_NONE; } py_phRpcHandle = pytalloc_reference_ex(policy_handle_Type, object->out.phRpcHandle, object->out.phRpcHandle); return py_phRpcHandle; } static int py_winspool_SyncRegisterForRemoteNotifications_out_set_phRpcHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.phRpcHandle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.phRpcHandle"); return -1; } object->out.phRpcHandle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.phRpcHandle); if (object->out.phRpcHandle == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.phRpcHandle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_get_result(PyObject *obj, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_SyncRegisterForRemoteNotifications_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_SyncRegisterForRemoteNotifications_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_SyncRegisterForRemoteNotifications_in_get_hPrinter, .set = py_winspool_SyncRegisterForRemoteNotifications_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pNotifyFilter"), .get = py_winspool_SyncRegisterForRemoteNotifications_in_get_pNotifyFilter, .set = py_winspool_SyncRegisterForRemoteNotifications_in_set_pNotifyFilter, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintPropertiesCollection") }, { .name = discard_const_p(char, "out_phRpcHandle"), .get = py_winspool_SyncRegisterForRemoteNotifications_out_get_phRpcHandle, .set = py_winspool_SyncRegisterForRemoteNotifications_out_set_phRpcHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_SyncRegisterForRemoteNotifications_get_result, .set = py_winspool_SyncRegisterForRemoteNotifications_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_SyncRegisterForRemoteNotifications_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_SyncRegisterForRemoteNotifications, type); struct winspool_SyncRegisterForRemoteNotifications *_self = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pNotifyFilter = talloc_zero(mem_ctx, struct winspool_PrintPropertiesCollection); _self->out.phRpcHandle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(58); } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 59) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncRegisterForRemoteNotifications_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[58]; 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_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_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 winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 59) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncRegisterForRemoteNotifications_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[58]; 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_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_SyncRegisterForRemoteNotifications *object = (struct winspool_SyncRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 59) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncRegisterForRemoteNotifications_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[58]; 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_winspool_SyncRegisterForRemoteNotifications_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_SyncRegisterForRemoteNotifications_ndr_print(py_obj, "winspool_SyncRegisterForRemoteNotifications_in", NDR_IN); } static PyObject *py_winspool_SyncRegisterForRemoteNotifications_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_SyncRegisterForRemoteNotifications_ndr_print(py_obj, "winspool_SyncRegisterForRemoteNotifications_out", NDR_OUT); } static PyMethodDef py_winspool_SyncRegisterForRemoteNotifications_methods[] = { { "opnum", (PyCFunction)py_winspool_SyncRegisterForRemoteNotifications_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.SyncRegisterForRemoteNotifications.opnum() -> 58 (0x3a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_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_winspool_SyncRegisterForRemoteNotifications_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_SyncRegisterForRemoteNotifications_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_SyncRegisterForRemoteNotifications_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.SyncRegisterForRemoteNotifications", .tp_getset = py_winspool_SyncRegisterForRemoteNotifications_getsetters, .tp_methods = py_winspool_SyncRegisterForRemoteNotifications_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_SyncRegisterForRemoteNotifications_new, }; static bool pack_py_winspool_SyncRegisterForRemoteNotifications_args_in(PyObject *args, PyObject *kwargs, struct winspool_SyncRegisterForRemoteNotifications *r) { PyObject *py_hPrinter; PyObject *py_pNotifyFilter; const char *kwnames[] = { "hPrinter", "pNotifyFilter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_SyncRegisterForRemoteNotifications", discard_const_p(char *, kwnames), &py_hPrinter, &py_pNotifyFilter)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pNotifyFilter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pNotifyFilter"); return false; } r->in.pNotifyFilter = talloc_ptrtype(r, r->in.pNotifyFilter); if (r->in.pNotifyFilter == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&winspool_PrintPropertiesCollection_Type, py_pNotifyFilter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pNotifyFilter)) == NULL) { PyErr_NoMemory(); return false; } r->in.pNotifyFilter = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(py_pNotifyFilter); return true; } static PyObject *unpack_py_winspool_SyncRegisterForRemoteNotifications_args_out(struct winspool_SyncRegisterForRemoteNotifications *r) { PyObject *result; PyObject *py_phRpcHandle; result = PyTuple_New(2); py_phRpcHandle = pytalloc_reference_ex(policy_handle_Type, r->out.phRpcHandle, r->out.phRpcHandle); PyTuple_SetItem(result, 0, py_phRpcHandle); PyTuple_SetItem(result, 1, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_in_get_phRpcHandle(PyObject *obj, void *closure) { struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_phRpcHandle; if (object->in.phRpcHandle == NULL) { Py_RETURN_NONE; } py_phRpcHandle = pytalloc_reference_ex(policy_handle_Type, object->in.phRpcHandle, object->in.phRpcHandle); return py_phRpcHandle; } static int py_winspool_SyncUnRegisterForRemoteNotifications_in_set_phRpcHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.phRpcHandle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.phRpcHandle"); return -1; } object->in.phRpcHandle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.phRpcHandle); if (object->in.phRpcHandle == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.phRpcHandle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_out_get_phRpcHandle(PyObject *obj, void *closure) { struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_phRpcHandle; if (object->out.phRpcHandle == NULL) { Py_RETURN_NONE; } py_phRpcHandle = pytalloc_reference_ex(policy_handle_Type, object->out.phRpcHandle, object->out.phRpcHandle); return py_phRpcHandle; } static int py_winspool_SyncUnRegisterForRemoteNotifications_out_set_phRpcHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.phRpcHandle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.phRpcHandle"); return -1; } object->out.phRpcHandle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.phRpcHandle); if (object->out.phRpcHandle == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(policy_handle_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.phRpcHandle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_get_result(PyObject *obj, void *closure) { struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_SyncUnRegisterForRemoteNotifications_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_SyncUnRegisterForRemoteNotifications_getsetters[] = { { .name = discard_const_p(char, "in_phRpcHandle"), .get = py_winspool_SyncUnRegisterForRemoteNotifications_in_get_phRpcHandle, .set = py_winspool_SyncUnRegisterForRemoteNotifications_in_set_phRpcHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_phRpcHandle"), .get = py_winspool_SyncUnRegisterForRemoteNotifications_out_get_phRpcHandle, .set = py_winspool_SyncUnRegisterForRemoteNotifications_out_set_phRpcHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_winspool_SyncUnRegisterForRemoteNotifications_get_result, .set = py_winspool_SyncUnRegisterForRemoteNotifications_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_SyncUnRegisterForRemoteNotifications, type); struct winspool_SyncUnRegisterForRemoteNotifications *_self = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.phRpcHandle = talloc_zero(mem_ctx, struct policy_handle); _self->out.phRpcHandle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(59); } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 60) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncUnRegisterForRemoteNotifications_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[59]; 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_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_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 winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 60) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncUnRegisterForRemoteNotifications_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[59]; 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_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_SyncUnRegisterForRemoteNotifications *object = (struct winspool_SyncUnRegisterForRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 60) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncUnRegisterForRemoteNotifications_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[59]; 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_winspool_SyncUnRegisterForRemoteNotifications_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_SyncUnRegisterForRemoteNotifications_ndr_print(py_obj, "winspool_SyncUnRegisterForRemoteNotifications_in", NDR_IN); } static PyObject *py_winspool_SyncUnRegisterForRemoteNotifications_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_SyncUnRegisterForRemoteNotifications_ndr_print(py_obj, "winspool_SyncUnRegisterForRemoteNotifications_out", NDR_OUT); } static PyMethodDef py_winspool_SyncUnRegisterForRemoteNotifications_methods[] = { { "opnum", (PyCFunction)py_winspool_SyncUnRegisterForRemoteNotifications_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.SyncUnRegisterForRemoteNotifications.opnum() -> 59 (0x3b) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_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_winspool_SyncUnRegisterForRemoteNotifications_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_SyncUnRegisterForRemoteNotifications_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_SyncUnRegisterForRemoteNotifications_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.SyncUnRegisterForRemoteNotifications", .tp_getset = py_winspool_SyncUnRegisterForRemoteNotifications_getsetters, .tp_methods = py_winspool_SyncUnRegisterForRemoteNotifications_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_SyncUnRegisterForRemoteNotifications_new, }; static bool pack_py_winspool_SyncUnRegisterForRemoteNotifications_args_in(PyObject *args, PyObject *kwargs, struct winspool_SyncUnRegisterForRemoteNotifications *r) { PyObject *py_phRpcHandle; const char *kwnames[] = { "phRpcHandle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_SyncUnRegisterForRemoteNotifications", discard_const_p(char *, kwnames), &py_phRpcHandle)) { return false; } if (py_phRpcHandle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.phRpcHandle"); return false; } r->in.phRpcHandle = talloc_ptrtype(r, r->in.phRpcHandle); if (r->in.phRpcHandle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_phRpcHandle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_phRpcHandle)) == NULL) { PyErr_NoMemory(); return false; } r->in.phRpcHandle = (struct policy_handle *)pytalloc_get_ptr(py_phRpcHandle); return true; } static PyObject *unpack_py_winspool_SyncUnRegisterForRemoteNotifications_args_out(struct winspool_SyncUnRegisterForRemoteNotifications *r) { PyObject *result; PyObject *py_phRpcHandle; result = PyTuple_New(2); py_phRpcHandle = pytalloc_reference_ex(policy_handle_Type, r->out.phRpcHandle, r->out.phRpcHandle); PyTuple_SetItem(result, 0, py_phRpcHandle); PyTuple_SetItem(result, 1, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_SyncRefreshRemoteNotifications_in_get_hRpcHandle(PyObject *obj, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_hRpcHandle; py_hRpcHandle = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hRpcHandle); return py_hRpcHandle; } static int py_winspool_SyncRefreshRemoteNotifications_in_set_hRpcHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hRpcHandle"); return -1; } PY_CHECK_TYPE(policy_handle_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.hRpcHandle = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_SyncRefreshRemoteNotifications_in_get_pNotifyFilter(PyObject *obj, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_pNotifyFilter; if (object->in.pNotifyFilter == NULL) { Py_RETURN_NONE; } py_pNotifyFilter = pytalloc_reference_ex(&winspool_PrintPropertiesCollection_Type, object->in.pNotifyFilter, object->in.pNotifyFilter); return py_pNotifyFilter; } static int py_winspool_SyncRefreshRemoteNotifications_in_set_pNotifyFilter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pNotifyFilter)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pNotifyFilter"); return -1; } object->in.pNotifyFilter = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pNotifyFilter); if (object->in.pNotifyFilter == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&winspool_PrintPropertiesCollection_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.pNotifyFilter = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_SyncRefreshRemoteNotifications_out_get_ppNotifyData(PyObject *obj, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_ppNotifyData; if (object->out.ppNotifyData == NULL) { Py_RETURN_NONE; } if (*object->out.ppNotifyData == NULL) { py_ppNotifyData = Py_None; Py_INCREF(py_ppNotifyData); } else { py_ppNotifyData = pytalloc_reference_ex(&winspool_PrintPropertiesCollection_Type, *object->out.ppNotifyData, *object->out.ppNotifyData); } return py_ppNotifyData; } static int py_winspool_SyncRefreshRemoteNotifications_out_set_ppNotifyData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.ppNotifyData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.ppNotifyData"); return -1; } object->out.ppNotifyData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.ppNotifyData); if (object->out.ppNotifyData == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.ppNotifyData = NULL; } else { *object->out.ppNotifyData = NULL; PY_CHECK_TYPE(&winspool_PrintPropertiesCollection_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.ppNotifyData = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_winspool_SyncRefreshRemoteNotifications_get_result(PyObject *obj, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_SyncRefreshRemoteNotifications_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_SyncRefreshRemoteNotifications_getsetters[] = { { .name = discard_const_p(char, "in_hRpcHandle"), .get = py_winspool_SyncRefreshRemoteNotifications_in_get_hRpcHandle, .set = py_winspool_SyncRefreshRemoteNotifications_in_set_hRpcHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pNotifyFilter"), .get = py_winspool_SyncRefreshRemoteNotifications_in_get_pNotifyFilter, .set = py_winspool_SyncRefreshRemoteNotifications_in_set_pNotifyFilter, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintPropertiesCollection") }, { .name = discard_const_p(char, "out_ppNotifyData"), .get = py_winspool_SyncRefreshRemoteNotifications_out_get_ppNotifyData, .set = py_winspool_SyncRefreshRemoteNotifications_out_set_ppNotifyData, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintPropertiesCollection") }, { .name = discard_const_p(char, "result"), .get = py_winspool_SyncRefreshRemoteNotifications_get_result, .set = py_winspool_SyncRefreshRemoteNotifications_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_SyncRefreshRemoteNotifications_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_SyncRefreshRemoteNotifications, type); struct winspool_SyncRefreshRemoteNotifications *_self = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pNotifyFilter = talloc_zero(mem_ctx, struct winspool_PrintPropertiesCollection); /* a pointer to a NULL pointer */ _self->out.ppNotifyData = talloc_zero(mem_ctx, struct winspool_PrintPropertiesCollection *); return self; } static PyObject *py_winspool_SyncRefreshRemoteNotifications_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(60); } static PyObject *py_winspool_SyncRefreshRemoteNotifications_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 61) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncRefreshRemoteNotifications_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[60]; 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_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_SyncRefreshRemoteNotifications_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 winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 61) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncRefreshRemoteNotifications_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[60]; 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_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_SyncRefreshRemoteNotifications_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_SyncRefreshRemoteNotifications *object = (struct winspool_SyncRefreshRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 61) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_SyncRefreshRemoteNotifications_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[60]; 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_winspool_SyncRefreshRemoteNotifications_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_SyncRefreshRemoteNotifications_ndr_print(py_obj, "winspool_SyncRefreshRemoteNotifications_in", NDR_IN); } static PyObject *py_winspool_SyncRefreshRemoteNotifications_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_SyncRefreshRemoteNotifications_ndr_print(py_obj, "winspool_SyncRefreshRemoteNotifications_out", NDR_OUT); } static PyMethodDef py_winspool_SyncRefreshRemoteNotifications_methods[] = { { "opnum", (PyCFunction)py_winspool_SyncRefreshRemoteNotifications_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.SyncRefreshRemoteNotifications.opnum() -> 60 (0x3c) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_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_winspool_SyncRefreshRemoteNotifications_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_SyncRefreshRemoteNotifications_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_SyncRefreshRemoteNotifications_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.SyncRefreshRemoteNotifications", .tp_getset = py_winspool_SyncRefreshRemoteNotifications_getsetters, .tp_methods = py_winspool_SyncRefreshRemoteNotifications_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_SyncRefreshRemoteNotifications_new, }; static bool pack_py_winspool_SyncRefreshRemoteNotifications_args_in(PyObject *args, PyObject *kwargs, struct winspool_SyncRefreshRemoteNotifications *r) { PyObject *py_hRpcHandle; PyObject *py_pNotifyFilter; const char *kwnames[] = { "hRpcHandle", "pNotifyFilter", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_SyncRefreshRemoteNotifications", discard_const_p(char *, kwnames), &py_hRpcHandle, &py_pNotifyFilter)) { return false; } if (py_hRpcHandle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hRpcHandle"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hRpcHandle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hRpcHandle)) == NULL) { PyErr_NoMemory(); return false; } r->in.hRpcHandle = *(struct policy_handle *)pytalloc_get_ptr(py_hRpcHandle); if (py_pNotifyFilter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pNotifyFilter"); return false; } r->in.pNotifyFilter = talloc_ptrtype(r, r->in.pNotifyFilter); if (r->in.pNotifyFilter == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&winspool_PrintPropertiesCollection_Type, py_pNotifyFilter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pNotifyFilter)) == NULL) { PyErr_NoMemory(); return false; } r->in.pNotifyFilter = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(py_pNotifyFilter); return true; } static PyObject *unpack_py_winspool_SyncRefreshRemoteNotifications_args_out(struct winspool_SyncRefreshRemoteNotifications *r) { PyObject *result; PyObject *py_ppNotifyData; result = PyTuple_New(2); if (*r->out.ppNotifyData == NULL) { py_ppNotifyData = Py_None; Py_INCREF(py_ppNotifyData); } else { py_ppNotifyData = pytalloc_reference_ex(&winspool_PrintPropertiesCollection_Type, *r->out.ppNotifyData, *r->out.ppNotifyData); } PyTuple_SetItem(result, 0, py_ppNotifyData); PyTuple_SetItem(result, 1, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_AsyncGetRemoteNotifications_in_get_hRpcHandle(PyObject *obj, void *closure) { struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_hRpcHandle; py_hRpcHandle = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hRpcHandle); return py_hRpcHandle; } static int py_winspool_AsyncGetRemoteNotifications_in_set_hRpcHandle(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hRpcHandle"); return -1; } PY_CHECK_TYPE(policy_handle_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.hRpcHandle = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetRemoteNotifications_out_get_ppNotifyData(PyObject *obj, void *closure) { struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_ppNotifyData; if (object->out.ppNotifyData == NULL) { Py_RETURN_NONE; } if (*object->out.ppNotifyData == NULL) { py_ppNotifyData = Py_None; Py_INCREF(py_ppNotifyData); } else { py_ppNotifyData = pytalloc_reference_ex(&winspool_PrintPropertiesCollection_Type, *object->out.ppNotifyData, *object->out.ppNotifyData); } return py_ppNotifyData; } static int py_winspool_AsyncGetRemoteNotifications_out_set_ppNotifyData(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.ppNotifyData)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.ppNotifyData"); return -1; } object->out.ppNotifyData = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.ppNotifyData); if (object->out.ppNotifyData == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.ppNotifyData = NULL; } else { *object->out.ppNotifyData = NULL; PY_CHECK_TYPE(&winspool_PrintPropertiesCollection_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.ppNotifyData = (struct winspool_PrintPropertiesCollection *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_winspool_AsyncGetRemoteNotifications_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_AsyncGetRemoteNotifications_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_AsyncGetRemoteNotifications_getsetters[] = { { .name = discard_const_p(char, "in_hRpcHandle"), .get = py_winspool_AsyncGetRemoteNotifications_in_get_hRpcHandle, .set = py_winspool_AsyncGetRemoteNotifications_in_set_hRpcHandle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_ppNotifyData"), .get = py_winspool_AsyncGetRemoteNotifications_out_get_ppNotifyData, .set = py_winspool_AsyncGetRemoteNotifications_out_set_ppNotifyData, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_PrintPropertiesCollection") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetRemoteNotifications_get_result, .set = py_winspool_AsyncGetRemoteNotifications_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetRemoteNotifications_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetRemoteNotifications, type); struct winspool_AsyncGetRemoteNotifications *_self = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); /* a pointer to a NULL pointer */ _self->out.ppNotifyData = talloc_zero(mem_ctx, struct winspool_PrintPropertiesCollection *); return self; } static PyObject *py_winspool_AsyncGetRemoteNotifications_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(61); } static PyObject *py_winspool_AsyncGetRemoteNotifications_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 62) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetRemoteNotifications_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[61]; 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_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetRemoteNotifications_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 winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 62) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetRemoteNotifications_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[61]; 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_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetRemoteNotifications_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetRemoteNotifications *object = (struct winspool_AsyncGetRemoteNotifications *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 62) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetRemoteNotifications_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[61]; 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_winspool_AsyncGetRemoteNotifications_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetRemoteNotifications_ndr_print(py_obj, "winspool_AsyncGetRemoteNotifications_in", NDR_IN); } static PyObject *py_winspool_AsyncGetRemoteNotifications_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetRemoteNotifications_ndr_print(py_obj, "winspool_AsyncGetRemoteNotifications_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetRemoteNotifications_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetRemoteNotifications_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetRemoteNotifications.opnum() -> 61 (0x3d) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_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_winspool_AsyncGetRemoteNotifications_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetRemoteNotifications_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetRemoteNotifications_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetRemoteNotifications", .tp_getset = py_winspool_AsyncGetRemoteNotifications_getsetters, .tp_methods = py_winspool_AsyncGetRemoteNotifications_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetRemoteNotifications_new, }; static bool pack_py_winspool_AsyncGetRemoteNotifications_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetRemoteNotifications *r) { PyObject *py_hRpcHandle; const char *kwnames[] = { "hRpcHandle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:winspool_AsyncGetRemoteNotifications", discard_const_p(char *, kwnames), &py_hRpcHandle)) { return false; } if (py_hRpcHandle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hRpcHandle"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hRpcHandle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hRpcHandle)) == NULL) { PyErr_NoMemory(); return false; } r->in.hRpcHandle = *(struct policy_handle *)pytalloc_get_ptr(py_hRpcHandle); return true; } static PyObject *unpack_py_winspool_AsyncGetRemoteNotifications_args_out(struct winspool_AsyncGetRemoteNotifications *r) { PyObject *result; PyObject *py_ppNotifyData; result = PyTuple_New(2); if (*r->out.ppNotifyData == NULL) { py_ppNotifyData = Py_None; Py_INCREF(py_ppNotifyData); } else { py_ppNotifyData = pytalloc_reference_ex(&winspool_PrintPropertiesCollection_Type, *r->out.ppNotifyData, *r->out.ppNotifyData); } PyTuple_SetItem(result, 0, py_ppNotifyData); PyTuple_SetItem(result, 1, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszServer(PyObject *obj, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(obj); PyObject *py_pszServer; if (object->in.pszServer == NULL) { Py_RETURN_NONE; } if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { py_pszServer = PyUnicode_Decode(object->in.pszServer, strlen(object->in.pszServer), "utf-8", "ignore"); } } return py_pszServer; } static int py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszServer"); return -1; } if (value == Py_None) { object->in.pszServer = NULL; } else { object->in.pszServer = 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.pszServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszInfPath(PyObject *obj, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(obj); PyObject *py_pszInfPath; if (object->in.pszInfPath == NULL) { Py_RETURN_NONE; } if (object->in.pszInfPath == NULL) { py_pszInfPath = Py_None; Py_INCREF(py_pszInfPath); } else { if (object->in.pszInfPath == NULL) { py_pszInfPath = Py_None; Py_INCREF(py_pszInfPath); } else { py_pszInfPath = PyUnicode_Decode(object->in.pszInfPath, strlen(object->in.pszInfPath), "utf-8", "ignore"); } } return py_pszInfPath; } static int py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszInfPath(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszInfPath"); return -1; } if (value == Py_None) { object->in.pszInfPath = NULL; } else { object->in.pszInfPath = 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.pszInfPath = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszDriverName(PyObject *obj, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(obj); PyObject *py_pszDriverName; if (object->in.pszDriverName == NULL) { Py_RETURN_NONE; } if (object->in.pszDriverName == NULL) { py_pszDriverName = Py_None; Py_INCREF(py_pszDriverName); } else { py_pszDriverName = PyUnicode_Decode(object->in.pszDriverName, strlen(object->in.pszDriverName), "utf-8", "ignore"); } return py_pszDriverName; } static int py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszDriverName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszDriverName"); return -1; } object->in.pszDriverName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszDriverName); if (object->in.pszDriverName == 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.pszDriverName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(obj); PyObject *py_pszEnvironment; if (object->in.pszEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pszEnvironment == NULL) { py_pszEnvironment = Py_None; Py_INCREF(py_pszEnvironment); } else { py_pszEnvironment = PyUnicode_Decode(object->in.pszEnvironment, strlen(object->in.pszEnvironment), "utf-8", "ignore"); } return py_pszEnvironment; } static int py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszEnvironment"); return -1; } object->in.pszEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszEnvironment); if (object->in.pszEnvironment == 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.pszEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_dwFlags(PyObject *obj, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(obj); PyObject *py_dwFlags; py_dwFlags = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwFlags); return py_dwFlags; } static int py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_dwFlags(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwFlags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwFlags)); 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.dwFlags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_get_result(PyObject *obj, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_AsyncInstallPrinterDriverFromPackage_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_AsyncInstallPrinterDriverFromPackage_getsetters[] = { { .name = discard_const_p(char, "in_pszServer"), .get = py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszServer, .set = py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszInfPath"), .get = py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszInfPath, .set = py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszInfPath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszDriverName"), .get = py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszDriverName, .set = py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszDriverName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszEnvironment"), .get = py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_pszEnvironment, .set = py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_pszEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_dwFlags"), .get = py_winspool_AsyncInstallPrinterDriverFromPackage_in_get_dwFlags, .set = py_winspool_AsyncInstallPrinterDriverFromPackage_in_set_dwFlags, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_InstallPrinterDriverFromPackageFlags") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncInstallPrinterDriverFromPackage_get_result, .set = py_winspool_AsyncInstallPrinterDriverFromPackage_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncInstallPrinterDriverFromPackage, type); return self; } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(62); } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 63) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[62]; 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_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_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 winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 63) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[62]; 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_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncInstallPrinterDriverFromPackage *object = (struct winspool_AsyncInstallPrinterDriverFromPackage *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 63) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[62]; 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_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print(py_obj, "winspool_AsyncInstallPrinterDriverFromPackage_in", NDR_IN); } static PyObject *py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print(py_obj, "winspool_AsyncInstallPrinterDriverFromPackage_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncInstallPrinterDriverFromPackage_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncInstallPrinterDriverFromPackage.opnum() -> 62 (0x3e) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_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_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncInstallPrinterDriverFromPackage_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncInstallPrinterDriverFromPackage_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncInstallPrinterDriverFromPackage", .tp_getset = py_winspool_AsyncInstallPrinterDriverFromPackage_getsetters, .tp_methods = py_winspool_AsyncInstallPrinterDriverFromPackage_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncInstallPrinterDriverFromPackage_new, }; static bool pack_py_winspool_AsyncInstallPrinterDriverFromPackage_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncInstallPrinterDriverFromPackage *r) { PyObject *py_pszServer; PyObject *py_pszInfPath; PyObject *py_pszDriverName; PyObject *py_pszEnvironment; PyObject *py_dwFlags; const char *kwnames[] = { "pszServer", "pszInfPath", "pszDriverName", "pszEnvironment", "dwFlags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncInstallPrinterDriverFromPackage", discard_const_p(char *, kwnames), &py_pszServer, &py_pszInfPath, &py_pszDriverName, &py_pszEnvironment, &py_dwFlags)) { return false; } if (py_pszServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszServer"); return false; } if (py_pszServer == Py_None) { r->in.pszServer = NULL; } else { r->in.pszServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszServer)) { unicode = PyUnicode_AsEncodedString(py_pszServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszServer)) { test_str = PyBytes_AS_STRING(py_pszServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszServer)->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.pszServer = talloc_str; } } if (py_pszInfPath == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszInfPath"); return false; } if (py_pszInfPath == Py_None) { r->in.pszInfPath = NULL; } else { r->in.pszInfPath = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszInfPath)) { unicode = PyUnicode_AsEncodedString(py_pszInfPath, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszInfPath)) { test_str = PyBytes_AS_STRING(py_pszInfPath); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszInfPath)->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.pszInfPath = talloc_str; } } if (py_pszDriverName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszDriverName"); return false; } r->in.pszDriverName = talloc_ptrtype(r, r->in.pszDriverName); if (r->in.pszDriverName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszDriverName)) { unicode = PyUnicode_AsEncodedString(py_pszDriverName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszDriverName)) { test_str = PyBytes_AS_STRING(py_pszDriverName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszDriverName)->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.pszDriverName = talloc_str; } if (py_pszEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszEnvironment"); return false; } r->in.pszEnvironment = talloc_ptrtype(r, r->in.pszEnvironment); if (r->in.pszEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pszEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszEnvironment)) { test_str = PyBytes_AS_STRING(py_pszEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszEnvironment)->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.pszEnvironment = talloc_str; } if (py_dwFlags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwFlags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwFlags)); if (PyLong_Check(py_dwFlags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwFlags); 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.dwFlags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncInstallPrinterDriverFromPackage_args_out(struct winspool_AsyncInstallPrinterDriverFromPackage *r) { PyObject *result; result = PyErr_FromHRESULT(r->out.result); return result; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszServer(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszServer; if (object->in.pszServer == NULL) { Py_RETURN_NONE; } if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { py_pszServer = PyUnicode_Decode(object->in.pszServer, strlen(object->in.pszServer), "utf-8", "ignore"); } } return py_pszServer; } static int py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszServer"); return -1; } if (value == Py_None) { object->in.pszServer = NULL; } else { object->in.pszServer = 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.pszServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszInfPath(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszInfPath; if (object->in.pszInfPath == NULL) { Py_RETURN_NONE; } if (object->in.pszInfPath == NULL) { py_pszInfPath = Py_None; Py_INCREF(py_pszInfPath); } else { py_pszInfPath = PyUnicode_Decode(object->in.pszInfPath, strlen(object->in.pszInfPath), "utf-8", "ignore"); } return py_pszInfPath; } static int py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszInfPath(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszInfPath"); return -1; } object->in.pszInfPath = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszInfPath); if (object->in.pszInfPath == 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.pszInfPath = talloc_str; } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszEnvironment; if (object->in.pszEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pszEnvironment == NULL) { py_pszEnvironment = Py_None; Py_INCREF(py_pszEnvironment); } else { py_pszEnvironment = PyUnicode_Decode(object->in.pszEnvironment, strlen(object->in.pszEnvironment), "utf-8", "ignore"); } return py_pszEnvironment; } static int py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszEnvironment"); return -1; } object->in.pszEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszEnvironment); if (object->in.pszEnvironment == 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.pszEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_in_get_dwFlags(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_dwFlags; py_dwFlags = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwFlags); return py_dwFlags; } static int py_winspool_AsyncUploadPrinterDriverPackage_in_set_dwFlags(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwFlags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwFlags)); 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.dwFlags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszDestInfPath(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszDestInfPath; if (object->in.pszDestInfPath == NULL) { Py_RETURN_NONE; } if (object->in.pszDestInfPath == NULL) { py_pszDestInfPath = Py_None; Py_INCREF(py_pszDestInfPath); } else { if (object->in.pszDestInfPath == NULL) { py_pszDestInfPath = Py_None; Py_INCREF(py_pszDestInfPath); } else { py_pszDestInfPath = PyUnicode_Decode(object->in.pszDestInfPath, strlen(object->in.pszDestInfPath), "utf-8", "ignore"); } } return py_pszDestInfPath; } static int py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszDestInfPath(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszDestInfPath"); return -1; } if (value == Py_None) { object->in.pszDestInfPath = NULL; } else { object->in.pszDestInfPath = 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.pszDestInfPath = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_out_get_pszDestInfPath(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszDestInfPath; if (object->out.pszDestInfPath == NULL) { Py_RETURN_NONE; } if (object->out.pszDestInfPath == NULL) { py_pszDestInfPath = Py_None; Py_INCREF(py_pszDestInfPath); } else { if (object->out.pszDestInfPath == NULL) { py_pszDestInfPath = Py_None; Py_INCREF(py_pszDestInfPath); } else { py_pszDestInfPath = PyUnicode_Decode(object->out.pszDestInfPath, strlen(object->out.pszDestInfPath), "utf-8", "ignore"); } } return py_pszDestInfPath; } static int py_winspool_AsyncUploadPrinterDriverPackage_out_set_pszDestInfPath(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pszDestInfPath"); return -1; } if (value == Py_None) { object->out.pszDestInfPath = NULL; } else { object->out.pszDestInfPath = 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.pszDestInfPath = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_in_get_pcchDestInfPath(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pcchDestInfPath; if (object->in.pcchDestInfPath == NULL) { Py_RETURN_NONE; } py_pcchDestInfPath = PyLong_FromUnsignedLongLong((uint32_t)*object->in.pcchDestInfPath); return py_pcchDestInfPath; } static int py_winspool_AsyncUploadPrinterDriverPackage_in_set_pcchDestInfPath(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pcchDestInfPath)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pcchDestInfPath"); return -1; } object->in.pcchDestInfPath = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pcchDestInfPath); if (object->in.pcchDestInfPath == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.pcchDestInfPath)); 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.pcchDestInfPath = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_out_get_pcchDestInfPath(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pcchDestInfPath; if (object->out.pcchDestInfPath == NULL) { Py_RETURN_NONE; } py_pcchDestInfPath = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcchDestInfPath); return py_pcchDestInfPath; } static int py_winspool_AsyncUploadPrinterDriverPackage_out_set_pcchDestInfPath(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcchDestInfPath)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcchDestInfPath"); return -1; } object->out.pcchDestInfPath = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcchDestInfPath); if (object->out.pcchDestInfPath == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcchDestInfPath)); 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.pcchDestInfPath = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_get_result(PyObject *obj, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_AsyncUploadPrinterDriverPackage_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_AsyncUploadPrinterDriverPackage_getsetters[] = { { .name = discard_const_p(char, "in_pszServer"), .get = py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszServer, .set = py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszInfPath"), .get = py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszInfPath, .set = py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszInfPath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszEnvironment"), .get = py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszEnvironment, .set = py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_dwFlags"), .get = py_winspool_AsyncUploadPrinterDriverPackage_in_get_dwFlags, .set = py_winspool_AsyncUploadPrinterDriverPackage_in_set_dwFlags, .doc = discard_const_p(char, "PIDL-generated element of base type winspool_UploadPrinterDriverPackageFlags") }, { .name = discard_const_p(char, "in_pszDestInfPath"), .get = py_winspool_AsyncUploadPrinterDriverPackage_in_get_pszDestInfPath, .set = py_winspool_AsyncUploadPrinterDriverPackage_in_set_pszDestInfPath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pszDestInfPath"), .get = py_winspool_AsyncUploadPrinterDriverPackage_out_get_pszDestInfPath, .set = py_winspool_AsyncUploadPrinterDriverPackage_out_set_pszDestInfPath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pcchDestInfPath"), .get = py_winspool_AsyncUploadPrinterDriverPackage_in_get_pcchDestInfPath, .set = py_winspool_AsyncUploadPrinterDriverPackage_in_set_pcchDestInfPath, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcchDestInfPath"), .get = py_winspool_AsyncUploadPrinterDriverPackage_out_get_pcchDestInfPath, .set = py_winspool_AsyncUploadPrinterDriverPackage_out_set_pcchDestInfPath, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncUploadPrinterDriverPackage_get_result, .set = py_winspool_AsyncUploadPrinterDriverPackage_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncUploadPrinterDriverPackage, type); struct winspool_AsyncUploadPrinterDriverPackage *_self = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pcchDestInfPath = talloc_zero(mem_ctx, uint32_t); _self->out.pcchDestInfPath = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(63); } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 64) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncUploadPrinterDriverPackage_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[63]; 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_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_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 winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 64) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncUploadPrinterDriverPackage_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[63]; 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_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncUploadPrinterDriverPackage *object = (struct winspool_AsyncUploadPrinterDriverPackage *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 64) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncUploadPrinterDriverPackage_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[63]; 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_winspool_AsyncUploadPrinterDriverPackage_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncUploadPrinterDriverPackage_ndr_print(py_obj, "winspool_AsyncUploadPrinterDriverPackage_in", NDR_IN); } static PyObject *py_winspool_AsyncUploadPrinterDriverPackage_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncUploadPrinterDriverPackage_ndr_print(py_obj, "winspool_AsyncUploadPrinterDriverPackage_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncUploadPrinterDriverPackage_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncUploadPrinterDriverPackage_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncUploadPrinterDriverPackage.opnum() -> 63 (0x3f) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_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_winspool_AsyncUploadPrinterDriverPackage_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncUploadPrinterDriverPackage_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncUploadPrinterDriverPackage_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncUploadPrinterDriverPackage", .tp_getset = py_winspool_AsyncUploadPrinterDriverPackage_getsetters, .tp_methods = py_winspool_AsyncUploadPrinterDriverPackage_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncUploadPrinterDriverPackage_new, }; static bool pack_py_winspool_AsyncUploadPrinterDriverPackage_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncUploadPrinterDriverPackage *r) { PyObject *py_pszServer; PyObject *py_pszInfPath; PyObject *py_pszEnvironment; PyObject *py_dwFlags; PyObject *py_pszDestInfPath; const char *kwnames[] = { "pszServer", "pszInfPath", "pszEnvironment", "dwFlags", "pszDestInfPath", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncUploadPrinterDriverPackage", discard_const_p(char *, kwnames), &py_pszServer, &py_pszInfPath, &py_pszEnvironment, &py_dwFlags, &py_pszDestInfPath)) { return false; } if (py_pszServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszServer"); return false; } if (py_pszServer == Py_None) { r->in.pszServer = NULL; } else { r->in.pszServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszServer)) { unicode = PyUnicode_AsEncodedString(py_pszServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszServer)) { test_str = PyBytes_AS_STRING(py_pszServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszServer)->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.pszServer = talloc_str; } } if (py_pszInfPath == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszInfPath"); return false; } r->in.pszInfPath = talloc_ptrtype(r, r->in.pszInfPath); if (r->in.pszInfPath == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszInfPath)) { unicode = PyUnicode_AsEncodedString(py_pszInfPath, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszInfPath)) { test_str = PyBytes_AS_STRING(py_pszInfPath); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszInfPath)->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.pszInfPath = talloc_str; } if (py_pszEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszEnvironment"); return false; } r->in.pszEnvironment = talloc_ptrtype(r, r->in.pszEnvironment); if (r->in.pszEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pszEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszEnvironment)) { test_str = PyBytes_AS_STRING(py_pszEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszEnvironment)->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.pszEnvironment = talloc_str; } if (py_dwFlags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwFlags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwFlags)); if (PyLong_Check(py_dwFlags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwFlags); 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.dwFlags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pszDestInfPath == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszDestInfPath"); return false; } if (py_pszDestInfPath == Py_None) { r->in.pszDestInfPath = NULL; } else { r->in.pszDestInfPath = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszDestInfPath)) { unicode = PyUnicode_AsEncodedString(py_pszDestInfPath, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszDestInfPath)) { test_str = PyBytes_AS_STRING(py_pszDestInfPath); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszDestInfPath)->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.pszDestInfPath = talloc_str; } } PY_CHECK_TYPE(&PyList_Type, py_pszDestInfPath, return false;); r->in.pcchDestInfPath = talloc_ptrtype(r, r->in.pcchDestInfPath); if (r->in.pcchDestInfPath == NULL) { PyErr_NoMemory(); return false; } *r->in.pcchDestInfPath = PyList_GET_SIZE(py_pszDestInfPath); return true; } static PyObject *unpack_py_winspool_AsyncUploadPrinterDriverPackage_args_out(struct winspool_AsyncUploadPrinterDriverPackage *r) { PyObject *result; PyObject *py_pszDestInfPath; result = PyTuple_New(2); if (r->out.pszDestInfPath == NULL) { py_pszDestInfPath = Py_None; Py_INCREF(py_pszDestInfPath); } else { if (r->out.pszDestInfPath == NULL) { py_pszDestInfPath = Py_None; Py_INCREF(py_pszDestInfPath); } else { py_pszDestInfPath = PyUnicode_Decode(r->out.pszDestInfPath, strlen(r->out.pszDestInfPath), "utf-8", "ignore"); } } PyTuple_SetItem(result, 0, py_pszDestInfPath); PyTuple_SetItem(result, 1, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_in_get_pszServer(PyObject *obj, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pszServer; if (object->in.pszServer == NULL) { Py_RETURN_NONE; } if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { py_pszServer = PyUnicode_Decode(object->in.pszServer, strlen(object->in.pszServer), "utf-8", "ignore"); } } return py_pszServer; } static int py_winspool_AsyncGetCorePrinterDrivers_in_set_pszServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszServer"); return -1; } if (value == Py_None) { object->in.pszServer = NULL; } else { object->in.pszServer = 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.pszServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_in_get_pszEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pszEnvironment; if (object->in.pszEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pszEnvironment == NULL) { py_pszEnvironment = Py_None; Py_INCREF(py_pszEnvironment); } else { py_pszEnvironment = PyUnicode_Decode(object->in.pszEnvironment, strlen(object->in.pszEnvironment), "utf-8", "ignore"); } return py_pszEnvironment; } static int py_winspool_AsyncGetCorePrinterDrivers_in_set_pszEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszEnvironment"); return -1; } object->in.pszEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszEnvironment); if (object->in.pszEnvironment == 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.pszEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_in_get_cchCoreDrivers(PyObject *obj, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_cchCoreDrivers; py_cchCoreDrivers = PyLong_FromUnsignedLongLong((uint32_t)object->in.cchCoreDrivers); return py_cchCoreDrivers; } static int py_winspool_AsyncGetCorePrinterDrivers_in_set_cchCoreDrivers(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cchCoreDrivers"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cchCoreDrivers)); 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.cchCoreDrivers = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_in_get_pszzCoreDriverDependencies(PyObject *obj, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pszzCoreDriverDependencies; if (object->in.pszzCoreDriverDependencies == NULL) { Py_RETURN_NONE; } py_pszzCoreDriverDependencies = PyList_New(object->in.cchCoreDrivers); if (py_pszzCoreDriverDependencies == NULL) { return NULL; } { int pszzCoreDriverDependencies_cntr_1; for (pszzCoreDriverDependencies_cntr_1 = 0; pszzCoreDriverDependencies_cntr_1 < (object->in.cchCoreDrivers); pszzCoreDriverDependencies_cntr_1++) { PyObject *py_pszzCoreDriverDependencies_1; py_pszzCoreDriverDependencies_1 = PyLong_FromLong((uint16_t)object->in.pszzCoreDriverDependencies[pszzCoreDriverDependencies_cntr_1]); PyList_SetItem(py_pszzCoreDriverDependencies, pszzCoreDriverDependencies_cntr_1, py_pszzCoreDriverDependencies_1); } } return py_pszzCoreDriverDependencies; } static int py_winspool_AsyncGetCorePrinterDrivers_in_set_pszzCoreDriverDependencies(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pszzCoreDriverDependencies)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszzCoreDriverDependencies"); return -1; } object->in.pszzCoreDriverDependencies = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszzCoreDriverDependencies); if (object->in.pszzCoreDriverDependencies == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pszzCoreDriverDependencies_cntr_1; object->in.pszzCoreDriverDependencies = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszzCoreDriverDependencies, PyList_GET_SIZE(value)); if (!object->in.pszzCoreDriverDependencies) { return -1;; } talloc_set_name_const(object->in.pszzCoreDriverDependencies, "ARRAY: object->in.pszzCoreDriverDependencies"); for (pszzCoreDriverDependencies_cntr_1 = 0; pszzCoreDriverDependencies_cntr_1 < PyList_GET_SIZE(value); pszzCoreDriverDependencies_cntr_1++) { if (PyList_GET_ITEM(value, pszzCoreDriverDependencies_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszzCoreDriverDependencies[pszzCoreDriverDependencies_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pszzCoreDriverDependencies[pszzCoreDriverDependencies_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pszzCoreDriverDependencies_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pszzCoreDriverDependencies_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->in.pszzCoreDriverDependencies[pszzCoreDriverDependencies_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_in_get_cCorePrinterDrivers(PyObject *obj, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_cCorePrinterDrivers; py_cCorePrinterDrivers = PyLong_FromUnsignedLongLong((uint32_t)object->in.cCorePrinterDrivers); return py_cCorePrinterDrivers; } static int py_winspool_AsyncGetCorePrinterDrivers_in_set_cCorePrinterDrivers(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cCorePrinterDrivers"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cCorePrinterDrivers)); 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.cCorePrinterDrivers = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_out_get_pCorePrinterDrivers(PyObject *obj, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_pCorePrinterDrivers; if (object->out.pCorePrinterDrivers == NULL) { Py_RETURN_NONE; } py_pCorePrinterDrivers = PyList_New(object->in.cCorePrinterDrivers); if (py_pCorePrinterDrivers == NULL) { return NULL; } { int pCorePrinterDrivers_cntr_1; for (pCorePrinterDrivers_cntr_1 = 0; pCorePrinterDrivers_cntr_1 < (object->in.cCorePrinterDrivers); pCorePrinterDrivers_cntr_1++) { PyObject *py_pCorePrinterDrivers_1; py_pCorePrinterDrivers_1 = pytalloc_reference_ex(spoolss_CorePrinterDriver_Type, object->out.pCorePrinterDrivers, &object->out.pCorePrinterDrivers[pCorePrinterDrivers_cntr_1]); PyList_SetItem(py_pCorePrinterDrivers, pCorePrinterDrivers_cntr_1, py_pCorePrinterDrivers_1); } } return py_pCorePrinterDrivers; } static int py_winspool_AsyncGetCorePrinterDrivers_out_set_pCorePrinterDrivers(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pCorePrinterDrivers)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pCorePrinterDrivers"); return -1; } object->out.pCorePrinterDrivers = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pCorePrinterDrivers); if (object->out.pCorePrinterDrivers == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pCorePrinterDrivers_cntr_1; object->out.pCorePrinterDrivers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pCorePrinterDrivers, PyList_GET_SIZE(value)); if (!object->out.pCorePrinterDrivers) { return -1;; } talloc_set_name_const(object->out.pCorePrinterDrivers, "ARRAY: object->out.pCorePrinterDrivers"); for (pCorePrinterDrivers_cntr_1 = 0; pCorePrinterDrivers_cntr_1 < PyList_GET_SIZE(value); pCorePrinterDrivers_cntr_1++) { if (PyList_GET_ITEM(value, pCorePrinterDrivers_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pCorePrinterDrivers[pCorePrinterDrivers_cntr_1]"); return -1; } PY_CHECK_TYPE(spoolss_CorePrinterDriver_Type, PyList_GET_ITEM(value, pCorePrinterDrivers_cntr_1), return -1;); if (talloc_reference(object->out.pCorePrinterDrivers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, pCorePrinterDrivers_cntr_1))) == NULL) { PyErr_NoMemory(); return -1; } object->out.pCorePrinterDrivers[pCorePrinterDrivers_cntr_1] = *(struct spoolss_CorePrinterDriver *)pytalloc_get_ptr(PyList_GET_ITEM(value, pCorePrinterDrivers_cntr_1)); } } return 0; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_AsyncGetCorePrinterDrivers_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_AsyncGetCorePrinterDrivers_getsetters[] = { { .name = discard_const_p(char, "in_pszServer"), .get = py_winspool_AsyncGetCorePrinterDrivers_in_get_pszServer, .set = py_winspool_AsyncGetCorePrinterDrivers_in_set_pszServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszEnvironment"), .get = py_winspool_AsyncGetCorePrinterDrivers_in_get_pszEnvironment, .set = py_winspool_AsyncGetCorePrinterDrivers_in_set_pszEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_cchCoreDrivers"), .get = py_winspool_AsyncGetCorePrinterDrivers_in_get_cchCoreDrivers, .set = py_winspool_AsyncGetCorePrinterDrivers_in_set_cchCoreDrivers, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pszzCoreDriverDependencies"), .get = py_winspool_AsyncGetCorePrinterDrivers_in_get_pszzCoreDriverDependencies, .set = py_winspool_AsyncGetCorePrinterDrivers_in_set_pszzCoreDriverDependencies, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_cCorePrinterDrivers"), .get = py_winspool_AsyncGetCorePrinterDrivers_in_get_cCorePrinterDrivers, .set = py_winspool_AsyncGetCorePrinterDrivers_in_set_cCorePrinterDrivers, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pCorePrinterDrivers"), .get = py_winspool_AsyncGetCorePrinterDrivers_out_get_pCorePrinterDrivers, .set = py_winspool_AsyncGetCorePrinterDrivers_out_set_pCorePrinterDrivers, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_CorePrinterDriver") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetCorePrinterDrivers_get_result, .set = py_winspool_AsyncGetCorePrinterDrivers_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetCorePrinterDrivers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetCorePrinterDrivers, type); struct winspool_AsyncGetCorePrinterDrivers *_self = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pszzCoreDriverDependencies = talloc_zero(mem_ctx, uint16_t); _self->out.pCorePrinterDrivers = talloc_zero(mem_ctx, struct spoolss_CorePrinterDriver); return self; } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(64); } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 65) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetCorePrinterDrivers_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[64]; 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_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_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 winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 65) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetCorePrinterDrivers_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[64]; 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_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetCorePrinterDrivers *object = (struct winspool_AsyncGetCorePrinterDrivers *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 65) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetCorePrinterDrivers_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[64]; 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_winspool_AsyncGetCorePrinterDrivers_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetCorePrinterDrivers_ndr_print(py_obj, "winspool_AsyncGetCorePrinterDrivers_in", NDR_IN); } static PyObject *py_winspool_AsyncGetCorePrinterDrivers_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetCorePrinterDrivers_ndr_print(py_obj, "winspool_AsyncGetCorePrinterDrivers_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetCorePrinterDrivers_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetCorePrinterDrivers_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetCorePrinterDrivers.opnum() -> 64 (0x40) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_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_winspool_AsyncGetCorePrinterDrivers_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetCorePrinterDrivers_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetCorePrinterDrivers_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetCorePrinterDrivers", .tp_getset = py_winspool_AsyncGetCorePrinterDrivers_getsetters, .tp_methods = py_winspool_AsyncGetCorePrinterDrivers_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetCorePrinterDrivers_new, }; static bool pack_py_winspool_AsyncGetCorePrinterDrivers_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetCorePrinterDrivers *r) { PyObject *py_pszServer; PyObject *py_pszEnvironment; PyObject *py_pszzCoreDriverDependencies; PyObject *py_cCorePrinterDrivers; const char *kwnames[] = { "pszServer", "pszEnvironment", "pszzCoreDriverDependencies", "cCorePrinterDrivers", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:winspool_AsyncGetCorePrinterDrivers", discard_const_p(char *, kwnames), &py_pszServer, &py_pszEnvironment, &py_pszzCoreDriverDependencies, &py_cCorePrinterDrivers)) { return false; } if (py_pszServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszServer"); return false; } if (py_pszServer == Py_None) { r->in.pszServer = NULL; } else { r->in.pszServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszServer)) { unicode = PyUnicode_AsEncodedString(py_pszServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszServer)) { test_str = PyBytes_AS_STRING(py_pszServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszServer)->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.pszServer = talloc_str; } } if (py_pszEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszEnvironment"); return false; } r->in.pszEnvironment = talloc_ptrtype(r, r->in.pszEnvironment); if (r->in.pszEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pszEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszEnvironment)) { test_str = PyBytes_AS_STRING(py_pszEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszEnvironment)->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.pszEnvironment = talloc_str; } PY_CHECK_TYPE(&PyList_Type, py_pszzCoreDriverDependencies, return false;); r->in.cchCoreDrivers = PyList_GET_SIZE(py_pszzCoreDriverDependencies); if (py_pszzCoreDriverDependencies == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszzCoreDriverDependencies"); return false; } r->in.pszzCoreDriverDependencies = talloc_ptrtype(r, r->in.pszzCoreDriverDependencies); if (r->in.pszzCoreDriverDependencies == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PyList_Type, py_pszzCoreDriverDependencies, return false;); { int pszzCoreDriverDependencies_cntr_1; r->in.pszzCoreDriverDependencies = talloc_array_ptrtype(r, r->in.pszzCoreDriverDependencies, PyList_GET_SIZE(py_pszzCoreDriverDependencies)); if (!r->in.pszzCoreDriverDependencies) { return false;; } talloc_set_name_const(r->in.pszzCoreDriverDependencies, "ARRAY: r->in.pszzCoreDriverDependencies"); for (pszzCoreDriverDependencies_cntr_1 = 0; pszzCoreDriverDependencies_cntr_1 < PyList_GET_SIZE(py_pszzCoreDriverDependencies); pszzCoreDriverDependencies_cntr_1++) { if (PyList_GET_ITEM(py_pszzCoreDriverDependencies, pszzCoreDriverDependencies_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszzCoreDriverDependencies[pszzCoreDriverDependencies_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pszzCoreDriverDependencies[pszzCoreDriverDependencies_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pszzCoreDriverDependencies, pszzCoreDriverDependencies_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pszzCoreDriverDependencies, pszzCoreDriverDependencies_cntr_1)); 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.pszzCoreDriverDependencies[pszzCoreDriverDependencies_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } if (py_cCorePrinterDrivers == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cCorePrinterDrivers"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cCorePrinterDrivers)); if (PyLong_Check(py_cCorePrinterDrivers)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cCorePrinterDrivers); 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.cCorePrinterDrivers = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncGetCorePrinterDrivers_args_out(struct winspool_AsyncGetCorePrinterDrivers *r) { PyObject *result; PyObject *py_pCorePrinterDrivers; result = PyTuple_New(2); py_pCorePrinterDrivers = PyList_New(r->in.cCorePrinterDrivers); if (py_pCorePrinterDrivers == NULL) { return NULL; } { int pCorePrinterDrivers_cntr_1; for (pCorePrinterDrivers_cntr_1 = 0; pCorePrinterDrivers_cntr_1 < (r->in.cCorePrinterDrivers); pCorePrinterDrivers_cntr_1++) { PyObject *py_pCorePrinterDrivers_1; py_pCorePrinterDrivers_1 = pytalloc_reference_ex(spoolss_CorePrinterDriver_Type, r->out.pCorePrinterDrivers, &r->out.pCorePrinterDrivers[pCorePrinterDrivers_cntr_1]); PyList_SetItem(py_pCorePrinterDrivers, pCorePrinterDrivers_cntr_1, py_pCorePrinterDrivers_1); } } PyTuple_SetItem(result, 0, py_pCorePrinterDrivers); PyTuple_SetItem(result, 1, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_in_get_pszServer(PyObject *obj, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(obj); PyObject *py_pszServer; if (object->in.pszServer == NULL) { Py_RETURN_NONE; } if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { py_pszServer = PyUnicode_Decode(object->in.pszServer, strlen(object->in.pszServer), "utf-8", "ignore"); } } return py_pszServer; } static int py_winspool_AsyncCorePrinterDriverInstalled_in_set_pszServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszServer"); return -1; } if (value == Py_None) { object->in.pszServer = NULL; } else { object->in.pszServer = 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.pszServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_in_get_pszEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(obj); PyObject *py_pszEnvironment; if (object->in.pszEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pszEnvironment == NULL) { py_pszEnvironment = Py_None; Py_INCREF(py_pszEnvironment); } else { py_pszEnvironment = PyUnicode_Decode(object->in.pszEnvironment, strlen(object->in.pszEnvironment), "utf-8", "ignore"); } return py_pszEnvironment; } static int py_winspool_AsyncCorePrinterDriverInstalled_in_set_pszEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszEnvironment"); return -1; } object->in.pszEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszEnvironment); if (object->in.pszEnvironment == 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.pszEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_in_get_CoreDriverGUID(PyObject *obj, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(obj); PyObject *py_CoreDriverGUID; py_CoreDriverGUID = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->in.CoreDriverGUID); return py_CoreDriverGUID; } static int py_winspool_AsyncCorePrinterDriverInstalled_in_set_CoreDriverGUID(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.CoreDriverGUID"); return -1; } PY_CHECK_TYPE(GUID_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.CoreDriverGUID = *(struct GUID *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_in_get_ftDriverDate(PyObject *obj, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(obj); PyObject *py_ftDriverDate; py_ftDriverDate = PyLong_FromUnsignedLongLong(object->in.ftDriverDate); return py_ftDriverDate; } static int py_winspool_AsyncCorePrinterDriverInstalled_in_set_ftDriverDate(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.ftDriverDate"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.ftDriverDate)); 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.ftDriverDate = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_in_get_dwlDriverVersion(PyObject *obj, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(obj); PyObject *py_dwlDriverVersion; py_dwlDriverVersion = PyLong_FromUnsignedLongLong(object->in.dwlDriverVersion); return py_dwlDriverVersion; } static int py_winspool_AsyncCorePrinterDriverInstalled_in_set_dwlDriverVersion(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwlDriverVersion"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwlDriverVersion)); 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.dwlDriverVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_out_get_pbDriverInstalled(PyObject *obj, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(obj); PyObject *py_pbDriverInstalled; if (object->out.pbDriverInstalled == NULL) { Py_RETURN_NONE; } py_pbDriverInstalled = PyLong_FromLong(*object->out.pbDriverInstalled); return py_pbDriverInstalled; } static int py_winspool_AsyncCorePrinterDriverInstalled_out_set_pbDriverInstalled(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pbDriverInstalled)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pbDriverInstalled"); return -1; } object->out.pbDriverInstalled = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pbDriverInstalled); if (object->out.pbDriverInstalled == NULL) { PyErr_NoMemory(); return -1; } { const long long int_max = ndr_sizeof2intmax(sizeof(*object->out.pbDriverInstalled)); const long long int_min = -int_max - 1; if (PyLong_Check(value)) { long long test_var; test_var = PyLong_AsLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var < int_min || test_var > int_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",\ PyLong_Type.tp_name, int_min, int_max, test_var); return -1; } *object->out.pbDriverInstalled = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_get_result(PyObject *obj, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_AsyncCorePrinterDriverInstalled_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_AsyncCorePrinterDriverInstalled_getsetters[] = { { .name = discard_const_p(char, "in_pszServer"), .get = py_winspool_AsyncCorePrinterDriverInstalled_in_get_pszServer, .set = py_winspool_AsyncCorePrinterDriverInstalled_in_set_pszServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszEnvironment"), .get = py_winspool_AsyncCorePrinterDriverInstalled_in_get_pszEnvironment, .set = py_winspool_AsyncCorePrinterDriverInstalled_in_set_pszEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_CoreDriverGUID"), .get = py_winspool_AsyncCorePrinterDriverInstalled_in_get_CoreDriverGUID, .set = py_winspool_AsyncCorePrinterDriverInstalled_in_set_CoreDriverGUID, .doc = discard_const_p(char, "PIDL-generated element of base type GUID") }, { .name = discard_const_p(char, "in_ftDriverDate"), .get = py_winspool_AsyncCorePrinterDriverInstalled_in_get_ftDriverDate, .set = py_winspool_AsyncCorePrinterDriverInstalled_in_set_ftDriverDate, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "in_dwlDriverVersion"), .get = py_winspool_AsyncCorePrinterDriverInstalled_in_get_dwlDriverVersion, .set = py_winspool_AsyncCorePrinterDriverInstalled_in_set_dwlDriverVersion, .doc = discard_const_p(char, "PIDL-generated element of base type hyper") }, { .name = discard_const_p(char, "out_pbDriverInstalled"), .get = py_winspool_AsyncCorePrinterDriverInstalled_out_get_pbDriverInstalled, .set = py_winspool_AsyncCorePrinterDriverInstalled_out_set_pbDriverInstalled, .doc = discard_const_p(char, "PIDL-generated element of base type int32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncCorePrinterDriverInstalled_get_result, .set = py_winspool_AsyncCorePrinterDriverInstalled_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncCorePrinterDriverInstalled, type); struct winspool_AsyncCorePrinterDriverInstalled *_self = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pbDriverInstalled = talloc_zero(mem_ctx, int32_t); return self; } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(65); } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 66) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncCorePrinterDriverInstalled_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[65]; 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_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_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 winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 66) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncCorePrinterDriverInstalled_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[65]; 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_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncCorePrinterDriverInstalled *object = (struct winspool_AsyncCorePrinterDriverInstalled *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 66) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncCorePrinterDriverInstalled_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[65]; 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_winspool_AsyncCorePrinterDriverInstalled_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncCorePrinterDriverInstalled_ndr_print(py_obj, "winspool_AsyncCorePrinterDriverInstalled_in", NDR_IN); } static PyObject *py_winspool_AsyncCorePrinterDriverInstalled_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncCorePrinterDriverInstalled_ndr_print(py_obj, "winspool_AsyncCorePrinterDriverInstalled_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncCorePrinterDriverInstalled_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncCorePrinterDriverInstalled_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncCorePrinterDriverInstalled.opnum() -> 65 (0x41) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_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_winspool_AsyncCorePrinterDriverInstalled_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncCorePrinterDriverInstalled_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncCorePrinterDriverInstalled_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncCorePrinterDriverInstalled", .tp_getset = py_winspool_AsyncCorePrinterDriverInstalled_getsetters, .tp_methods = py_winspool_AsyncCorePrinterDriverInstalled_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncCorePrinterDriverInstalled_new, }; static bool pack_py_winspool_AsyncCorePrinterDriverInstalled_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncCorePrinterDriverInstalled *r) { PyObject *py_pszServer; PyObject *py_pszEnvironment; PyObject *py_CoreDriverGUID; PyObject *py_ftDriverDate; PyObject *py_dwlDriverVersion; const char *kwnames[] = { "pszServer", "pszEnvironment", "CoreDriverGUID", "ftDriverDate", "dwlDriverVersion", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncCorePrinterDriverInstalled", discard_const_p(char *, kwnames), &py_pszServer, &py_pszEnvironment, &py_CoreDriverGUID, &py_ftDriverDate, &py_dwlDriverVersion)) { return false; } if (py_pszServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszServer"); return false; } if (py_pszServer == Py_None) { r->in.pszServer = NULL; } else { r->in.pszServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszServer)) { unicode = PyUnicode_AsEncodedString(py_pszServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszServer)) { test_str = PyBytes_AS_STRING(py_pszServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszServer)->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.pszServer = talloc_str; } } if (py_pszEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszEnvironment"); return false; } r->in.pszEnvironment = talloc_ptrtype(r, r->in.pszEnvironment); if (r->in.pszEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pszEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszEnvironment)) { test_str = PyBytes_AS_STRING(py_pszEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszEnvironment)->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.pszEnvironment = talloc_str; } if (py_CoreDriverGUID == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.CoreDriverGUID"); return false; } PY_CHECK_TYPE(GUID_Type, py_CoreDriverGUID, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_CoreDriverGUID)) == NULL) { PyErr_NoMemory(); return false; } r->in.CoreDriverGUID = *(struct GUID *)pytalloc_get_ptr(py_CoreDriverGUID); if (py_ftDriverDate == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.ftDriverDate"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.ftDriverDate)); if (PyLong_Check(py_ftDriverDate)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_ftDriverDate); 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.ftDriverDate = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_dwlDriverVersion == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dwlDriverVersion"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dwlDriverVersion)); if (PyLong_Check(py_dwlDriverVersion)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_dwlDriverVersion); 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.dwlDriverVersion = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncCorePrinterDriverInstalled_args_out(struct winspool_AsyncCorePrinterDriverInstalled *r) { PyObject *result; PyObject *py_pbDriverInstalled; result = PyTuple_New(2); py_pbDriverInstalled = PyLong_FromLong(*r->out.pbDriverInstalled); PyTuple_SetItem(result, 0, py_pbDriverInstalled); PyTuple_SetItem(result, 1, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszServer(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_pszServer; if (object->in.pszServer == NULL) { Py_RETURN_NONE; } if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { py_pszServer = PyUnicode_Decode(object->in.pszServer, strlen(object->in.pszServer), "utf-8", "ignore"); } } return py_pszServer; } static int py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszServer"); return -1; } if (value == Py_None) { object->in.pszServer = NULL; } else { object->in.pszServer = 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.pszServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_pszEnvironment; if (object->in.pszEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pszEnvironment == NULL) { py_pszEnvironment = Py_None; Py_INCREF(py_pszEnvironment); } else { py_pszEnvironment = PyUnicode_Decode(object->in.pszEnvironment, strlen(object->in.pszEnvironment), "utf-8", "ignore"); } return py_pszEnvironment; } static int py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszEnvironment"); return -1; } object->in.pszEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszEnvironment); if (object->in.pszEnvironment == 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.pszEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszLanguage(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_pszLanguage; if (object->in.pszLanguage == NULL) { Py_RETURN_NONE; } if (object->in.pszLanguage == NULL) { py_pszLanguage = Py_None; Py_INCREF(py_pszLanguage); } else { if (object->in.pszLanguage == NULL) { py_pszLanguage = Py_None; Py_INCREF(py_pszLanguage); } else { py_pszLanguage = PyUnicode_Decode(object->in.pszLanguage, strlen(object->in.pszLanguage), "utf-8", "ignore"); } } return py_pszLanguage; } static int py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszLanguage(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszLanguage"); return -1; } if (value == Py_None) { object->in.pszLanguage = NULL; } else { object->in.pszLanguage = 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.pszLanguage = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszPackageID(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_pszPackageID; if (object->in.pszPackageID == NULL) { Py_RETURN_NONE; } if (object->in.pszPackageID == NULL) { py_pszPackageID = Py_None; Py_INCREF(py_pszPackageID); } else { py_pszPackageID = PyUnicode_Decode(object->in.pszPackageID, strlen(object->in.pszPackageID), "utf-8", "ignore"); } return py_pszPackageID; } static int py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszPackageID(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszPackageID"); return -1; } object->in.pszPackageID = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszPackageID); if (object->in.pszPackageID == 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.pszPackageID = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszDriverPackageCab(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_pszDriverPackageCab; if (object->in.pszDriverPackageCab == NULL) { Py_RETURN_NONE; } if (object->in.pszDriverPackageCab == NULL) { py_pszDriverPackageCab = Py_None; Py_INCREF(py_pszDriverPackageCab); } else { py_pszDriverPackageCab = PyList_New(object->in.cchDriverPackageCab); if (py_pszDriverPackageCab == NULL) { return NULL; } { int pszDriverPackageCab_cntr_1; for (pszDriverPackageCab_cntr_1 = 0; pszDriverPackageCab_cntr_1 < (object->in.cchDriverPackageCab); pszDriverPackageCab_cntr_1++) { PyObject *py_pszDriverPackageCab_1; py_pszDriverPackageCab_1 = PyLong_FromLong((uint16_t)object->in.pszDriverPackageCab[pszDriverPackageCab_cntr_1]); PyList_SetItem(py_pszDriverPackageCab, pszDriverPackageCab_cntr_1, py_pszDriverPackageCab_1); } } } return py_pszDriverPackageCab; } static int py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszDriverPackageCab(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pszDriverPackageCab)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszDriverPackageCab"); return -1; } if (value == Py_None) { object->in.pszDriverPackageCab = NULL; } else { object->in.pszDriverPackageCab = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pszDriverPackageCab_cntr_1; object->in.pszDriverPackageCab = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszDriverPackageCab, PyList_GET_SIZE(value)); if (!object->in.pszDriverPackageCab) { return -1;; } talloc_set_name_const(object->in.pszDriverPackageCab, "ARRAY: object->in.pszDriverPackageCab"); for (pszDriverPackageCab_cntr_1 = 0; pszDriverPackageCab_cntr_1 < PyList_GET_SIZE(value); pszDriverPackageCab_cntr_1++) { if (PyList_GET_ITEM(value, pszDriverPackageCab_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszDriverPackageCab[pszDriverPackageCab_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.pszDriverPackageCab[pszDriverPackageCab_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pszDriverPackageCab_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pszDriverPackageCab_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->in.pszDriverPackageCab[pszDriverPackageCab_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_out_get_pszDriverPackageCab(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_pszDriverPackageCab; if (object->out.pszDriverPackageCab == NULL) { Py_RETURN_NONE; } if (object->out.pszDriverPackageCab == NULL) { py_pszDriverPackageCab = Py_None; Py_INCREF(py_pszDriverPackageCab); } else { py_pszDriverPackageCab = PyList_New(object->in.cchDriverPackageCab); if (py_pszDriverPackageCab == NULL) { return NULL; } { int pszDriverPackageCab_cntr_1; for (pszDriverPackageCab_cntr_1 = 0; pszDriverPackageCab_cntr_1 < (object->in.cchDriverPackageCab); pszDriverPackageCab_cntr_1++) { PyObject *py_pszDriverPackageCab_1; py_pszDriverPackageCab_1 = PyLong_FromLong((uint16_t)object->out.pszDriverPackageCab[pszDriverPackageCab_cntr_1]); PyList_SetItem(py_pszDriverPackageCab, pszDriverPackageCab_cntr_1, py_pszDriverPackageCab_1); } } } return py_pszDriverPackageCab; } static int py_winspool_AsyncGetPrinterDriverPackagePath_out_set_pszDriverPackageCab(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pszDriverPackageCab)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pszDriverPackageCab"); return -1; } if (value == Py_None) { object->out.pszDriverPackageCab = NULL; } else { object->out.pszDriverPackageCab = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pszDriverPackageCab_cntr_1; object->out.pszDriverPackageCab = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pszDriverPackageCab, PyList_GET_SIZE(value)); if (!object->out.pszDriverPackageCab) { return -1;; } talloc_set_name_const(object->out.pszDriverPackageCab, "ARRAY: object->out.pszDriverPackageCab"); for (pszDriverPackageCab_cntr_1 = 0; pszDriverPackageCab_cntr_1 < PyList_GET_SIZE(value); pszDriverPackageCab_cntr_1++) { if (PyList_GET_ITEM(value, pszDriverPackageCab_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pszDriverPackageCab[pszDriverPackageCab_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pszDriverPackageCab[pszDriverPackageCab_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pszDriverPackageCab_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pszDriverPackageCab_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.pszDriverPackageCab[pszDriverPackageCab_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_in_get_cchDriverPackageCab(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_cchDriverPackageCab; py_cchDriverPackageCab = PyLong_FromUnsignedLongLong((uint32_t)object->in.cchDriverPackageCab); return py_cchDriverPackageCab; } static int py_winspool_AsyncGetPrinterDriverPackagePath_in_set_cchDriverPackageCab(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cchDriverPackageCab"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cchDriverPackageCab)); 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.cchDriverPackageCab = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_out_get_pcchRequiredSize(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_pcchRequiredSize; if (object->out.pcchRequiredSize == NULL) { Py_RETURN_NONE; } py_pcchRequiredSize = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcchRequiredSize); return py_pcchRequiredSize; } static int py_winspool_AsyncGetPrinterDriverPackagePath_out_set_pcchRequiredSize(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcchRequiredSize)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcchRequiredSize"); return -1; } object->out.pcchRequiredSize = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcchRequiredSize); if (object->out.pcchRequiredSize == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcchRequiredSize)); 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.pcchRequiredSize = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_AsyncGetPrinterDriverPackagePath_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_AsyncGetPrinterDriverPackagePath_getsetters[] = { { .name = discard_const_p(char, "in_pszServer"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszServer, .set = py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszEnvironment"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszEnvironment, .set = py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszLanguage"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszLanguage, .set = py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszLanguage, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszPackageID"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszPackageID, .set = py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszPackageID, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszDriverPackageCab"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_in_get_pszDriverPackageCab, .set = py_winspool_AsyncGetPrinterDriverPackagePath_in_set_pszDriverPackageCab, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pszDriverPackageCab"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_out_get_pszDriverPackageCab, .set = py_winspool_AsyncGetPrinterDriverPackagePath_out_set_pszDriverPackageCab, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_cchDriverPackageCab"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_in_get_cchDriverPackageCab, .set = py_winspool_AsyncGetPrinterDriverPackagePath_in_set_cchDriverPackageCab, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcchRequiredSize"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_out_get_pcchRequiredSize, .set = py_winspool_AsyncGetPrinterDriverPackagePath_out_set_pcchRequiredSize, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetPrinterDriverPackagePath_get_result, .set = py_winspool_AsyncGetPrinterDriverPackagePath_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetPrinterDriverPackagePath, type); struct winspool_AsyncGetPrinterDriverPackagePath *_self = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcchRequiredSize = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(66); } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 67) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriverPackagePath_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[66]; 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_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_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 winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 67) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriverPackagePath_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[66]; 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_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetPrinterDriverPackagePath *object = (struct winspool_AsyncGetPrinterDriverPackagePath *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 67) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetPrinterDriverPackagePath_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[66]; 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_winspool_AsyncGetPrinterDriverPackagePath_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDriverPackagePath_ndr_print(py_obj, "winspool_AsyncGetPrinterDriverPackagePath_in", NDR_IN); } static PyObject *py_winspool_AsyncGetPrinterDriverPackagePath_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetPrinterDriverPackagePath_ndr_print(py_obj, "winspool_AsyncGetPrinterDriverPackagePath_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetPrinterDriverPackagePath_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetPrinterDriverPackagePath_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetPrinterDriverPackagePath.opnum() -> 66 (0x42) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_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_winspool_AsyncGetPrinterDriverPackagePath_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetPrinterDriverPackagePath_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetPrinterDriverPackagePath_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetPrinterDriverPackagePath", .tp_getset = py_winspool_AsyncGetPrinterDriverPackagePath_getsetters, .tp_methods = py_winspool_AsyncGetPrinterDriverPackagePath_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetPrinterDriverPackagePath_new, }; static bool pack_py_winspool_AsyncGetPrinterDriverPackagePath_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetPrinterDriverPackagePath *r) { PyObject *py_pszServer; PyObject *py_pszEnvironment; PyObject *py_pszLanguage; PyObject *py_pszPackageID; PyObject *py_pszDriverPackageCab; const char *kwnames[] = { "pszServer", "pszEnvironment", "pszLanguage", "pszPackageID", "pszDriverPackageCab", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:winspool_AsyncGetPrinterDriverPackagePath", discard_const_p(char *, kwnames), &py_pszServer, &py_pszEnvironment, &py_pszLanguage, &py_pszPackageID, &py_pszDriverPackageCab)) { return false; } if (py_pszServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszServer"); return false; } if (py_pszServer == Py_None) { r->in.pszServer = NULL; } else { r->in.pszServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszServer)) { unicode = PyUnicode_AsEncodedString(py_pszServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszServer)) { test_str = PyBytes_AS_STRING(py_pszServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszServer)->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.pszServer = talloc_str; } } if (py_pszEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszEnvironment"); return false; } r->in.pszEnvironment = talloc_ptrtype(r, r->in.pszEnvironment); if (r->in.pszEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pszEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszEnvironment)) { test_str = PyBytes_AS_STRING(py_pszEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszEnvironment)->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.pszEnvironment = talloc_str; } if (py_pszLanguage == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszLanguage"); return false; } if (py_pszLanguage == Py_None) { r->in.pszLanguage = NULL; } else { r->in.pszLanguage = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszLanguage)) { unicode = PyUnicode_AsEncodedString(py_pszLanguage, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszLanguage)) { test_str = PyBytes_AS_STRING(py_pszLanguage); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszLanguage)->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.pszLanguage = talloc_str; } } if (py_pszPackageID == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszPackageID"); return false; } r->in.pszPackageID = talloc_ptrtype(r, r->in.pszPackageID); if (r->in.pszPackageID == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszPackageID)) { unicode = PyUnicode_AsEncodedString(py_pszPackageID, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszPackageID)) { test_str = PyBytes_AS_STRING(py_pszPackageID); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszPackageID)->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.pszPackageID = talloc_str; } if (py_pszDriverPackageCab == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszDriverPackageCab"); return false; } if (py_pszDriverPackageCab == Py_None) { r->in.pszDriverPackageCab = NULL; } else { r->in.pszDriverPackageCab = NULL; PY_CHECK_TYPE(&PyList_Type, py_pszDriverPackageCab, return false;); { int pszDriverPackageCab_cntr_1; r->in.pszDriverPackageCab = talloc_array_ptrtype(r, r->in.pszDriverPackageCab, PyList_GET_SIZE(py_pszDriverPackageCab)); if (!r->in.pszDriverPackageCab) { return false;; } talloc_set_name_const(r->in.pszDriverPackageCab, "ARRAY: r->in.pszDriverPackageCab"); for (pszDriverPackageCab_cntr_1 = 0; pszDriverPackageCab_cntr_1 < PyList_GET_SIZE(py_pszDriverPackageCab); pszDriverPackageCab_cntr_1++) { if (PyList_GET_ITEM(py_pszDriverPackageCab, pszDriverPackageCab_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszDriverPackageCab[pszDriverPackageCab_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.pszDriverPackageCab[pszDriverPackageCab_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_pszDriverPackageCab, pszDriverPackageCab_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_pszDriverPackageCab, pszDriverPackageCab_cntr_1)); 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.pszDriverPackageCab[pszDriverPackageCab_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_pszDriverPackageCab, return false;); r->in.cchDriverPackageCab = PyList_GET_SIZE(py_pszDriverPackageCab); return true; } static PyObject *unpack_py_winspool_AsyncGetPrinterDriverPackagePath_args_out(struct winspool_AsyncGetPrinterDriverPackagePath *r) { PyObject *result; PyObject *py_pszDriverPackageCab; PyObject *py_pcchRequiredSize; result = PyTuple_New(3); if (r->out.pszDriverPackageCab == NULL) { py_pszDriverPackageCab = Py_None; Py_INCREF(py_pszDriverPackageCab); } else { py_pszDriverPackageCab = PyList_New(r->in.cchDriverPackageCab); if (py_pszDriverPackageCab == NULL) { return NULL; } { int pszDriverPackageCab_cntr_1; for (pszDriverPackageCab_cntr_1 = 0; pszDriverPackageCab_cntr_1 < (r->in.cchDriverPackageCab); pszDriverPackageCab_cntr_1++) { PyObject *py_pszDriverPackageCab_1; py_pszDriverPackageCab_1 = PyLong_FromLong((uint16_t)r->out.pszDriverPackageCab[pszDriverPackageCab_cntr_1]); PyList_SetItem(py_pszDriverPackageCab, pszDriverPackageCab_cntr_1, py_pszDriverPackageCab_1); } } } PyTuple_SetItem(result, 0, py_pszDriverPackageCab); py_pcchRequiredSize = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcchRequiredSize); PyTuple_SetItem(result, 1, py_pcchRequiredSize); PyTuple_SetItem(result, 2, PyErr_FromHRESULT(r->out.result)); return result; } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_in_get_pszServer(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszServer; if (object->in.pszServer == NULL) { Py_RETURN_NONE; } if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { if (object->in.pszServer == NULL) { py_pszServer = Py_None; Py_INCREF(py_pszServer); } else { py_pszServer = PyUnicode_Decode(object->in.pszServer, strlen(object->in.pszServer), "utf-8", "ignore"); } } return py_pszServer; } static int py_winspool_AsyncDeletePrinterDriverPackage_in_set_pszServer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszServer"); return -1; } if (value == Py_None) { object->in.pszServer = NULL; } else { object->in.pszServer = 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.pszServer = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_in_get_pszInfPath(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszInfPath; if (object->in.pszInfPath == NULL) { Py_RETURN_NONE; } if (object->in.pszInfPath == NULL) { py_pszInfPath = Py_None; Py_INCREF(py_pszInfPath); } else { py_pszInfPath = PyUnicode_Decode(object->in.pszInfPath, strlen(object->in.pszInfPath), "utf-8", "ignore"); } return py_pszInfPath; } static int py_winspool_AsyncDeletePrinterDriverPackage_in_set_pszInfPath(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszInfPath"); return -1; } object->in.pszInfPath = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszInfPath); if (object->in.pszInfPath == 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.pszInfPath = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_in_get_pszEnvironment(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_pszEnvironment; if (object->in.pszEnvironment == NULL) { Py_RETURN_NONE; } if (object->in.pszEnvironment == NULL) { py_pszEnvironment = Py_None; Py_INCREF(py_pszEnvironment); } else { py_pszEnvironment = PyUnicode_Decode(object->in.pszEnvironment, strlen(object->in.pszEnvironment), "utf-8", "ignore"); } return py_pszEnvironment; } static int py_winspool_AsyncDeletePrinterDriverPackage_in_set_pszEnvironment(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszEnvironment"); return -1; } object->in.pszEnvironment = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszEnvironment); if (object->in.pszEnvironment == 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.pszEnvironment = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromHRESULT(object->out.result); return py_result; } static int py_winspool_AsyncDeletePrinterDriverPackage_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)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 = HRES_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_winspool_AsyncDeletePrinterDriverPackage_getsetters[] = { { .name = discard_const_p(char, "in_pszServer"), .get = py_winspool_AsyncDeletePrinterDriverPackage_in_get_pszServer, .set = py_winspool_AsyncDeletePrinterDriverPackage_in_set_pszServer, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszInfPath"), .get = py_winspool_AsyncDeletePrinterDriverPackage_in_get_pszInfPath, .set = py_winspool_AsyncDeletePrinterDriverPackage_in_set_pszInfPath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pszEnvironment"), .get = py_winspool_AsyncDeletePrinterDriverPackage_in_get_pszEnvironment, .set = py_winspool_AsyncDeletePrinterDriverPackage_in_set_pszEnvironment, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeletePrinterDriverPackage_get_result, .set = py_winspool_AsyncDeletePrinterDriverPackage_set_result, .doc = discard_const_p(char, "PIDL-generated element of type HRESULT") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeletePrinterDriverPackage, type); return self; } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(67); } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 68) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriverPackage_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[67]; 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_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_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 winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 68) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriverPackage_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[67]; 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_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeletePrinterDriverPackage *object = (struct winspool_AsyncDeletePrinterDriverPackage *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 68) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeletePrinterDriverPackage_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[67]; 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_winspool_AsyncDeletePrinterDriverPackage_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDriverPackage_ndr_print(py_obj, "winspool_AsyncDeletePrinterDriverPackage_in", NDR_IN); } static PyObject *py_winspool_AsyncDeletePrinterDriverPackage_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeletePrinterDriverPackage_ndr_print(py_obj, "winspool_AsyncDeletePrinterDriverPackage_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeletePrinterDriverPackage_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeletePrinterDriverPackage_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeletePrinterDriverPackage.opnum() -> 67 (0x43) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_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_winspool_AsyncDeletePrinterDriverPackage_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeletePrinterDriverPackage_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeletePrinterDriverPackage_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeletePrinterDriverPackage", .tp_getset = py_winspool_AsyncDeletePrinterDriverPackage_getsetters, .tp_methods = py_winspool_AsyncDeletePrinterDriverPackage_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeletePrinterDriverPackage_new, }; static bool pack_py_winspool_AsyncDeletePrinterDriverPackage_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeletePrinterDriverPackage *r) { PyObject *py_pszServer; PyObject *py_pszInfPath; PyObject *py_pszEnvironment; const char *kwnames[] = { "pszServer", "pszInfPath", "pszEnvironment", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncDeletePrinterDriverPackage", discard_const_p(char *, kwnames), &py_pszServer, &py_pszInfPath, &py_pszEnvironment)) { return false; } if (py_pszServer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszServer"); return false; } if (py_pszServer == Py_None) { r->in.pszServer = NULL; } else { r->in.pszServer = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszServer)) { unicode = PyUnicode_AsEncodedString(py_pszServer, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszServer)) { test_str = PyBytes_AS_STRING(py_pszServer); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszServer)->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.pszServer = talloc_str; } } if (py_pszInfPath == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszInfPath"); return false; } r->in.pszInfPath = talloc_ptrtype(r, r->in.pszInfPath); if (r->in.pszInfPath == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszInfPath)) { unicode = PyUnicode_AsEncodedString(py_pszInfPath, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszInfPath)) { test_str = PyBytes_AS_STRING(py_pszInfPath); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszInfPath)->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.pszInfPath = talloc_str; } if (py_pszEnvironment == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszEnvironment"); return false; } r->in.pszEnvironment = talloc_ptrtype(r, r->in.pszEnvironment); if (r->in.pszEnvironment == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszEnvironment)) { unicode = PyUnicode_AsEncodedString(py_pszEnvironment, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszEnvironment)) { test_str = PyBytes_AS_STRING(py_pszEnvironment); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszEnvironment)->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.pszEnvironment = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeletePrinterDriverPackage_args_out(struct winspool_AsyncDeletePrinterDriverPackage *r) { PyObject *result; result = PyErr_FromHRESULT(r->out.result); return result; } static PyObject *py_winspool_AsyncReadPrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncReadPrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncReadPrinter_out_get_pBuf(PyObject *obj, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(obj); PyObject *py_pBuf; if (object->out.pBuf == NULL) { Py_RETURN_NONE; } py_pBuf = PyList_New(object->in.cbBuf); if (py_pBuf == NULL) { return NULL; } { int pBuf_cntr_1; for (pBuf_cntr_1 = 0; pBuf_cntr_1 < (object->in.cbBuf); pBuf_cntr_1++) { PyObject *py_pBuf_1; py_pBuf_1 = PyLong_FromLong((uint16_t)object->out.pBuf[pBuf_cntr_1]); PyList_SetItem(py_pBuf, pBuf_cntr_1, py_pBuf_1); } } return py_pBuf; } static int py_winspool_AsyncReadPrinter_out_set_pBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pBuf)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pBuf"); return -1; } object->out.pBuf = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pBuf); if (object->out.pBuf == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int pBuf_cntr_1; object->out.pBuf = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pBuf, PyList_GET_SIZE(value)); if (!object->out.pBuf) { return -1;; } talloc_set_name_const(object->out.pBuf, "ARRAY: object->out.pBuf"); for (pBuf_cntr_1 = 0; pBuf_cntr_1 < PyList_GET_SIZE(value); pBuf_cntr_1++) { if (PyList_GET_ITEM(value, pBuf_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pBuf[pBuf_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.pBuf[pBuf_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, pBuf_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, pBuf_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.pBuf[pBuf_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_winspool_AsyncReadPrinter_in_get_cbBuf(PyObject *obj, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(obj); PyObject *py_cbBuf; py_cbBuf = PyLong_FromUnsignedLongLong((uint32_t)object->in.cbBuf); return py_cbBuf; } static int py_winspool_AsyncReadPrinter_in_set_cbBuf(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.cbBuf"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.cbBuf)); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncReadPrinter_out_get_pcNoBytesRead(PyObject *obj, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(obj); PyObject *py_pcNoBytesRead; if (object->out.pcNoBytesRead == NULL) { Py_RETURN_NONE; } py_pcNoBytesRead = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcNoBytesRead); return py_pcNoBytesRead; } static int py_winspool_AsyncReadPrinter_out_set_pcNoBytesRead(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcNoBytesRead)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcNoBytesRead"); return -1; } object->out.pcNoBytesRead = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcNoBytesRead); if (object->out.pcNoBytesRead == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcNoBytesRead)); 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.pcNoBytesRead = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncReadPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncReadPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)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_winspool_AsyncReadPrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncReadPrinter_in_get_hPrinter, .set = py_winspool_AsyncReadPrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_pBuf"), .get = py_winspool_AsyncReadPrinter_out_get_pBuf, .set = py_winspool_AsyncReadPrinter_out_set_pBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_cbBuf"), .get = py_winspool_AsyncReadPrinter_in_get_cbBuf, .set = py_winspool_AsyncReadPrinter_in_set_cbBuf, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcNoBytesRead"), .get = py_winspool_AsyncReadPrinter_out_get_pcNoBytesRead, .set = py_winspool_AsyncReadPrinter_out_set_pcNoBytesRead, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncReadPrinter_get_result, .set = py_winspool_AsyncReadPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncReadPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncReadPrinter, type); struct winspool_AsyncReadPrinter *_self = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pBuf = talloc_zero(mem_ctx, uint8_t); _self->out.pcNoBytesRead = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_winspool_AsyncReadPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(68); } static PyObject *py_winspool_AsyncReadPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 69) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncReadPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[68]; 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_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncReadPrinter_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 winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 69) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncReadPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[68]; 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_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncReadPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncReadPrinter *object = (struct winspool_AsyncReadPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 69) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncReadPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[68]; 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_winspool_AsyncReadPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncReadPrinter_ndr_print(py_obj, "winspool_AsyncReadPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncReadPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncReadPrinter_ndr_print(py_obj, "winspool_AsyncReadPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncReadPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncReadPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncReadPrinter.opnum() -> 68 (0x44) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_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_winspool_AsyncReadPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncReadPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncReadPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncReadPrinter", .tp_getset = py_winspool_AsyncReadPrinter_getsetters, .tp_methods = py_winspool_AsyncReadPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncReadPrinter_new, }; static bool pack_py_winspool_AsyncReadPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncReadPrinter *r) { PyObject *py_hPrinter; PyObject *py_cbBuf; const char *kwnames[] = { "hPrinter", "cbBuf", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncReadPrinter", discard_const_p(char *, kwnames), &py_hPrinter, &py_cbBuf)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_cbBuf == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.cbBuf"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.cbBuf)); if (PyLong_Check(py_cbBuf)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_cbBuf); 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.cbBuf = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncReadPrinter_args_out(struct winspool_AsyncReadPrinter *r) { PyObject *result; PyObject *py_pBuf; PyObject *py_pcNoBytesRead; result = PyTuple_New(2); py_pBuf = PyList_New(r->in.cbBuf); if (py_pBuf == NULL) { return NULL; } { int pBuf_cntr_1; for (pBuf_cntr_1 = 0; pBuf_cntr_1 < (r->in.cbBuf); pBuf_cntr_1++) { PyObject *py_pBuf_1; py_pBuf_1 = PyLong_FromLong((uint16_t)r->out.pBuf[pBuf_cntr_1]); PyList_SetItem(py_pBuf, pBuf_cntr_1, py_pBuf_1); } } PyTuple_SetItem(result, 0, py_pBuf); py_pcNoBytesRead = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcNoBytesRead); PyTuple_SetItem(result, 1, py_pcNoBytesRead); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncResetPrinter_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncResetPrinter_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncResetPrinter_in_get_pDatatype(PyObject *obj, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pDatatype; if (object->in.pDatatype == NULL) { Py_RETURN_NONE; } if (object->in.pDatatype == NULL) { py_pDatatype = Py_None; Py_INCREF(py_pDatatype); } else { if (object->in.pDatatype == NULL) { py_pDatatype = Py_None; Py_INCREF(py_pDatatype); } else { py_pDatatype = PyUnicode_Decode(object->in.pDatatype, strlen(object->in.pDatatype), "utf-8", "ignore"); } } return py_pDatatype; } static int py_winspool_AsyncResetPrinter_in_set_pDatatype(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDatatype"); return -1; } if (value == Py_None) { object->in.pDatatype = NULL; } else { object->in.pDatatype = 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.pDatatype = talloc_str; } } return 0; } static PyObject *py_winspool_AsyncResetPrinter_in_get_pDevModeContainer(PyObject *obj, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(obj); PyObject *py_pDevModeContainer; if (object->in.pDevModeContainer == NULL) { Py_RETURN_NONE; } py_pDevModeContainer = pytalloc_reference_ex(spoolss_DevmodeContainer_Type, object->in.pDevModeContainer, object->in.pDevModeContainer); return py_pDevModeContainer; } static int py_winspool_AsyncResetPrinter_in_set_pDevModeContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pDevModeContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pDevModeContainer"); return -1; } object->in.pDevModeContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pDevModeContainer); if (object->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_DevmodeContainer_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.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncResetPrinter_get_result(PyObject *obj, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncResetPrinter_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)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_winspool_AsyncResetPrinter_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncResetPrinter_in_get_hPrinter, .set = py_winspool_AsyncResetPrinter_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pDatatype"), .get = py_winspool_AsyncResetPrinter_in_get_pDatatype, .set = py_winspool_AsyncResetPrinter_in_set_pDatatype, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_pDevModeContainer"), .get = py_winspool_AsyncResetPrinter_in_get_pDevModeContainer, .set = py_winspool_AsyncResetPrinter_in_set_pDevModeContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_DevmodeContainer") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncResetPrinter_get_result, .set = py_winspool_AsyncResetPrinter_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncResetPrinter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncResetPrinter, type); struct winspool_AsyncResetPrinter *_self = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pDevModeContainer = talloc_zero(mem_ctx, struct spoolss_DevmodeContainer); return self; } static PyObject *py_winspool_AsyncResetPrinter_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(69); } static PyObject *py_winspool_AsyncResetPrinter_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 70) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncResetPrinter_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[69]; 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_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncResetPrinter_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 winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 70) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncResetPrinter_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[69]; 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_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncResetPrinter_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncResetPrinter *object = (struct winspool_AsyncResetPrinter *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 70) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncResetPrinter_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[69]; 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_winspool_AsyncResetPrinter_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncResetPrinter_ndr_print(py_obj, "winspool_AsyncResetPrinter_in", NDR_IN); } static PyObject *py_winspool_AsyncResetPrinter_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncResetPrinter_ndr_print(py_obj, "winspool_AsyncResetPrinter_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncResetPrinter_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncResetPrinter_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncResetPrinter.opnum() -> 69 (0x45) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_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_winspool_AsyncResetPrinter_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncResetPrinter_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncResetPrinter_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncResetPrinter", .tp_getset = py_winspool_AsyncResetPrinter_getsetters, .tp_methods = py_winspool_AsyncResetPrinter_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncResetPrinter_new, }; static bool pack_py_winspool_AsyncResetPrinter_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncResetPrinter *r) { PyObject *py_hPrinter; PyObject *py_pDatatype; PyObject *py_pDevModeContainer; const char *kwnames[] = { "hPrinter", "pDatatype", "pDevModeContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncResetPrinter", discard_const_p(char *, kwnames), &py_hPrinter, &py_pDatatype, &py_pDevModeContainer)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pDatatype == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDatatype"); return false; } if (py_pDatatype == Py_None) { r->in.pDatatype = NULL; } else { r->in.pDatatype = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pDatatype)) { unicode = PyUnicode_AsEncodedString(py_pDatatype, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pDatatype)) { test_str = PyBytes_AS_STRING(py_pDatatype); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pDatatype)->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.pDatatype = talloc_str; } } if (py_pDevModeContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pDevModeContainer"); return false; } r->in.pDevModeContainer = talloc_ptrtype(r, r->in.pDevModeContainer); if (r->in.pDevModeContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_DevmodeContainer_Type, py_pDevModeContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pDevModeContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pDevModeContainer = (struct spoolss_DevmodeContainer *)pytalloc_get_ptr(py_pDevModeContainer); return true; } static PyObject *unpack_py_winspool_AsyncResetPrinter_args_out(struct winspool_AsyncResetPrinter *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_winspool_AsyncGetJobNamedPropertyValue_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncGetJobNamedPropertyValue_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_in_get_JobId(PyObject *obj, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(obj); PyObject *py_JobId; py_JobId = PyLong_FromUnsignedLongLong((uint32_t)object->in.JobId); return py_JobId; } static int py_winspool_AsyncGetJobNamedPropertyValue_in_set_JobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.JobId"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.JobId)); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_in_get_pszName(PyObject *obj, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(obj); PyObject *py_pszName; if (object->in.pszName == NULL) { Py_RETURN_NONE; } if (object->in.pszName == NULL) { py_pszName = Py_None; Py_INCREF(py_pszName); } else { py_pszName = PyUnicode_Decode(object->in.pszName, strlen(object->in.pszName), "utf-8", "ignore"); } return py_pszName; } static int py_winspool_AsyncGetJobNamedPropertyValue_in_set_pszName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszName"); return -1; } object->in.pszName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszName); if (object->in.pszName == 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.pszName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_out_get_pValue(PyObject *obj, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(obj); PyObject *py_pValue; if (object->out.pValue == NULL) { Py_RETURN_NONE; } py_pValue = pytalloc_reference_ex(spoolss_PrintPropertyValue_Type, object->out.pValue, object->out.pValue); return py_pValue; } static int py_winspool_AsyncGetJobNamedPropertyValue_out_set_pValue(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pValue)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pValue"); return -1; } object->out.pValue = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pValue); if (object->out.pValue == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_PrintPropertyValue_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.pValue = (struct spoolss_PrintPropertyValue *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_get_result(PyObject *obj, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncGetJobNamedPropertyValue_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)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_winspool_AsyncGetJobNamedPropertyValue_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncGetJobNamedPropertyValue_in_get_hPrinter, .set = py_winspool_AsyncGetJobNamedPropertyValue_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_JobId"), .get = py_winspool_AsyncGetJobNamedPropertyValue_in_get_JobId, .set = py_winspool_AsyncGetJobNamedPropertyValue_in_set_JobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pszName"), .get = py_winspool_AsyncGetJobNamedPropertyValue_in_get_pszName, .set = py_winspool_AsyncGetJobNamedPropertyValue_in_set_pszName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_pValue"), .get = py_winspool_AsyncGetJobNamedPropertyValue_out_get_pValue, .set = py_winspool_AsyncGetJobNamedPropertyValue_out_set_pValue, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_PrintPropertyValue") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncGetJobNamedPropertyValue_get_result, .set = py_winspool_AsyncGetJobNamedPropertyValue_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncGetJobNamedPropertyValue, type); struct winspool_AsyncGetJobNamedPropertyValue *_self = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pValue = talloc_zero(mem_ctx, struct spoolss_PrintPropertyValue); return self; } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(70); } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 71) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetJobNamedPropertyValue_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[70]; 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_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_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 winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 71) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetJobNamedPropertyValue_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[70]; 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_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncGetJobNamedPropertyValue *object = (struct winspool_AsyncGetJobNamedPropertyValue *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 71) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncGetJobNamedPropertyValue_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[70]; 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_winspool_AsyncGetJobNamedPropertyValue_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetJobNamedPropertyValue_ndr_print(py_obj, "winspool_AsyncGetJobNamedPropertyValue_in", NDR_IN); } static PyObject *py_winspool_AsyncGetJobNamedPropertyValue_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncGetJobNamedPropertyValue_ndr_print(py_obj, "winspool_AsyncGetJobNamedPropertyValue_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncGetJobNamedPropertyValue_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncGetJobNamedPropertyValue_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncGetJobNamedPropertyValue.opnum() -> 70 (0x46) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_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_winspool_AsyncGetJobNamedPropertyValue_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncGetJobNamedPropertyValue_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncGetJobNamedPropertyValue_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncGetJobNamedPropertyValue", .tp_getset = py_winspool_AsyncGetJobNamedPropertyValue_getsetters, .tp_methods = py_winspool_AsyncGetJobNamedPropertyValue_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncGetJobNamedPropertyValue_new, }; static bool pack_py_winspool_AsyncGetJobNamedPropertyValue_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncGetJobNamedPropertyValue *r) { PyObject *py_hPrinter; PyObject *py_JobId; PyObject *py_pszName; const char *kwnames[] = { "hPrinter", "JobId", "pszName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncGetJobNamedPropertyValue", discard_const_p(char *, kwnames), &py_hPrinter, &py_JobId, &py_pszName)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_JobId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.JobId"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.JobId)); if (PyLong_Check(py_JobId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_JobId); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pszName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszName"); return false; } r->in.pszName = talloc_ptrtype(r, r->in.pszName); if (r->in.pszName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszName)) { unicode = PyUnicode_AsEncodedString(py_pszName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszName)) { test_str = PyBytes_AS_STRING(py_pszName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszName)->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.pszName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncGetJobNamedPropertyValue_args_out(struct winspool_AsyncGetJobNamedPropertyValue *r) { PyObject *result; PyObject *py_pValue; py_pValue = pytalloc_reference_ex(spoolss_PrintPropertyValue_Type, r->out.pValue, r->out.pValue); result = py_pValue; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncSetJobNamedProperty_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncSetJobNamedProperty_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetJobNamedProperty_in_get_JobId(PyObject *obj, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_JobId; py_JobId = PyLong_FromUnsignedLongLong((uint32_t)object->in.JobId); return py_JobId; } static int py_winspool_AsyncSetJobNamedProperty_in_set_JobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.JobId"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.JobId)); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncSetJobNamedProperty_in_get_pProperty(PyObject *obj, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_pProperty; if (object->in.pProperty == NULL) { Py_RETURN_NONE; } py_pProperty = pytalloc_reference_ex(spoolss_PrintNamedProperty_Type, object->in.pProperty, object->in.pProperty); return py_pProperty; } static int py_winspool_AsyncSetJobNamedProperty_in_set_pProperty(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pProperty)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pProperty"); return -1; } object->in.pProperty = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pProperty); if (object->in.pProperty == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_PrintNamedProperty_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.pProperty = (struct spoolss_PrintNamedProperty *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncSetJobNamedProperty_get_result(PyObject *obj, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncSetJobNamedProperty_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)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_winspool_AsyncSetJobNamedProperty_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncSetJobNamedProperty_in_get_hPrinter, .set = py_winspool_AsyncSetJobNamedProperty_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_JobId"), .get = py_winspool_AsyncSetJobNamedProperty_in_get_JobId, .set = py_winspool_AsyncSetJobNamedProperty_in_set_JobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pProperty"), .get = py_winspool_AsyncSetJobNamedProperty_in_get_pProperty, .set = py_winspool_AsyncSetJobNamedProperty_in_set_pProperty, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_PrintNamedProperty") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncSetJobNamedProperty_get_result, .set = py_winspool_AsyncSetJobNamedProperty_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncSetJobNamedProperty_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncSetJobNamedProperty, type); struct winspool_AsyncSetJobNamedProperty *_self = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pProperty = talloc_zero(mem_ctx, struct spoolss_PrintNamedProperty); return self; } static PyObject *py_winspool_AsyncSetJobNamedProperty_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(71); } static PyObject *py_winspool_AsyncSetJobNamedProperty_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 72) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetJobNamedProperty_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[71]; 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_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncSetJobNamedProperty_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 winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 72) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetJobNamedProperty_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[71]; 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_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncSetJobNamedProperty_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncSetJobNamedProperty *object = (struct winspool_AsyncSetJobNamedProperty *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 72) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncSetJobNamedProperty_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[71]; 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_winspool_AsyncSetJobNamedProperty_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetJobNamedProperty_ndr_print(py_obj, "winspool_AsyncSetJobNamedProperty_in", NDR_IN); } static PyObject *py_winspool_AsyncSetJobNamedProperty_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncSetJobNamedProperty_ndr_print(py_obj, "winspool_AsyncSetJobNamedProperty_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncSetJobNamedProperty_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncSetJobNamedProperty_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncSetJobNamedProperty.opnum() -> 71 (0x47) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_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_winspool_AsyncSetJobNamedProperty_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncSetJobNamedProperty_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncSetJobNamedProperty_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncSetJobNamedProperty", .tp_getset = py_winspool_AsyncSetJobNamedProperty_getsetters, .tp_methods = py_winspool_AsyncSetJobNamedProperty_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncSetJobNamedProperty_new, }; static bool pack_py_winspool_AsyncSetJobNamedProperty_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncSetJobNamedProperty *r) { PyObject *py_hPrinter; PyObject *py_JobId; PyObject *py_pProperty; const char *kwnames[] = { "hPrinter", "JobId", "pProperty", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncSetJobNamedProperty", discard_const_p(char *, kwnames), &py_hPrinter, &py_JobId, &py_pProperty)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_JobId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.JobId"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.JobId)); if (PyLong_Check(py_JobId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_JobId); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pProperty == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pProperty"); return false; } r->in.pProperty = talloc_ptrtype(r, r->in.pProperty); if (r->in.pProperty == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_PrintNamedProperty_Type, py_pProperty, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pProperty)) == NULL) { PyErr_NoMemory(); return false; } r->in.pProperty = (struct spoolss_PrintNamedProperty *)pytalloc_get_ptr(py_pProperty); return true; } static PyObject *unpack_py_winspool_AsyncSetJobNamedProperty_args_out(struct winspool_AsyncSetJobNamedProperty *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_winspool_AsyncDeleteJobNamedProperty_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncDeleteJobNamedProperty_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_in_get_JobId(PyObject *obj, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_JobId; py_JobId = PyLong_FromUnsignedLongLong((uint32_t)object->in.JobId); return py_JobId; } static int py_winspool_AsyncDeleteJobNamedProperty_in_set_JobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.JobId"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.JobId)); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_in_get_pszName(PyObject *obj, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_pszName; if (object->in.pszName == NULL) { Py_RETURN_NONE; } if (object->in.pszName == NULL) { py_pszName = Py_None; Py_INCREF(py_pszName); } else { py_pszName = PyUnicode_Decode(object->in.pszName, strlen(object->in.pszName), "utf-8", "ignore"); } return py_pszName; } static int py_winspool_AsyncDeleteJobNamedProperty_in_set_pszName(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pszName"); return -1; } object->in.pszName = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pszName); if (object->in.pszName == 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.pszName = talloc_str; } return 0; } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_get_result(PyObject *obj, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncDeleteJobNamedProperty_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)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_winspool_AsyncDeleteJobNamedProperty_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncDeleteJobNamedProperty_in_get_hPrinter, .set = py_winspool_AsyncDeleteJobNamedProperty_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_JobId"), .get = py_winspool_AsyncDeleteJobNamedProperty_in_get_JobId, .set = py_winspool_AsyncDeleteJobNamedProperty_in_set_JobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_pszName"), .get = py_winspool_AsyncDeleteJobNamedProperty_in_get_pszName, .set = py_winspool_AsyncDeleteJobNamedProperty_in_set_pszName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncDeleteJobNamedProperty_get_result, .set = py_winspool_AsyncDeleteJobNamedProperty_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncDeleteJobNamedProperty_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncDeleteJobNamedProperty, type); return self; } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(72); } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 73) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteJobNamedProperty_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[72]; 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_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_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 winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 73) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteJobNamedProperty_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[72]; 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_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncDeleteJobNamedProperty *object = (struct winspool_AsyncDeleteJobNamedProperty *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 73) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncDeleteJobNamedProperty_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[72]; 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_winspool_AsyncDeleteJobNamedProperty_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeleteJobNamedProperty_ndr_print(py_obj, "winspool_AsyncDeleteJobNamedProperty_in", NDR_IN); } static PyObject *py_winspool_AsyncDeleteJobNamedProperty_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncDeleteJobNamedProperty_ndr_print(py_obj, "winspool_AsyncDeleteJobNamedProperty_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncDeleteJobNamedProperty_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncDeleteJobNamedProperty_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncDeleteJobNamedProperty.opnum() -> 72 (0x48) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_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_winspool_AsyncDeleteJobNamedProperty_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncDeleteJobNamedProperty_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncDeleteJobNamedProperty_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncDeleteJobNamedProperty", .tp_getset = py_winspool_AsyncDeleteJobNamedProperty_getsetters, .tp_methods = py_winspool_AsyncDeleteJobNamedProperty_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncDeleteJobNamedProperty_new, }; static bool pack_py_winspool_AsyncDeleteJobNamedProperty_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncDeleteJobNamedProperty *r) { PyObject *py_hPrinter; PyObject *py_JobId; PyObject *py_pszName; const char *kwnames[] = { "hPrinter", "JobId", "pszName", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:winspool_AsyncDeleteJobNamedProperty", discard_const_p(char *, kwnames), &py_hPrinter, &py_JobId, &py_pszName)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_JobId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.JobId"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.JobId)); if (PyLong_Check(py_JobId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_JobId); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_pszName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pszName"); return false; } r->in.pszName = talloc_ptrtype(r, r->in.pszName); if (r->in.pszName == NULL) { PyErr_NoMemory(); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_pszName)) { unicode = PyUnicode_AsEncodedString(py_pszName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_pszName)) { test_str = PyBytes_AS_STRING(py_pszName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pszName)->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.pszName = talloc_str; } return true; } static PyObject *unpack_py_winspool_AsyncDeleteJobNamedProperty_args_out(struct winspool_AsyncDeleteJobNamedProperty *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_winspool_AsyncEnumJobNamedProperties_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncEnumJobNamedProperties_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncEnumJobNamedProperties_in_get_JobId(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(obj); PyObject *py_JobId; py_JobId = PyLong_FromUnsignedLongLong((uint32_t)object->in.JobId); return py_JobId; } static int py_winspool_AsyncEnumJobNamedProperties_in_set_JobId(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.JobId"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.JobId)); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobNamedProperties_out_get_pcProperties(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(obj); PyObject *py_pcProperties; if (object->out.pcProperties == NULL) { Py_RETURN_NONE; } py_pcProperties = PyLong_FromUnsignedLongLong((uint32_t)*object->out.pcProperties); return py_pcProperties; } static int py_winspool_AsyncEnumJobNamedProperties_out_set_pcProperties(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.pcProperties)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.pcProperties"); return -1; } object->out.pcProperties = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.pcProperties); if (object->out.pcProperties == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.pcProperties)); 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.pcProperties = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_winspool_AsyncEnumJobNamedProperties_out_get_ppProperties(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(obj); PyObject *py_ppProperties; if (object->out.ppProperties == NULL) { Py_RETURN_NONE; } if (*object->out.ppProperties == NULL) { py_ppProperties = Py_None; Py_INCREF(py_ppProperties); } else { py_ppProperties = PyList_New(*object->out.pcProperties); if (py_ppProperties == NULL) { return NULL; } { int ppProperties_cntr_2; for (ppProperties_cntr_2 = 0; ppProperties_cntr_2 < (*object->out.pcProperties); ppProperties_cntr_2++) { PyObject *py_ppProperties_2; py_ppProperties_2 = pytalloc_reference_ex(spoolss_PrintNamedProperty_Type, *object->out.ppProperties, object->out.ppProperties[ppProperties_cntr_2]); PyList_SetItem(py_ppProperties, ppProperties_cntr_2, py_ppProperties_2); } } } return py_ppProperties; } static int py_winspool_AsyncEnumJobNamedProperties_out_set_ppProperties(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.ppProperties)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.ppProperties"); return -1; } object->out.ppProperties = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.ppProperties); if (object->out.ppProperties == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.ppProperties = NULL; } else { *object->out.ppProperties = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int ppProperties_cntr_2; *object->out.ppProperties = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), *object->out.ppProperties, PyList_GET_SIZE(value)); if (!*object->out.ppProperties) { return -1;; } talloc_set_name_const(*object->out.ppProperties, "ARRAY: *object->out.ppProperties"); for (ppProperties_cntr_2 = 0; ppProperties_cntr_2 < PyList_GET_SIZE(value); ppProperties_cntr_2++) { if (PyList_GET_ITEM(value, ppProperties_cntr_2) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->out.ppProperties[ppProperties_cntr_2]"); return -1; } PY_CHECK_TYPE(spoolss_PrintNamedProperty_Type, PyList_GET_ITEM(value, ppProperties_cntr_2), return -1;); if (talloc_reference(*object->out.ppProperties, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, ppProperties_cntr_2))) == NULL) { PyErr_NoMemory(); return -1; } object->out.ppProperties[ppProperties_cntr_2] = (struct spoolss_PrintNamedProperty *)pytalloc_get_ptr(PyList_GET_ITEM(value, ppProperties_cntr_2)); } } } return 0; } static PyObject *py_winspool_AsyncEnumJobNamedProperties_get_result(PyObject *obj, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncEnumJobNamedProperties_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)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_winspool_AsyncEnumJobNamedProperties_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncEnumJobNamedProperties_in_get_hPrinter, .set = py_winspool_AsyncEnumJobNamedProperties_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_JobId"), .get = py_winspool_AsyncEnumJobNamedProperties_in_get_JobId, .set = py_winspool_AsyncEnumJobNamedProperties_in_set_JobId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_pcProperties"), .get = py_winspool_AsyncEnumJobNamedProperties_out_get_pcProperties, .set = py_winspool_AsyncEnumJobNamedProperties_out_set_pcProperties, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_ppProperties"), .get = py_winspool_AsyncEnumJobNamedProperties_out_get_ppProperties, .set = py_winspool_AsyncEnumJobNamedProperties_out_set_ppProperties, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_PrintNamedProperty") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncEnumJobNamedProperties_get_result, .set = py_winspool_AsyncEnumJobNamedProperties_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncEnumJobNamedProperties_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncEnumJobNamedProperties, type); struct winspool_AsyncEnumJobNamedProperties *_self = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.pcProperties = talloc_zero(mem_ctx, uint32_t); /* a pointer to a NULL pointer */ _self->out.ppProperties = talloc_zero(mem_ctx, struct spoolss_PrintNamedProperty *); return self; } static PyObject *py_winspool_AsyncEnumJobNamedProperties_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(73); } static PyObject *py_winspool_AsyncEnumJobNamedProperties_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 74) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumJobNamedProperties_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[73]; 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_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncEnumJobNamedProperties_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 winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 74) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumJobNamedProperties_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[73]; 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_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncEnumJobNamedProperties_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncEnumJobNamedProperties *object = (struct winspool_AsyncEnumJobNamedProperties *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 74) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncEnumJobNamedProperties_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[73]; 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_winspool_AsyncEnumJobNamedProperties_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumJobNamedProperties_ndr_print(py_obj, "winspool_AsyncEnumJobNamedProperties_in", NDR_IN); } static PyObject *py_winspool_AsyncEnumJobNamedProperties_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncEnumJobNamedProperties_ndr_print(py_obj, "winspool_AsyncEnumJobNamedProperties_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncEnumJobNamedProperties_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncEnumJobNamedProperties_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncEnumJobNamedProperties.opnum() -> 73 (0x49) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_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_winspool_AsyncEnumJobNamedProperties_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncEnumJobNamedProperties_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncEnumJobNamedProperties_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncEnumJobNamedProperties", .tp_getset = py_winspool_AsyncEnumJobNamedProperties_getsetters, .tp_methods = py_winspool_AsyncEnumJobNamedProperties_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncEnumJobNamedProperties_new, }; static bool pack_py_winspool_AsyncEnumJobNamedProperties_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncEnumJobNamedProperties *r) { PyObject *py_hPrinter; PyObject *py_JobId; const char *kwnames[] = { "hPrinter", "JobId", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncEnumJobNamedProperties", discard_const_p(char *, kwnames), &py_hPrinter, &py_JobId)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_JobId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.JobId"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.JobId)); if (PyLong_Check(py_JobId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_JobId); 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.JobId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_winspool_AsyncEnumJobNamedProperties_args_out(struct winspool_AsyncEnumJobNamedProperties *r) { PyObject *result; PyObject *py_pcProperties; PyObject *py_ppProperties; result = PyTuple_New(2); py_pcProperties = PyLong_FromUnsignedLongLong((uint32_t)*r->out.pcProperties); PyTuple_SetItem(result, 0, py_pcProperties); if (*r->out.ppProperties == NULL) { py_ppProperties = Py_None; Py_INCREF(py_ppProperties); } else { py_ppProperties = PyList_New(*r->out.pcProperties); if (py_ppProperties == NULL) { return NULL; } { int ppProperties_cntr_2; for (ppProperties_cntr_2 = 0; ppProperties_cntr_2 < (*r->out.pcProperties); ppProperties_cntr_2++) { PyObject *py_ppProperties_2; py_ppProperties_2 = pytalloc_reference_ex(spoolss_PrintNamedProperty_Type, *r->out.ppProperties, r->out.ppProperties[ppProperties_cntr_2]); PyList_SetItem(py_ppProperties, ppProperties_cntr_2, py_ppProperties_2); } } } PyTuple_SetItem(result, 1, py_ppProperties); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_in_get_hPrinter(PyObject *obj, void *closure) { struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(obj); PyObject *py_hPrinter; py_hPrinter = pytalloc_reference_ex(policy_handle_Type, pytalloc_get_mem_ctx(obj), &object->in.hPrinter); return py_hPrinter; } static int py_winspool_AsyncLogJobInfoForBranchOffice_in_set_hPrinter(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.hPrinter"); return -1; } PY_CHECK_TYPE(policy_handle_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.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_in_get_pBranchOfficeJobDataContainer(PyObject *obj, void *closure) { struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(obj); PyObject *py_pBranchOfficeJobDataContainer; if (object->in.pBranchOfficeJobDataContainer == NULL) { Py_RETURN_NONE; } py_pBranchOfficeJobDataContainer = pytalloc_reference_ex(spoolss_BranchOfficeJobDataContainer_Type, object->in.pBranchOfficeJobDataContainer, object->in.pBranchOfficeJobDataContainer); return py_pBranchOfficeJobDataContainer; } static int py_winspool_AsyncLogJobInfoForBranchOffice_in_set_pBranchOfficeJobDataContainer(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.pBranchOfficeJobDataContainer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.pBranchOfficeJobDataContainer"); return -1; } object->in.pBranchOfficeJobDataContainer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.pBranchOfficeJobDataContainer); if (object->in.pBranchOfficeJobDataContainer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(spoolss_BranchOfficeJobDataContainer_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.pBranchOfficeJobDataContainer = (struct spoolss_BranchOfficeJobDataContainer *)pytalloc_get_ptr(value); return 0; } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_get_result(PyObject *obj, void *closure) { struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_winspool_AsyncLogJobInfoForBranchOffice_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)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_winspool_AsyncLogJobInfoForBranchOffice_getsetters[] = { { .name = discard_const_p(char, "in_hPrinter"), .get = py_winspool_AsyncLogJobInfoForBranchOffice_in_get_hPrinter, .set = py_winspool_AsyncLogJobInfoForBranchOffice_in_set_hPrinter, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_pBranchOfficeJobDataContainer"), .get = py_winspool_AsyncLogJobInfoForBranchOffice_in_get_pBranchOfficeJobDataContainer, .set = py_winspool_AsyncLogJobInfoForBranchOffice_in_set_pBranchOfficeJobDataContainer, .doc = discard_const_p(char, "PIDL-generated element of base type spoolss_BranchOfficeJobDataContainer") }, { .name = discard_const_p(char, "result"), .get = py_winspool_AsyncLogJobInfoForBranchOffice_get_result, .set = py_winspool_AsyncLogJobInfoForBranchOffice_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct winspool_AsyncLogJobInfoForBranchOffice, type); struct winspool_AsyncLogJobInfoForBranchOffice *_self = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.pBranchOfficeJobDataContainer = talloc_zero(mem_ctx, struct spoolss_BranchOfficeJobDataContainer); return self; } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(74); } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 75) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncLogJobInfoForBranchOffice_ndr_pack"); return NULL; } call = &ndr_table_iremotewinspool.calls[74]; 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_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_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 winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_iremotewinspool.num_calls < 75) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncLogJobInfoForBranchOffice_ndr_unpack"); return NULL; } call = &ndr_table_iremotewinspool.calls[74]; 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_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct winspool_AsyncLogJobInfoForBranchOffice *object = (struct winspool_AsyncLogJobInfoForBranchOffice *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_iremotewinspool.num_calls < 75) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_winspool_AsyncLogJobInfoForBranchOffice_ndr_print"); return NULL; } call = &ndr_table_iremotewinspool.calls[74]; 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_winspool_AsyncLogJobInfoForBranchOffice_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncLogJobInfoForBranchOffice_ndr_print(py_obj, "winspool_AsyncLogJobInfoForBranchOffice_in", NDR_IN); } static PyObject *py_winspool_AsyncLogJobInfoForBranchOffice_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_winspool_AsyncLogJobInfoForBranchOffice_ndr_print(py_obj, "winspool_AsyncLogJobInfoForBranchOffice_out", NDR_OUT); } static PyMethodDef py_winspool_AsyncLogJobInfoForBranchOffice_methods[] = { { "opnum", (PyCFunction)py_winspool_AsyncLogJobInfoForBranchOffice_ndr_opnum, METH_NOARGS|METH_CLASS, "winspool.AsyncLogJobInfoForBranchOffice.opnum() -> 74 (0x4a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_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_winspool_AsyncLogJobInfoForBranchOffice_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_winspool_AsyncLogJobInfoForBranchOffice_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject winspool_AsyncLogJobInfoForBranchOffice_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.AsyncLogJobInfoForBranchOffice", .tp_getset = py_winspool_AsyncLogJobInfoForBranchOffice_getsetters, .tp_methods = py_winspool_AsyncLogJobInfoForBranchOffice_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_winspool_AsyncLogJobInfoForBranchOffice_new, }; static bool pack_py_winspool_AsyncLogJobInfoForBranchOffice_args_in(PyObject *args, PyObject *kwargs, struct winspool_AsyncLogJobInfoForBranchOffice *r) { PyObject *py_hPrinter; PyObject *py_pBranchOfficeJobDataContainer; const char *kwnames[] = { "hPrinter", "pBranchOfficeJobDataContainer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:winspool_AsyncLogJobInfoForBranchOffice", discard_const_p(char *, kwnames), &py_hPrinter, &py_pBranchOfficeJobDataContainer)) { return false; } if (py_hPrinter == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.hPrinter"); return false; } PY_CHECK_TYPE(policy_handle_Type, py_hPrinter, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_hPrinter)) == NULL) { PyErr_NoMemory(); return false; } r->in.hPrinter = *(struct policy_handle *)pytalloc_get_ptr(py_hPrinter); if (py_pBranchOfficeJobDataContainer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.pBranchOfficeJobDataContainer"); return false; } r->in.pBranchOfficeJobDataContainer = talloc_ptrtype(r, r->in.pBranchOfficeJobDataContainer); if (r->in.pBranchOfficeJobDataContainer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(spoolss_BranchOfficeJobDataContainer_Type, py_pBranchOfficeJobDataContainer, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_pBranchOfficeJobDataContainer)) == NULL) { PyErr_NoMemory(); return false; } r->in.pBranchOfficeJobDataContainer = (struct spoolss_BranchOfficeJobDataContainer *)pytalloc_get_ptr(py_pBranchOfficeJobDataContainer); return true; } static PyObject *unpack_py_winspool_AsyncLogJobInfoForBranchOffice_args_out(struct winspool_AsyncLogJobInfoForBranchOffice *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; } const struct PyNdrRpcMethodDef py_ndr_iremotewinspool_methods[] = { { "AsyncOpenPrinter", "S.AsyncOpenPrinter(pPrinterName, pDatatype, pDevModeContainer, AccessRequired, pClientInfo) -> pHandle", (py_dcerpc_call_fn)dcerpc_winspool_AsyncOpenPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncOpenPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncOpenPrinter_args_out, 0, &ndr_table_iremotewinspool }, { "AsyncAddPrinter", "S.AsyncAddPrinter(pName, pPrinterContainer, pDevModeContainer, pSecurityContainer, pClientInfo) -> pHandle", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncAddPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddPrinter_args_out, 1, &ndr_table_iremotewinspool }, { "AsyncSetJob", "S.AsyncSetJob(hPrinter, JobId, pJobContainer, Command) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSetJob_r, (py_data_pack_fn)pack_py_winspool_AsyncSetJob_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSetJob_args_out, 2, &ndr_table_iremotewinspool }, { "AsyncGetJob", "S.AsyncGetJob(hPrinter, JobId, Level, pJob) -> (pJob, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetJob_r, (py_data_pack_fn)pack_py_winspool_AsyncGetJob_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetJob_args_out, 3, &ndr_table_iremotewinspool }, { "AsyncEnumJobs", "S.AsyncEnumJobs(hPrinter, FirstJob, NoJobs, Level, pJob) -> (pJob, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumJobs_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumJobs_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumJobs_args_out, 4, &ndr_table_iremotewinspool }, { "AsyncAddJob", "S.AsyncAddJob(hPrinter, Level, pAddJob) -> (pAddJob, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddJob_r, (py_data_pack_fn)pack_py_winspool_AsyncAddJob_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddJob_args_out, 5, &ndr_table_iremotewinspool }, { "AsyncScheduleJob", "S.AsyncScheduleJob(hPrinter, JobId) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncScheduleJob_r, (py_data_pack_fn)pack_py_winspool_AsyncScheduleJob_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncScheduleJob_args_out, 6, &ndr_table_iremotewinspool }, { "AsyncDeletePrinter", "S.AsyncDeletePrinter(hPrinter) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinter_args_out, 7, &ndr_table_iremotewinspool }, { "AsyncSetPrinter", "S.AsyncSetPrinter(hPrinter, pPrinterContainer, pDevModeContainer, pSecurityContainer, Command) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSetPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncSetPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSetPrinter_args_out, 8, &ndr_table_iremotewinspool }, { "AsyncGetPrinter", "S.AsyncGetPrinter(hPrinter, Level, pPrinter) -> (pPrinter, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncGetPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetPrinter_args_out, 9, &ndr_table_iremotewinspool }, { "AsyncStartDocPrinter", "S.AsyncStartDocPrinter(hPrinter, pDocInfoContainer) -> pJobId", (py_dcerpc_call_fn)dcerpc_winspool_AsyncStartDocPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncStartDocPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncStartDocPrinter_args_out, 10, &ndr_table_iremotewinspool }, { "AsyncStartPagePrinter", "S.AsyncStartPagePrinter(hPrinter) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncStartPagePrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncStartPagePrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncStartPagePrinter_args_out, 11, &ndr_table_iremotewinspool }, { "AsyncWritePrinter", "S.AsyncWritePrinter(hPrinter, pBuf) -> pcWritten", (py_dcerpc_call_fn)dcerpc_winspool_AsyncWritePrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncWritePrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncWritePrinter_args_out, 12, &ndr_table_iremotewinspool }, { "AsyncEndPagePrinter", "S.AsyncEndPagePrinter(hPrinter) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEndPagePrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncEndPagePrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEndPagePrinter_args_out, 13, &ndr_table_iremotewinspool }, { "AsyncEndDocPrinter", "S.AsyncEndDocPrinter(hPrinter) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEndDocPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncEndDocPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEndDocPrinter_args_out, 14, &ndr_table_iremotewinspool }, { "AsyncAbortPrinter", "S.AsyncAbortPrinter(hPrinter) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAbortPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncAbortPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAbortPrinter_args_out, 15, &ndr_table_iremotewinspool }, { "AsyncGetPrinterData", "S.AsyncGetPrinterData(hPrinter, pValueName, nSize) -> (pType, pData, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetPrinterData_r, (py_data_pack_fn)pack_py_winspool_AsyncGetPrinterData_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetPrinterData_args_out, 16, &ndr_table_iremotewinspool }, { "AsyncGetPrinterDataEx", "S.AsyncGetPrinterDataEx(hPrinter, pKeyName, pValueName, nSize) -> (pType, pData, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetPrinterDataEx_r, (py_data_pack_fn)pack_py_winspool_AsyncGetPrinterDataEx_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetPrinterDataEx_args_out, 17, &ndr_table_iremotewinspool }, { "AsyncSetPrinterData", "S.AsyncSetPrinterData(hPrinter, pValueName, Type, pData) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSetPrinterData_r, (py_data_pack_fn)pack_py_winspool_AsyncSetPrinterData_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSetPrinterData_args_out, 18, &ndr_table_iremotewinspool }, { "AsyncSetPrinterDataEx", "S.AsyncSetPrinterDataEx(hPrinter, pKeyName, pValueName, Type, pData) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSetPrinterDataEx_r, (py_data_pack_fn)pack_py_winspool_AsyncSetPrinterDataEx_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSetPrinterDataEx_args_out, 19, &ndr_table_iremotewinspool }, { "AsyncClosePrinter", "S.AsyncClosePrinter(phPrinter) -> phPrinter", (py_dcerpc_call_fn)dcerpc_winspool_AsyncClosePrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncClosePrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncClosePrinter_args_out, 20, &ndr_table_iremotewinspool }, { "AsyncAddForm", "S.AsyncAddForm(hPrinter, pFormInfoContainer) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddForm_r, (py_data_pack_fn)pack_py_winspool_AsyncAddForm_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddForm_args_out, 21, &ndr_table_iremotewinspool }, { "AsyncDeleteForm", "S.AsyncDeleteForm(hPrinter, pFormName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeleteForm_r, (py_data_pack_fn)pack_py_winspool_AsyncDeleteForm_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeleteForm_args_out, 22, &ndr_table_iremotewinspool }, { "AsyncGetForm", "S.AsyncGetForm(hPrinter, pFormName, Level, pForm) -> (pForm, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetForm_r, (py_data_pack_fn)pack_py_winspool_AsyncGetForm_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetForm_args_out, 23, &ndr_table_iremotewinspool }, { "AsyncSetForm", "S.AsyncSetForm(hPrinter, pFormName, pFormInfoContainer) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSetForm_r, (py_data_pack_fn)pack_py_winspool_AsyncSetForm_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSetForm_args_out, 24, &ndr_table_iremotewinspool }, { "AsyncEnumForms", "S.AsyncEnumForms(hPrinter, Level, pForm) -> (pForm, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumForms_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumForms_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumForms_args_out, 25, &ndr_table_iremotewinspool }, { "AsyncGetPrinterDriver", "S.AsyncGetPrinterDriver(hPrinter, pEnvironment, Level, pDriver, dwClientMajorVersion, dwClientMinorVersion) -> (pDriver, pcbNeeded, pdwServerMaxVersion, pdwServerMinVersion)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetPrinterDriver_r, (py_data_pack_fn)pack_py_winspool_AsyncGetPrinterDriver_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetPrinterDriver_args_out, 26, &ndr_table_iremotewinspool }, { "AsyncEnumPrinterData", "S.AsyncEnumPrinterData(hPrinter, dwIndex, cbValueName, cbData) -> (pValueName, pcbValueName, pType, pData, pcbData)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPrinterData_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPrinterData_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPrinterData_args_out, 27, &ndr_table_iremotewinspool }, { "AsyncEnumPrinterDataEx", "S.AsyncEnumPrinterDataEx(hPrinter, pKeyName, cbEnumValues) -> (pEnumValues, pcbEnumValues, pnEnumValues)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPrinterDataEx_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPrinterDataEx_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPrinterDataEx_args_out, 28, &ndr_table_iremotewinspool }, { "AsyncEnumPrinterKey", "S.AsyncEnumPrinterKey(hPrinter, pKeyName, cbSubkey) -> (pSubkey, pcbSubkey)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPrinterKey_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPrinterKey_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPrinterKey_args_out, 29, &ndr_table_iremotewinspool }, { "AsyncDeletePrinterData", "S.AsyncDeletePrinterData(hPrinter, pValueName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinterData_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinterData_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinterData_args_out, 30, &ndr_table_iremotewinspool }, { "AsyncDeletePrinterDataEx", "S.AsyncDeletePrinterDataEx(hPrinter, pKeyName, pValueName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinterDataEx_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinterDataEx_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinterDataEx_args_out, 31, &ndr_table_iremotewinspool }, { "AsyncDeletePrinterKey", "S.AsyncDeletePrinterKey(hPrinter, pKeyName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinterKey_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinterKey_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinterKey_args_out, 32, &ndr_table_iremotewinspool }, { "AsyncXcvData", "S.AsyncXcvData(hXcv, pszDataName, pInputData, cbOutputData, pdwStatus) -> (pOutputData, pcbOutputNeeded, pdwStatus)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncXcvData_r, (py_data_pack_fn)pack_py_winspool_AsyncXcvData_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncXcvData_args_out, 33, &ndr_table_iremotewinspool }, { "AsyncSendRecvBidiData", "S.AsyncSendRecvBidiData(hPrinter, pAction, pReqData) -> ppRespData", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSendRecvBidiData_r, (py_data_pack_fn)pack_py_winspool_AsyncSendRecvBidiData_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSendRecvBidiData_args_out, 34, &ndr_table_iremotewinspool }, { "AsyncCreatePrinterIC", "S.AsyncCreatePrinterIC(hPrinter, pDevModeContainer) -> pHandle", (py_dcerpc_call_fn)dcerpc_winspool_AsyncCreatePrinterIC_r, (py_data_pack_fn)pack_py_winspool_AsyncCreatePrinterIC_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncCreatePrinterIC_args_out, 35, &ndr_table_iremotewinspool }, { "AsyncPlayGdiScriptOnPrinterIC", "S.AsyncPlayGdiScriptOnPrinterIC(hPrinterIC, pIn, cOut, ul) -> pOut", (py_dcerpc_call_fn)dcerpc_winspool_AsyncPlayGdiScriptOnPrinterIC_r, (py_data_pack_fn)pack_py_winspool_AsyncPlayGdiScriptOnPrinterIC_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncPlayGdiScriptOnPrinterIC_args_out, 36, &ndr_table_iremotewinspool }, { "AsyncDeletePrinterIC", "S.AsyncDeletePrinterIC(phPrinterIC) -> phPrinterIC", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinterIC_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinterIC_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinterIC_args_out, 37, &ndr_table_iremotewinspool }, { "AsyncEnumPrinters", "S.AsyncEnumPrinters(Flags, pName, Level, pPrinterEnum) -> (pPrinterEnum, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPrinters_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPrinters_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPrinters_args_out, 38, &ndr_table_iremotewinspool }, { "AsyncAddPrinterDriver", "S.AsyncAddPrinterDriver(pName, pDriverContainer, dwFileCopyFlags) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddPrinterDriver_r, (py_data_pack_fn)pack_py_winspool_AsyncAddPrinterDriver_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddPrinterDriver_args_out, 39, &ndr_table_iremotewinspool }, { "AsyncEnumPrinterDrivers", "S.AsyncEnumPrinterDrivers(pName, pEnvironment, Level, pDrivers) -> (pDrivers, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPrinterDrivers_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPrinterDrivers_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPrinterDrivers_args_out, 40, &ndr_table_iremotewinspool }, { "AsyncGetPrinterDriverDirectory", "S.AsyncGetPrinterDriverDirectory(pName, pEnvironment, Level, pDriverDirectory) -> (pDriverDirectory, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetPrinterDriverDirectory_r, (py_data_pack_fn)pack_py_winspool_AsyncGetPrinterDriverDirectory_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetPrinterDriverDirectory_args_out, 41, &ndr_table_iremotewinspool }, { "AsyncDeletePrinterDriver", "S.AsyncDeletePrinterDriver(pName, pEnvironment, pDriverName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinterDriver_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinterDriver_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinterDriver_args_out, 42, &ndr_table_iremotewinspool }, { "AsyncDeletePrinterDriverEx", "S.AsyncDeletePrinterDriverEx(pName, pEnvironment, pDriverName, dwDeleteFlag, dwVersionNum) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinterDriverEx_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinterDriverEx_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinterDriverEx_args_out, 43, &ndr_table_iremotewinspool }, { "AsyncAddPrintProcessor", "S.AsyncAddPrintProcessor(pName, pEnvironment, pPathName, pPrintProcessorName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddPrintProcessor_r, (py_data_pack_fn)pack_py_winspool_AsyncAddPrintProcessor_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddPrintProcessor_args_out, 44, &ndr_table_iremotewinspool }, { "AsyncEnumPrintProcessors", "S.AsyncEnumPrintProcessors(pName, pEnvironment, Level, pPrintProcessorInfo) -> (pPrintProcessorInfo, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPrintProcessors_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPrintProcessors_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPrintProcessors_args_out, 45, &ndr_table_iremotewinspool }, { "AsyncGetPrintProcessorDirectory", "S.AsyncGetPrintProcessorDirectory(pName, pEnvironment, Level, pPrintProcessorDirectory) -> (pPrintProcessorDirectory, pcbNeeded)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetPrintProcessorDirectory_r, (py_data_pack_fn)pack_py_winspool_AsyncGetPrintProcessorDirectory_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetPrintProcessorDirectory_args_out, 46, &ndr_table_iremotewinspool }, { "AsyncEnumPorts", "S.AsyncEnumPorts(pName, Level, pPort) -> (pPort, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPorts_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPorts_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPorts_args_out, 47, &ndr_table_iremotewinspool }, { "AsyncEnumMonitors", "S.AsyncEnumMonitors(pName, Level, pMonitor) -> (pMonitor, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumMonitors_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumMonitors_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumMonitors_args_out, 48, &ndr_table_iremotewinspool }, { "AsyncAddPort", "S.AsyncAddPort(pName, pPortContainer, pPortVarContainer, pMonitorName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddPort_r, (py_data_pack_fn)pack_py_winspool_AsyncAddPort_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddPort_args_out, 49, &ndr_table_iremotewinspool }, { "AsyncSetPort", "S.AsyncSetPort(pName, pPortName, pPortContainer) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSetPort_r, (py_data_pack_fn)pack_py_winspool_AsyncSetPort_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSetPort_args_out, 50, &ndr_table_iremotewinspool }, { "AsyncAddMonitor", "S.AsyncAddMonitor(Name, pMonitorContainer) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddMonitor_r, (py_data_pack_fn)pack_py_winspool_AsyncAddMonitor_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddMonitor_args_out, 51, &ndr_table_iremotewinspool }, { "AsyncDeleteMonitor", "S.AsyncDeleteMonitor(Name, pEnvironment, pMonitorName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeleteMonitor_r, (py_data_pack_fn)pack_py_winspool_AsyncDeleteMonitor_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeleteMonitor_args_out, 52, &ndr_table_iremotewinspool }, { "AsyncDeletePrintProcessor", "S.AsyncDeletePrintProcessor(Name, pEnvironment, pPrintProcessorName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrintProcessor_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrintProcessor_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrintProcessor_args_out, 53, &ndr_table_iremotewinspool }, { "AsyncEnumPrintProcessorDatatypes", "S.AsyncEnumPrintProcessorDatatypes(pName, pPrintProcessorName, Level, pDatatypes) -> (pDatatypes, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPrintProcessorDatatypes_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPrintProcessorDatatypes_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPrintProcessorDatatypes_args_out, 54, &ndr_table_iremotewinspool }, { "AsyncAddPerMachineConnection", "S.AsyncAddPerMachineConnection(pServer, pPrinterName, pPrintServer, pProvider) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncAddPerMachineConnection_r, (py_data_pack_fn)pack_py_winspool_AsyncAddPerMachineConnection_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncAddPerMachineConnection_args_out, 55, &ndr_table_iremotewinspool }, { "AsyncDeletePerMachineConnection", "S.AsyncDeletePerMachineConnection(pServer, pPrinterName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePerMachineConnection_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePerMachineConnection_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePerMachineConnection_args_out, 56, &ndr_table_iremotewinspool }, { "AsyncEnumPerMachineConnections", "S.AsyncEnumPerMachineConnections(pServer, pPrinterEnum) -> (pPrinterEnum, pcbNeeded, pcReturned)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumPerMachineConnections_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumPerMachineConnections_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumPerMachineConnections_args_out, 57, &ndr_table_iremotewinspool }, { "SyncRegisterForRemoteNotifications", "S.SyncRegisterForRemoteNotifications(hPrinter, pNotifyFilter) -> (phRpcHandle, result)", (py_dcerpc_call_fn)dcerpc_winspool_SyncRegisterForRemoteNotifications_r, (py_data_pack_fn)pack_py_winspool_SyncRegisterForRemoteNotifications_args_in, (py_data_unpack_fn)unpack_py_winspool_SyncRegisterForRemoteNotifications_args_out, 58, &ndr_table_iremotewinspool }, { "SyncUnRegisterForRemoteNotifications", "S.SyncUnRegisterForRemoteNotifications(phRpcHandle) -> (phRpcHandle, result)", (py_dcerpc_call_fn)dcerpc_winspool_SyncUnRegisterForRemoteNotifications_r, (py_data_pack_fn)pack_py_winspool_SyncUnRegisterForRemoteNotifications_args_in, (py_data_unpack_fn)unpack_py_winspool_SyncUnRegisterForRemoteNotifications_args_out, 59, &ndr_table_iremotewinspool }, { "SyncRefreshRemoteNotifications", "S.SyncRefreshRemoteNotifications(hRpcHandle, pNotifyFilter) -> (ppNotifyData, result)", (py_dcerpc_call_fn)dcerpc_winspool_SyncRefreshRemoteNotifications_r, (py_data_pack_fn)pack_py_winspool_SyncRefreshRemoteNotifications_args_in, (py_data_unpack_fn)unpack_py_winspool_SyncRefreshRemoteNotifications_args_out, 60, &ndr_table_iremotewinspool }, { "AsyncGetRemoteNotifications", "S.AsyncGetRemoteNotifications(hRpcHandle) -> (ppNotifyData, result)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetRemoteNotifications_r, (py_data_pack_fn)pack_py_winspool_AsyncGetRemoteNotifications_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetRemoteNotifications_args_out, 61, &ndr_table_iremotewinspool }, { "AsyncInstallPrinterDriverFromPackage", "S.AsyncInstallPrinterDriverFromPackage(pszServer, pszInfPath, pszDriverName, pszEnvironment, dwFlags) -> result", (py_dcerpc_call_fn)dcerpc_winspool_AsyncInstallPrinterDriverFromPackage_r, (py_data_pack_fn)pack_py_winspool_AsyncInstallPrinterDriverFromPackage_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncInstallPrinterDriverFromPackage_args_out, 62, &ndr_table_iremotewinspool }, { "AsyncUploadPrinterDriverPackage", "S.AsyncUploadPrinterDriverPackage(pszServer, pszInfPath, pszEnvironment, dwFlags, pszDestInfPath) -> (pszDestInfPath, result)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncUploadPrinterDriverPackage_r, (py_data_pack_fn)pack_py_winspool_AsyncUploadPrinterDriverPackage_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncUploadPrinterDriverPackage_args_out, 63, &ndr_table_iremotewinspool }, { "AsyncGetCorePrinterDrivers", "S.AsyncGetCorePrinterDrivers(pszServer, pszEnvironment, pszzCoreDriverDependencies, cCorePrinterDrivers) -> (pCorePrinterDrivers, result)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetCorePrinterDrivers_r, (py_data_pack_fn)pack_py_winspool_AsyncGetCorePrinterDrivers_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetCorePrinterDrivers_args_out, 64, &ndr_table_iremotewinspool }, { "AsyncCorePrinterDriverInstalled", "S.AsyncCorePrinterDriverInstalled(pszServer, pszEnvironment, CoreDriverGUID, ftDriverDate, dwlDriverVersion) -> (pbDriverInstalled, result)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncCorePrinterDriverInstalled_r, (py_data_pack_fn)pack_py_winspool_AsyncCorePrinterDriverInstalled_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncCorePrinterDriverInstalled_args_out, 65, &ndr_table_iremotewinspool }, { "AsyncGetPrinterDriverPackagePath", "S.AsyncGetPrinterDriverPackagePath(pszServer, pszEnvironment, pszLanguage, pszPackageID, pszDriverPackageCab) -> (pszDriverPackageCab, pcchRequiredSize, result)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetPrinterDriverPackagePath_r, (py_data_pack_fn)pack_py_winspool_AsyncGetPrinterDriverPackagePath_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetPrinterDriverPackagePath_args_out, 66, &ndr_table_iremotewinspool }, { "AsyncDeletePrinterDriverPackage", "S.AsyncDeletePrinterDriverPackage(pszServer, pszInfPath, pszEnvironment) -> result", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeletePrinterDriverPackage_r, (py_data_pack_fn)pack_py_winspool_AsyncDeletePrinterDriverPackage_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeletePrinterDriverPackage_args_out, 67, &ndr_table_iremotewinspool }, { "AsyncReadPrinter", "S.AsyncReadPrinter(hPrinter, cbBuf) -> (pBuf, pcNoBytesRead)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncReadPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncReadPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncReadPrinter_args_out, 68, &ndr_table_iremotewinspool }, { "AsyncResetPrinter", "S.AsyncResetPrinter(hPrinter, pDatatype, pDevModeContainer) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncResetPrinter_r, (py_data_pack_fn)pack_py_winspool_AsyncResetPrinter_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncResetPrinter_args_out, 69, &ndr_table_iremotewinspool }, { "AsyncGetJobNamedPropertyValue", "S.AsyncGetJobNamedPropertyValue(hPrinter, JobId, pszName) -> pValue", (py_dcerpc_call_fn)dcerpc_winspool_AsyncGetJobNamedPropertyValue_r, (py_data_pack_fn)pack_py_winspool_AsyncGetJobNamedPropertyValue_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncGetJobNamedPropertyValue_args_out, 70, &ndr_table_iremotewinspool }, { "AsyncSetJobNamedProperty", "S.AsyncSetJobNamedProperty(hPrinter, JobId, pProperty) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncSetJobNamedProperty_r, (py_data_pack_fn)pack_py_winspool_AsyncSetJobNamedProperty_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncSetJobNamedProperty_args_out, 71, &ndr_table_iremotewinspool }, { "AsyncDeleteJobNamedProperty", "S.AsyncDeleteJobNamedProperty(hPrinter, JobId, pszName) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncDeleteJobNamedProperty_r, (py_data_pack_fn)pack_py_winspool_AsyncDeleteJobNamedProperty_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncDeleteJobNamedProperty_args_out, 72, &ndr_table_iremotewinspool }, { "AsyncEnumJobNamedProperties", "S.AsyncEnumJobNamedProperties(hPrinter, JobId) -> (pcProperties, ppProperties)", (py_dcerpc_call_fn)dcerpc_winspool_AsyncEnumJobNamedProperties_r, (py_data_pack_fn)pack_py_winspool_AsyncEnumJobNamedProperties_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncEnumJobNamedProperties_args_out, 73, &ndr_table_iremotewinspool }, { "AsyncLogJobInfoForBranchOffice", "S.AsyncLogJobInfoForBranchOffice(hPrinter, pBranchOfficeJobDataContainer) -> None", (py_dcerpc_call_fn)dcerpc_winspool_AsyncLogJobInfoForBranchOffice_r, (py_data_pack_fn)pack_py_winspool_AsyncLogJobInfoForBranchOffice_args_in, (py_data_unpack_fn)unpack_py_winspool_AsyncLogJobInfoForBranchOffice_args_out, 74, &ndr_table_iremotewinspool }, {0} }; static PyObject *interface_iremotewinspool_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_iremotewinspool); } #define PY_DOC_IREMOTEWINSPOOL "IRemoteWinspool SubSystem" static PyTypeObject iremotewinspool_InterfaceType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.iremotewinspool", .tp_basicsize = sizeof(dcerpc_InterfaceObject), .tp_doc = "iremotewinspool(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_IREMOTEWINSPOOL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = interface_iremotewinspool_new, }; static PyObject *syntax_iremotewinspool_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_iremotewinspool.syntax_id); } #define PY_DOC_IREMOTEWINSPOOL_SYNTAX "IRemoteWinspool SubSystem" static PyTypeObject iremotewinspool_SyntaxType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "winspool.iremotewinspool_abstract_syntax", .tp_doc = "iremotewinspool_abstract_syntax()\n"PY_DOC_IREMOTEWINSPOOL_SYNTAX, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = syntax_iremotewinspool_new, }; static PyMethodDef winspool_methods[] = { { NULL, NULL, 0, NULL } }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "winspool", .m_doc = "winspool DCE/RPC", .m_size = -1, .m_methods = winspool_methods, }; MODULE_INIT_FUNC(winspool) { PyObject *m = NULL; PyObject *dep_samba_dcerpc_misc = NULL; PyObject *dep_samba_dcerpc_security = NULL; PyObject *dep_samba_dcerpc_winreg = NULL; PyObject *dep_samba_dcerpc_spoolss = 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_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security"); if (dep_samba_dcerpc_security == NULL) goto out; dep_samba_dcerpc_winreg = PyImport_ImportModule("samba.dcerpc.winreg"); if (dep_samba_dcerpc_winreg == NULL) goto out; dep_samba_dcerpc_spoolss = PyImport_ImportModule("samba.dcerpc.spoolss"); if (dep_samba_dcerpc_spoolss == 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; spoolss_NotifyInfo_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "NotifyInfo"); if (spoolss_NotifyInfo_Type == NULL) goto out; BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject"); if (BaseObject_Type == NULL) goto out; spoolss_NotifyOption_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "NotifyOption"); if (spoolss_NotifyOption_Type == NULL) goto out; spoolss_TimeCtr_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "TimeCtr"); if (spoolss_TimeCtr_Type == NULL) goto out; spoolss_DevmodeContainer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "DevmodeContainer"); if (spoolss_DevmodeContainer_Type == NULL) goto out; sec_desc_buf_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "sec_desc_buf"); if (sec_desc_buf_Type == NULL) goto out; policy_handle_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "policy_handle"); if (policy_handle_Type == NULL) goto out; spoolss_UserLevelCtr_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "UserLevelCtr"); if (spoolss_UserLevelCtr_Type == NULL) goto out; spoolss_SetPrinterInfoCtr_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "SetPrinterInfoCtr"); if (spoolss_SetPrinterInfoCtr_Type == NULL) goto out; spoolss_JobInfoContainer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "JobInfoContainer"); if (spoolss_JobInfoContainer_Type == NULL) goto out; spoolss_DocumentInfoCtr_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "DocumentInfoCtr"); if (spoolss_DocumentInfoCtr_Type == NULL) goto out; spoolss_AddFormInfoCtr_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "AddFormInfoCtr"); if (spoolss_AddFormInfoCtr_Type == NULL) goto out; RPC_BIDI_REQUEST_CONTAINER_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "RPC_BIDI_REQUEST_CONTAINER"); if (RPC_BIDI_REQUEST_CONTAINER_Type == NULL) goto out; RPC_BIDI_RESPONSE_CONTAINER_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "RPC_BIDI_RESPONSE_CONTAINER"); if (RPC_BIDI_RESPONSE_CONTAINER_Type == NULL) goto out; spoolss_AddDriverInfoCtr_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "AddDriverInfoCtr"); if (spoolss_AddDriverInfoCtr_Type == NULL) goto out; spoolss_SetPortInfoContainer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "SetPortInfoContainer"); if (spoolss_SetPortInfoContainer_Type == NULL) goto out; spoolss_PortVarContainer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "PortVarContainer"); if (spoolss_PortVarContainer_Type == NULL) goto out; spoolss_MonitorContainer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "MonitorContainer"); if (spoolss_MonitorContainer_Type == NULL) goto out; spoolss_CorePrinterDriver_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "CorePrinterDriver"); if (spoolss_CorePrinterDriver_Type == NULL) goto out; GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID"); if (GUID_Type == NULL) goto out; spoolss_PrintPropertyValue_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "PrintPropertyValue"); if (spoolss_PrintPropertyValue_Type == NULL) goto out; spoolss_PrintNamedProperty_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "PrintNamedProperty"); if (spoolss_PrintNamedProperty_Type == NULL) goto out; spoolss_BranchOfficeJobDataContainer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_spoolss, "BranchOfficeJobDataContainer"); if (spoolss_BranchOfficeJobDataContainer_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; winspool_NOTIFY_REPLY_CONTAINER_Type.tp_base = BaseObject_Type; winspool_NOTIFY_REPLY_CONTAINER_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_NOTIFY_OPTIONS_CONTAINER_Type.tp_base = BaseObject_Type; winspool_NOTIFY_OPTIONS_CONTAINER_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_PrintPropertyValueUnion_Type.tp_base = BaseObject_Type; winspool_PrintPropertyValueUnion_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_PrintPropertyValue_Type.tp_base = BaseObject_Type; winspool_PrintPropertyValue_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_PrintNamedProperty_Type.tp_base = BaseObject_Type; winspool_PrintNamedProperty_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_PrintPropertiesCollection_Type.tp_base = BaseObject_Type; winspool_PrintPropertiesCollection_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncOpenPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncOpenPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncAddPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSetJob_Type.tp_base = BaseObject_Type; winspool_AsyncSetJob_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetJob_Type.tp_base = BaseObject_Type; winspool_AsyncGetJob_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumJobs_Type.tp_base = BaseObject_Type; winspool_AsyncEnumJobs_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddJob_Type.tp_base = BaseObject_Type; winspool_AsyncAddJob_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncScheduleJob_Type.tp_base = BaseObject_Type; winspool_AsyncScheduleJob_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinter_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSetPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncSetPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncGetPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncStartDocPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncStartDocPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncStartPagePrinter_Type.tp_base = BaseObject_Type; winspool_AsyncStartPagePrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncWritePrinter_Type.tp_base = BaseObject_Type; winspool_AsyncWritePrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEndPagePrinter_Type.tp_base = BaseObject_Type; winspool_AsyncEndPagePrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEndDocPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncEndDocPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAbortPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncAbortPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetPrinterData_Type.tp_base = BaseObject_Type; winspool_AsyncGetPrinterData_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetPrinterDataEx_Type.tp_base = BaseObject_Type; winspool_AsyncGetPrinterDataEx_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSetPrinterData_Type.tp_base = BaseObject_Type; winspool_AsyncSetPrinterData_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSetPrinterDataEx_Type.tp_base = BaseObject_Type; winspool_AsyncSetPrinterDataEx_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncClosePrinter_Type.tp_base = BaseObject_Type; winspool_AsyncClosePrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddForm_Type.tp_base = BaseObject_Type; winspool_AsyncAddForm_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeleteForm_Type.tp_base = BaseObject_Type; winspool_AsyncDeleteForm_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetForm_Type.tp_base = BaseObject_Type; winspool_AsyncGetForm_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSetForm_Type.tp_base = BaseObject_Type; winspool_AsyncSetForm_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumForms_Type.tp_base = BaseObject_Type; winspool_AsyncEnumForms_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetPrinterDriver_Type.tp_base = BaseObject_Type; winspool_AsyncGetPrinterDriver_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPrinterData_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPrinterData_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPrinterDataEx_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPrinterDataEx_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPrinterKey_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPrinterKey_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinterData_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinterData_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinterDataEx_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinterDataEx_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinterKey_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinterKey_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncXcvData_Type.tp_base = BaseObject_Type; winspool_AsyncXcvData_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSendRecvBidiData_Type.tp_base = BaseObject_Type; winspool_AsyncSendRecvBidiData_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncCreatePrinterIC_Type.tp_base = BaseObject_Type; winspool_AsyncCreatePrinterIC_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncPlayGdiScriptOnPrinterIC_Type.tp_base = BaseObject_Type; winspool_AsyncPlayGdiScriptOnPrinterIC_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinterIC_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinterIC_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPrinters_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPrinters_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddPrinterDriver_Type.tp_base = BaseObject_Type; winspool_AsyncAddPrinterDriver_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPrinterDrivers_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPrinterDrivers_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetPrinterDriverDirectory_Type.tp_base = BaseObject_Type; winspool_AsyncGetPrinterDriverDirectory_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinterDriver_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinterDriver_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinterDriverEx_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinterDriverEx_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddPrintProcessor_Type.tp_base = BaseObject_Type; winspool_AsyncAddPrintProcessor_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPrintProcessors_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPrintProcessors_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetPrintProcessorDirectory_Type.tp_base = BaseObject_Type; winspool_AsyncGetPrintProcessorDirectory_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPorts_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPorts_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumMonitors_Type.tp_base = BaseObject_Type; winspool_AsyncEnumMonitors_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddPort_Type.tp_base = BaseObject_Type; winspool_AsyncAddPort_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSetPort_Type.tp_base = BaseObject_Type; winspool_AsyncSetPort_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddMonitor_Type.tp_base = BaseObject_Type; winspool_AsyncAddMonitor_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeleteMonitor_Type.tp_base = BaseObject_Type; winspool_AsyncDeleteMonitor_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrintProcessor_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrintProcessor_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPrintProcessorDatatypes_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPrintProcessorDatatypes_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncAddPerMachineConnection_Type.tp_base = BaseObject_Type; winspool_AsyncAddPerMachineConnection_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePerMachineConnection_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePerMachineConnection_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumPerMachineConnections_Type.tp_base = BaseObject_Type; winspool_AsyncEnumPerMachineConnections_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_SyncRegisterForRemoteNotifications_Type.tp_base = BaseObject_Type; winspool_SyncRegisterForRemoteNotifications_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_SyncUnRegisterForRemoteNotifications_Type.tp_base = BaseObject_Type; winspool_SyncUnRegisterForRemoteNotifications_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_SyncRefreshRemoteNotifications_Type.tp_base = BaseObject_Type; winspool_SyncRefreshRemoteNotifications_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetRemoteNotifications_Type.tp_base = BaseObject_Type; winspool_AsyncGetRemoteNotifications_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncInstallPrinterDriverFromPackage_Type.tp_base = BaseObject_Type; winspool_AsyncInstallPrinterDriverFromPackage_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncUploadPrinterDriverPackage_Type.tp_base = BaseObject_Type; winspool_AsyncUploadPrinterDriverPackage_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetCorePrinterDrivers_Type.tp_base = BaseObject_Type; winspool_AsyncGetCorePrinterDrivers_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncCorePrinterDriverInstalled_Type.tp_base = BaseObject_Type; winspool_AsyncCorePrinterDriverInstalled_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetPrinterDriverPackagePath_Type.tp_base = BaseObject_Type; winspool_AsyncGetPrinterDriverPackagePath_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeletePrinterDriverPackage_Type.tp_base = BaseObject_Type; winspool_AsyncDeletePrinterDriverPackage_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncReadPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncReadPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncResetPrinter_Type.tp_base = BaseObject_Type; winspool_AsyncResetPrinter_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncGetJobNamedPropertyValue_Type.tp_base = BaseObject_Type; winspool_AsyncGetJobNamedPropertyValue_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncSetJobNamedProperty_Type.tp_base = BaseObject_Type; winspool_AsyncSetJobNamedProperty_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncDeleteJobNamedProperty_Type.tp_base = BaseObject_Type; winspool_AsyncDeleteJobNamedProperty_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncEnumJobNamedProperties_Type.tp_base = BaseObject_Type; winspool_AsyncEnumJobNamedProperties_Type.tp_basicsize = pytalloc_BaseObject_size(); winspool_AsyncLogJobInfoForBranchOffice_Type.tp_base = BaseObject_Type; winspool_AsyncLogJobInfoForBranchOffice_Type.tp_basicsize = pytalloc_BaseObject_size(); iremotewinspool_InterfaceType.tp_base = ClientConnection_Type; iremotewinspool_SyntaxType.tp_base = ndr_syntax_id_Type; iremotewinspool_SyntaxType.tp_basicsize = pytalloc_BaseObject_size(); if (PyType_Ready(&winspool_NOTIFY_REPLY_CONTAINER_Type) < 0) goto out; if (PyType_Ready(&winspool_NOTIFY_OPTIONS_CONTAINER_Type) < 0) goto out; if (PyType_Ready(&winspool_PrintPropertyValueUnion_Type) < 0) goto out; if (PyType_Ready(&winspool_PrintPropertyValue_Type) < 0) goto out; if (PyType_Ready(&winspool_PrintNamedProperty_Type) < 0) goto out; if (PyType_Ready(&winspool_PrintPropertiesCollection_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncOpenPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSetJob_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetJob_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumJobs_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddJob_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncScheduleJob_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSetPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncStartDocPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncStartPagePrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncWritePrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEndPagePrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEndDocPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAbortPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetPrinterData_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetPrinterDataEx_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSetPrinterData_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSetPrinterDataEx_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncClosePrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddForm_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeleteForm_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetForm_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSetForm_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumForms_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetPrinterDriver_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPrinterData_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPrinterDataEx_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPrinterKey_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinterData_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinterDataEx_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinterKey_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncXcvData_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSendRecvBidiData_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncCreatePrinterIC_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncPlayGdiScriptOnPrinterIC_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinterIC_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPrinters_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddPrinterDriver_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPrinterDrivers_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetPrinterDriverDirectory_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinterDriver_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinterDriverEx_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddPrintProcessor_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPrintProcessors_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetPrintProcessorDirectory_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPorts_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumMonitors_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddPort_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSetPort_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddMonitor_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeleteMonitor_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrintProcessor_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPrintProcessorDatatypes_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncAddPerMachineConnection_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePerMachineConnection_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumPerMachineConnections_Type) < 0) goto out; if (PyType_Ready(&winspool_SyncRegisterForRemoteNotifications_Type) < 0) goto out; if (PyType_Ready(&winspool_SyncUnRegisterForRemoteNotifications_Type) < 0) goto out; if (PyType_Ready(&winspool_SyncRefreshRemoteNotifications_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetRemoteNotifications_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncInstallPrinterDriverFromPackage_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncUploadPrinterDriverPackage_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetCorePrinterDrivers_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncCorePrinterDriverInstalled_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetPrinterDriverPackagePath_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeletePrinterDriverPackage_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncReadPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncResetPrinter_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncGetJobNamedPropertyValue_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncSetJobNamedProperty_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncDeleteJobNamedProperty_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncEnumJobNamedProperties_Type) < 0) goto out; if (PyType_Ready(&winspool_AsyncLogJobInfoForBranchOffice_Type) < 0) goto out; if (PyType_Ready(&iremotewinspool_InterfaceType) < 0) goto out; if (PyType_Ready(&iremotewinspool_SyntaxType) < 0) goto out; if (!PyInterface_AddNdrRpcMethods(&iremotewinspool_InterfaceType, py_ndr_iremotewinspool_methods)) return NULL; #ifdef PY_NOTIFY_REPLY_CONTAINER_PATCH PY_NOTIFY_REPLY_CONTAINER_PATCH(&winspool_NOTIFY_REPLY_CONTAINER_Type); #endif #ifdef PY_NOTIFY_OPTIONS_CONTAINER_PATCH PY_NOTIFY_OPTIONS_CONTAINER_PATCH(&winspool_NOTIFY_OPTIONS_CONTAINER_Type); #endif #ifdef PY_PRINTPROPERTYVALUEUNION_PATCH PY_PRINTPROPERTYVALUEUNION_PATCH(&winspool_PrintPropertyValueUnion_Type); #endif #ifdef PY_PRINTPROPERTYVALUE_PATCH PY_PRINTPROPERTYVALUE_PATCH(&winspool_PrintPropertyValue_Type); #endif #ifdef PY_PRINTNAMEDPROPERTY_PATCH PY_PRINTNAMEDPROPERTY_PATCH(&winspool_PrintNamedProperty_Type); #endif #ifdef PY_PRINTPROPERTIESCOLLECTION_PATCH PY_PRINTPROPERTIESCOLLECTION_PATCH(&winspool_PrintPropertiesCollection_Type); #endif #ifdef PY_ASYNCOPENPRINTER_PATCH PY_ASYNCOPENPRINTER_PATCH(&winspool_AsyncOpenPrinter_Type); #endif #ifdef PY_ASYNCADDPRINTER_PATCH PY_ASYNCADDPRINTER_PATCH(&winspool_AsyncAddPrinter_Type); #endif #ifdef PY_ASYNCSETJOB_PATCH PY_ASYNCSETJOB_PATCH(&winspool_AsyncSetJob_Type); #endif #ifdef PY_ASYNCGETJOB_PATCH PY_ASYNCGETJOB_PATCH(&winspool_AsyncGetJob_Type); #endif #ifdef PY_ASYNCENUMJOBS_PATCH PY_ASYNCENUMJOBS_PATCH(&winspool_AsyncEnumJobs_Type); #endif #ifdef PY_ASYNCADDJOB_PATCH PY_ASYNCADDJOB_PATCH(&winspool_AsyncAddJob_Type); #endif #ifdef PY_ASYNCSCHEDULEJOB_PATCH PY_ASYNCSCHEDULEJOB_PATCH(&winspool_AsyncScheduleJob_Type); #endif #ifdef PY_ASYNCDELETEPRINTER_PATCH PY_ASYNCDELETEPRINTER_PATCH(&winspool_AsyncDeletePrinter_Type); #endif #ifdef PY_ASYNCSETPRINTER_PATCH PY_ASYNCSETPRINTER_PATCH(&winspool_AsyncSetPrinter_Type); #endif #ifdef PY_ASYNCGETPRINTER_PATCH PY_ASYNCGETPRINTER_PATCH(&winspool_AsyncGetPrinter_Type); #endif #ifdef PY_ASYNCSTARTDOCPRINTER_PATCH PY_ASYNCSTARTDOCPRINTER_PATCH(&winspool_AsyncStartDocPrinter_Type); #endif #ifdef PY_ASYNCSTARTPAGEPRINTER_PATCH PY_ASYNCSTARTPAGEPRINTER_PATCH(&winspool_AsyncStartPagePrinter_Type); #endif #ifdef PY_ASYNCWRITEPRINTER_PATCH PY_ASYNCWRITEPRINTER_PATCH(&winspool_AsyncWritePrinter_Type); #endif #ifdef PY_ASYNCENDPAGEPRINTER_PATCH PY_ASYNCENDPAGEPRINTER_PATCH(&winspool_AsyncEndPagePrinter_Type); #endif #ifdef PY_ASYNCENDDOCPRINTER_PATCH PY_ASYNCENDDOCPRINTER_PATCH(&winspool_AsyncEndDocPrinter_Type); #endif #ifdef PY_ASYNCABORTPRINTER_PATCH PY_ASYNCABORTPRINTER_PATCH(&winspool_AsyncAbortPrinter_Type); #endif #ifdef PY_ASYNCGETPRINTERDATA_PATCH PY_ASYNCGETPRINTERDATA_PATCH(&winspool_AsyncGetPrinterData_Type); #endif #ifdef PY_ASYNCGETPRINTERDATAEX_PATCH PY_ASYNCGETPRINTERDATAEX_PATCH(&winspool_AsyncGetPrinterDataEx_Type); #endif #ifdef PY_ASYNCSETPRINTERDATA_PATCH PY_ASYNCSETPRINTERDATA_PATCH(&winspool_AsyncSetPrinterData_Type); #endif #ifdef PY_ASYNCSETPRINTERDATAEX_PATCH PY_ASYNCSETPRINTERDATAEX_PATCH(&winspool_AsyncSetPrinterDataEx_Type); #endif #ifdef PY_ASYNCCLOSEPRINTER_PATCH PY_ASYNCCLOSEPRINTER_PATCH(&winspool_AsyncClosePrinter_Type); #endif #ifdef PY_ASYNCADDFORM_PATCH PY_ASYNCADDFORM_PATCH(&winspool_AsyncAddForm_Type); #endif #ifdef PY_ASYNCDELETEFORM_PATCH PY_ASYNCDELETEFORM_PATCH(&winspool_AsyncDeleteForm_Type); #endif #ifdef PY_ASYNCGETFORM_PATCH PY_ASYNCGETFORM_PATCH(&winspool_AsyncGetForm_Type); #endif #ifdef PY_ASYNCSETFORM_PATCH PY_ASYNCSETFORM_PATCH(&winspool_AsyncSetForm_Type); #endif #ifdef PY_ASYNCENUMFORMS_PATCH PY_ASYNCENUMFORMS_PATCH(&winspool_AsyncEnumForms_Type); #endif #ifdef PY_ASYNCGETPRINTERDRIVER_PATCH PY_ASYNCGETPRINTERDRIVER_PATCH(&winspool_AsyncGetPrinterDriver_Type); #endif #ifdef PY_ASYNCENUMPRINTERDATA_PATCH PY_ASYNCENUMPRINTERDATA_PATCH(&winspool_AsyncEnumPrinterData_Type); #endif #ifdef PY_ASYNCENUMPRINTERDATAEX_PATCH PY_ASYNCENUMPRINTERDATAEX_PATCH(&winspool_AsyncEnumPrinterDataEx_Type); #endif #ifdef PY_ASYNCENUMPRINTERKEY_PATCH PY_ASYNCENUMPRINTERKEY_PATCH(&winspool_AsyncEnumPrinterKey_Type); #endif #ifdef PY_ASYNCDELETEPRINTERDATA_PATCH PY_ASYNCDELETEPRINTERDATA_PATCH(&winspool_AsyncDeletePrinterData_Type); #endif #ifdef PY_ASYNCDELETEPRINTERDATAEX_PATCH PY_ASYNCDELETEPRINTERDATAEX_PATCH(&winspool_AsyncDeletePrinterDataEx_Type); #endif #ifdef PY_ASYNCDELETEPRINTERKEY_PATCH PY_ASYNCDELETEPRINTERKEY_PATCH(&winspool_AsyncDeletePrinterKey_Type); #endif #ifdef PY_ASYNCXCVDATA_PATCH PY_ASYNCXCVDATA_PATCH(&winspool_AsyncXcvData_Type); #endif #ifdef PY_ASYNCSENDRECVBIDIDATA_PATCH PY_ASYNCSENDRECVBIDIDATA_PATCH(&winspool_AsyncSendRecvBidiData_Type); #endif #ifdef PY_ASYNCCREATEPRINTERIC_PATCH PY_ASYNCCREATEPRINTERIC_PATCH(&winspool_AsyncCreatePrinterIC_Type); #endif #ifdef PY_ASYNCPLAYGDISCRIPTONPRINTERIC_PATCH PY_ASYNCPLAYGDISCRIPTONPRINTERIC_PATCH(&winspool_AsyncPlayGdiScriptOnPrinterIC_Type); #endif #ifdef PY_ASYNCDELETEPRINTERIC_PATCH PY_ASYNCDELETEPRINTERIC_PATCH(&winspool_AsyncDeletePrinterIC_Type); #endif #ifdef PY_ASYNCENUMPRINTERS_PATCH PY_ASYNCENUMPRINTERS_PATCH(&winspool_AsyncEnumPrinters_Type); #endif #ifdef PY_ASYNCADDPRINTERDRIVER_PATCH PY_ASYNCADDPRINTERDRIVER_PATCH(&winspool_AsyncAddPrinterDriver_Type); #endif #ifdef PY_ASYNCENUMPRINTERDRIVERS_PATCH PY_ASYNCENUMPRINTERDRIVERS_PATCH(&winspool_AsyncEnumPrinterDrivers_Type); #endif #ifdef PY_ASYNCGETPRINTERDRIVERDIRECTORY_PATCH PY_ASYNCGETPRINTERDRIVERDIRECTORY_PATCH(&winspool_AsyncGetPrinterDriverDirectory_Type); #endif #ifdef PY_ASYNCDELETEPRINTERDRIVER_PATCH PY_ASYNCDELETEPRINTERDRIVER_PATCH(&winspool_AsyncDeletePrinterDriver_Type); #endif #ifdef PY_ASYNCDELETEPRINTERDRIVEREX_PATCH PY_ASYNCDELETEPRINTERDRIVEREX_PATCH(&winspool_AsyncDeletePrinterDriverEx_Type); #endif #ifdef PY_ASYNCADDPRINTPROCESSOR_PATCH PY_ASYNCADDPRINTPROCESSOR_PATCH(&winspool_AsyncAddPrintProcessor_Type); #endif #ifdef PY_ASYNCENUMPRINTPROCESSORS_PATCH PY_ASYNCENUMPRINTPROCESSORS_PATCH(&winspool_AsyncEnumPrintProcessors_Type); #endif #ifdef PY_ASYNCGETPRINTPROCESSORDIRECTORY_PATCH PY_ASYNCGETPRINTPROCESSORDIRECTORY_PATCH(&winspool_AsyncGetPrintProcessorDirectory_Type); #endif #ifdef PY_ASYNCENUMPORTS_PATCH PY_ASYNCENUMPORTS_PATCH(&winspool_AsyncEnumPorts_Type); #endif #ifdef PY_ASYNCENUMMONITORS_PATCH PY_ASYNCENUMMONITORS_PATCH(&winspool_AsyncEnumMonitors_Type); #endif #ifdef PY_ASYNCADDPORT_PATCH PY_ASYNCADDPORT_PATCH(&winspool_AsyncAddPort_Type); #endif #ifdef PY_ASYNCSETPORT_PATCH PY_ASYNCSETPORT_PATCH(&winspool_AsyncSetPort_Type); #endif #ifdef PY_ASYNCADDMONITOR_PATCH PY_ASYNCADDMONITOR_PATCH(&winspool_AsyncAddMonitor_Type); #endif #ifdef PY_ASYNCDELETEMONITOR_PATCH PY_ASYNCDELETEMONITOR_PATCH(&winspool_AsyncDeleteMonitor_Type); #endif #ifdef PY_ASYNCDELETEPRINTPROCESSOR_PATCH PY_ASYNCDELETEPRINTPROCESSOR_PATCH(&winspool_AsyncDeletePrintProcessor_Type); #endif #ifdef PY_ASYNCENUMPRINTPROCESSORDATATYPES_PATCH PY_ASYNCENUMPRINTPROCESSORDATATYPES_PATCH(&winspool_AsyncEnumPrintProcessorDatatypes_Type); #endif #ifdef PY_ASYNCADDPERMACHINECONNECTION_PATCH PY_ASYNCADDPERMACHINECONNECTION_PATCH(&winspool_AsyncAddPerMachineConnection_Type); #endif #ifdef PY_ASYNCDELETEPERMACHINECONNECTION_PATCH PY_ASYNCDELETEPERMACHINECONNECTION_PATCH(&winspool_AsyncDeletePerMachineConnection_Type); #endif #ifdef PY_ASYNCENUMPERMACHINECONNECTIONS_PATCH PY_ASYNCENUMPERMACHINECONNECTIONS_PATCH(&winspool_AsyncEnumPerMachineConnections_Type); #endif #ifdef PY_SYNCREGISTERFORREMOTENOTIFICATIONS_PATCH PY_SYNCREGISTERFORREMOTENOTIFICATIONS_PATCH(&winspool_SyncRegisterForRemoteNotifications_Type); #endif #ifdef PY_SYNCUNREGISTERFORREMOTENOTIFICATIONS_PATCH PY_SYNCUNREGISTERFORREMOTENOTIFICATIONS_PATCH(&winspool_SyncUnRegisterForRemoteNotifications_Type); #endif #ifdef PY_SYNCREFRESHREMOTENOTIFICATIONS_PATCH PY_SYNCREFRESHREMOTENOTIFICATIONS_PATCH(&winspool_SyncRefreshRemoteNotifications_Type); #endif #ifdef PY_ASYNCGETREMOTENOTIFICATIONS_PATCH PY_ASYNCGETREMOTENOTIFICATIONS_PATCH(&winspool_AsyncGetRemoteNotifications_Type); #endif #ifdef PY_ASYNCINSTALLPRINTERDRIVERFROMPACKAGE_PATCH PY_ASYNCINSTALLPRINTERDRIVERFROMPACKAGE_PATCH(&winspool_AsyncInstallPrinterDriverFromPackage_Type); #endif #ifdef PY_ASYNCUPLOADPRINTERDRIVERPACKAGE_PATCH PY_ASYNCUPLOADPRINTERDRIVERPACKAGE_PATCH(&winspool_AsyncUploadPrinterDriverPackage_Type); #endif #ifdef PY_ASYNCGETCOREPRINTERDRIVERS_PATCH PY_ASYNCGETCOREPRINTERDRIVERS_PATCH(&winspool_AsyncGetCorePrinterDrivers_Type); #endif #ifdef PY_ASYNCCOREPRINTERDRIVERINSTALLED_PATCH PY_ASYNCCOREPRINTERDRIVERINSTALLED_PATCH(&winspool_AsyncCorePrinterDriverInstalled_Type); #endif #ifdef PY_ASYNCGETPRINTERDRIVERPACKAGEPATH_PATCH PY_ASYNCGETPRINTERDRIVERPACKAGEPATH_PATCH(&winspool_AsyncGetPrinterDriverPackagePath_Type); #endif #ifdef PY_ASYNCDELETEPRINTERDRIVERPACKAGE_PATCH PY_ASYNCDELETEPRINTERDRIVERPACKAGE_PATCH(&winspool_AsyncDeletePrinterDriverPackage_Type); #endif #ifdef PY_ASYNCREADPRINTER_PATCH PY_ASYNCREADPRINTER_PATCH(&winspool_AsyncReadPrinter_Type); #endif #ifdef PY_ASYNCRESETPRINTER_PATCH PY_ASYNCRESETPRINTER_PATCH(&winspool_AsyncResetPrinter_Type); #endif #ifdef PY_ASYNCGETJOBNAMEDPROPERTYVALUE_PATCH PY_ASYNCGETJOBNAMEDPROPERTYVALUE_PATCH(&winspool_AsyncGetJobNamedPropertyValue_Type); #endif #ifdef PY_ASYNCSETJOBNAMEDPROPERTY_PATCH PY_ASYNCSETJOBNAMEDPROPERTY_PATCH(&winspool_AsyncSetJobNamedProperty_Type); #endif #ifdef PY_ASYNCDELETEJOBNAMEDPROPERTY_PATCH PY_ASYNCDELETEJOBNAMEDPROPERTY_PATCH(&winspool_AsyncDeleteJobNamedProperty_Type); #endif #ifdef PY_ASYNCENUMJOBNAMEDPROPERTIES_PATCH PY_ASYNCENUMJOBNAMEDPROPERTIES_PATCH(&winspool_AsyncEnumJobNamedProperties_Type); #endif #ifdef PY_ASYNCLOGJOBINFOFORBRANCHOFFICE_PATCH PY_ASYNCLOGJOBINFOFORBRANCHOFFICE_PATCH(&winspool_AsyncLogJobInfoForBranchOffice_Type); #endif #ifdef PY_IREMOTEWINSPOOL_PATCH PY_IREMOTEWINSPOOL_PATCH(&iremotewinspool_InterfaceType); #endif #ifdef PY_IREMOTEWINSPOOL_ABSTRACT_SYNTAX_PATCH PY_IREMOTEWINSPOOL_ABSTRACT_SYNTAX_PATCH(&iremotewinspool_SyntaxType); #endif #ifdef PY_ABSTRACT_SYNTAX_PATCH PY_ABSTRACT_SYNTAX_PATCH(&iremotewinspool_SyntaxType); #endif m = PyModule_Create(&moduledef); if (m == NULL) goto out; PyModule_AddObject(m, "IREMOTEWINSPOOL_OBJECT_GUID", PyUnicode_FromString("9940CA8E-512F-4C58-88A9-61098D6896BD")); PyModule_AddObject(m, "PropertyTypeString", PyLong_FromLong((uint16_t)winspool_PropertyTypeString)); PyModule_AddObject(m, "PropertyTypeInt32", PyLong_FromLong((uint16_t)winspool_PropertyTypeInt32)); PyModule_AddObject(m, "PropertyTypeInt64", PyLong_FromLong((uint16_t)winspool_PropertyTypeInt64)); PyModule_AddObject(m, "PropertyTypeByte", PyLong_FromLong((uint16_t)winspool_PropertyTypeByte)); PyModule_AddObject(m, "PropertyTypeTime", PyLong_FromLong((uint16_t)winspool_PropertyTypeTime)); PyModule_AddObject(m, "PropertyTypeDevMode", PyLong_FromLong((uint16_t)winspool_PropertyTypeDevMode)); PyModule_AddObject(m, "PropertyTypeSD", PyLong_FromLong((uint16_t)winspool_PropertyTypeSD)); PyModule_AddObject(m, "PropertyTypeNotificationReply", PyLong_FromLong((uint16_t)winspool_PropertyTypeNotificationReply)); PyModule_AddObject(m, "PropertyTypeNotificationOptions", PyLong_FromLong((uint16_t)winspool_PropertyTypeNotificationOptions)); PyModule_AddObject(m, "IPDFP_FLAG_NONE", PyLong_FromUnsignedLongLong((uint32_t)IPDFP_FLAG_NONE)); PyModule_AddObject(m, "IPDFP_COPY_ALL_FILES", PyLong_FromUnsignedLongLong((uint32_t)IPDFP_COPY_ALL_FILES)); PyModule_AddObject(m, "UPDP_FLAG_NONE", PyLong_FromUnsignedLongLong((uint32_t)UPDP_FLAG_NONE)); PyModule_AddObject(m, "UPDP_UPLOAD_ALWAYS", PyLong_FromUnsignedLongLong((uint32_t)UPDP_UPLOAD_ALWAYS)); PyModule_AddObject(m, "UPDP_CHECK_DRIVERSTORE", PyLong_FromUnsignedLongLong((uint32_t)UPDP_CHECK_DRIVERSTORE)); Py_INCREF((PyObject *)(void *)&winspool_NOTIFY_REPLY_CONTAINER_Type); PyModule_AddObject(m, "NOTIFY_REPLY_CONTAINER", (PyObject *)(void *)&winspool_NOTIFY_REPLY_CONTAINER_Type); Py_INCREF((PyObject *)(void *)&winspool_NOTIFY_OPTIONS_CONTAINER_Type); PyModule_AddObject(m, "NOTIFY_OPTIONS_CONTAINER", (PyObject *)(void *)&winspool_NOTIFY_OPTIONS_CONTAINER_Type); Py_INCREF((PyObject *)(void *)&winspool_PrintPropertyValueUnion_Type); PyModule_AddObject(m, "PrintPropertyValueUnion", (PyObject *)(void *)&winspool_PrintPropertyValueUnion_Type); Py_INCREF((PyObject *)(void *)&winspool_PrintPropertyValue_Type); PyModule_AddObject(m, "PrintPropertyValue", (PyObject *)(void *)&winspool_PrintPropertyValue_Type); Py_INCREF((PyObject *)(void *)&winspool_PrintNamedProperty_Type); PyModule_AddObject(m, "PrintNamedProperty", (PyObject *)(void *)&winspool_PrintNamedProperty_Type); Py_INCREF((PyObject *)(void *)&winspool_PrintPropertiesCollection_Type); PyModule_AddObject(m, "PrintPropertiesCollection", (PyObject *)(void *)&winspool_PrintPropertiesCollection_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncOpenPrinter_Type); PyModule_AddObject(m, "AsyncOpenPrinter", (PyObject *)(void *)&winspool_AsyncOpenPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddPrinter_Type); PyModule_AddObject(m, "AsyncAddPrinter", (PyObject *)(void *)&winspool_AsyncAddPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSetJob_Type); PyModule_AddObject(m, "AsyncSetJob", (PyObject *)(void *)&winspool_AsyncSetJob_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetJob_Type); PyModule_AddObject(m, "AsyncGetJob", (PyObject *)(void *)&winspool_AsyncGetJob_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumJobs_Type); PyModule_AddObject(m, "AsyncEnumJobs", (PyObject *)(void *)&winspool_AsyncEnumJobs_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddJob_Type); PyModule_AddObject(m, "AsyncAddJob", (PyObject *)(void *)&winspool_AsyncAddJob_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncScheduleJob_Type); PyModule_AddObject(m, "AsyncScheduleJob", (PyObject *)(void *)&winspool_AsyncScheduleJob_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinter_Type); PyModule_AddObject(m, "AsyncDeletePrinter", (PyObject *)(void *)&winspool_AsyncDeletePrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSetPrinter_Type); PyModule_AddObject(m, "AsyncSetPrinter", (PyObject *)(void *)&winspool_AsyncSetPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetPrinter_Type); PyModule_AddObject(m, "AsyncGetPrinter", (PyObject *)(void *)&winspool_AsyncGetPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncStartDocPrinter_Type); PyModule_AddObject(m, "AsyncStartDocPrinter", (PyObject *)(void *)&winspool_AsyncStartDocPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncStartPagePrinter_Type); PyModule_AddObject(m, "AsyncStartPagePrinter", (PyObject *)(void *)&winspool_AsyncStartPagePrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncWritePrinter_Type); PyModule_AddObject(m, "AsyncWritePrinter", (PyObject *)(void *)&winspool_AsyncWritePrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEndPagePrinter_Type); PyModule_AddObject(m, "AsyncEndPagePrinter", (PyObject *)(void *)&winspool_AsyncEndPagePrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEndDocPrinter_Type); PyModule_AddObject(m, "AsyncEndDocPrinter", (PyObject *)(void *)&winspool_AsyncEndDocPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAbortPrinter_Type); PyModule_AddObject(m, "AsyncAbortPrinter", (PyObject *)(void *)&winspool_AsyncAbortPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetPrinterData_Type); PyModule_AddObject(m, "AsyncGetPrinterData", (PyObject *)(void *)&winspool_AsyncGetPrinterData_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetPrinterDataEx_Type); PyModule_AddObject(m, "AsyncGetPrinterDataEx", (PyObject *)(void *)&winspool_AsyncGetPrinterDataEx_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSetPrinterData_Type); PyModule_AddObject(m, "AsyncSetPrinterData", (PyObject *)(void *)&winspool_AsyncSetPrinterData_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSetPrinterDataEx_Type); PyModule_AddObject(m, "AsyncSetPrinterDataEx", (PyObject *)(void *)&winspool_AsyncSetPrinterDataEx_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncClosePrinter_Type); PyModule_AddObject(m, "AsyncClosePrinter", (PyObject *)(void *)&winspool_AsyncClosePrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddForm_Type); PyModule_AddObject(m, "AsyncAddForm", (PyObject *)(void *)&winspool_AsyncAddForm_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeleteForm_Type); PyModule_AddObject(m, "AsyncDeleteForm", (PyObject *)(void *)&winspool_AsyncDeleteForm_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetForm_Type); PyModule_AddObject(m, "AsyncGetForm", (PyObject *)(void *)&winspool_AsyncGetForm_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSetForm_Type); PyModule_AddObject(m, "AsyncSetForm", (PyObject *)(void *)&winspool_AsyncSetForm_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumForms_Type); PyModule_AddObject(m, "AsyncEnumForms", (PyObject *)(void *)&winspool_AsyncEnumForms_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetPrinterDriver_Type); PyModule_AddObject(m, "AsyncGetPrinterDriver", (PyObject *)(void *)&winspool_AsyncGetPrinterDriver_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPrinterData_Type); PyModule_AddObject(m, "AsyncEnumPrinterData", (PyObject *)(void *)&winspool_AsyncEnumPrinterData_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPrinterDataEx_Type); PyModule_AddObject(m, "AsyncEnumPrinterDataEx", (PyObject *)(void *)&winspool_AsyncEnumPrinterDataEx_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPrinterKey_Type); PyModule_AddObject(m, "AsyncEnumPrinterKey", (PyObject *)(void *)&winspool_AsyncEnumPrinterKey_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinterData_Type); PyModule_AddObject(m, "AsyncDeletePrinterData", (PyObject *)(void *)&winspool_AsyncDeletePrinterData_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinterDataEx_Type); PyModule_AddObject(m, "AsyncDeletePrinterDataEx", (PyObject *)(void *)&winspool_AsyncDeletePrinterDataEx_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinterKey_Type); PyModule_AddObject(m, "AsyncDeletePrinterKey", (PyObject *)(void *)&winspool_AsyncDeletePrinterKey_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncXcvData_Type); PyModule_AddObject(m, "AsyncXcvData", (PyObject *)(void *)&winspool_AsyncXcvData_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSendRecvBidiData_Type); PyModule_AddObject(m, "AsyncSendRecvBidiData", (PyObject *)(void *)&winspool_AsyncSendRecvBidiData_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncCreatePrinterIC_Type); PyModule_AddObject(m, "AsyncCreatePrinterIC", (PyObject *)(void *)&winspool_AsyncCreatePrinterIC_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncPlayGdiScriptOnPrinterIC_Type); PyModule_AddObject(m, "AsyncPlayGdiScriptOnPrinterIC", (PyObject *)(void *)&winspool_AsyncPlayGdiScriptOnPrinterIC_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinterIC_Type); PyModule_AddObject(m, "AsyncDeletePrinterIC", (PyObject *)(void *)&winspool_AsyncDeletePrinterIC_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPrinters_Type); PyModule_AddObject(m, "AsyncEnumPrinters", (PyObject *)(void *)&winspool_AsyncEnumPrinters_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddPrinterDriver_Type); PyModule_AddObject(m, "AsyncAddPrinterDriver", (PyObject *)(void *)&winspool_AsyncAddPrinterDriver_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPrinterDrivers_Type); PyModule_AddObject(m, "AsyncEnumPrinterDrivers", (PyObject *)(void *)&winspool_AsyncEnumPrinterDrivers_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetPrinterDriverDirectory_Type); PyModule_AddObject(m, "AsyncGetPrinterDriverDirectory", (PyObject *)(void *)&winspool_AsyncGetPrinterDriverDirectory_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinterDriver_Type); PyModule_AddObject(m, "AsyncDeletePrinterDriver", (PyObject *)(void *)&winspool_AsyncDeletePrinterDriver_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinterDriverEx_Type); PyModule_AddObject(m, "AsyncDeletePrinterDriverEx", (PyObject *)(void *)&winspool_AsyncDeletePrinterDriverEx_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddPrintProcessor_Type); PyModule_AddObject(m, "AsyncAddPrintProcessor", (PyObject *)(void *)&winspool_AsyncAddPrintProcessor_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPrintProcessors_Type); PyModule_AddObject(m, "AsyncEnumPrintProcessors", (PyObject *)(void *)&winspool_AsyncEnumPrintProcessors_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetPrintProcessorDirectory_Type); PyModule_AddObject(m, "AsyncGetPrintProcessorDirectory", (PyObject *)(void *)&winspool_AsyncGetPrintProcessorDirectory_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPorts_Type); PyModule_AddObject(m, "AsyncEnumPorts", (PyObject *)(void *)&winspool_AsyncEnumPorts_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumMonitors_Type); PyModule_AddObject(m, "AsyncEnumMonitors", (PyObject *)(void *)&winspool_AsyncEnumMonitors_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddPort_Type); PyModule_AddObject(m, "AsyncAddPort", (PyObject *)(void *)&winspool_AsyncAddPort_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSetPort_Type); PyModule_AddObject(m, "AsyncSetPort", (PyObject *)(void *)&winspool_AsyncSetPort_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddMonitor_Type); PyModule_AddObject(m, "AsyncAddMonitor", (PyObject *)(void *)&winspool_AsyncAddMonitor_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeleteMonitor_Type); PyModule_AddObject(m, "AsyncDeleteMonitor", (PyObject *)(void *)&winspool_AsyncDeleteMonitor_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrintProcessor_Type); PyModule_AddObject(m, "AsyncDeletePrintProcessor", (PyObject *)(void *)&winspool_AsyncDeletePrintProcessor_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPrintProcessorDatatypes_Type); PyModule_AddObject(m, "AsyncEnumPrintProcessorDatatypes", (PyObject *)(void *)&winspool_AsyncEnumPrintProcessorDatatypes_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncAddPerMachineConnection_Type); PyModule_AddObject(m, "AsyncAddPerMachineConnection", (PyObject *)(void *)&winspool_AsyncAddPerMachineConnection_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePerMachineConnection_Type); PyModule_AddObject(m, "AsyncDeletePerMachineConnection", (PyObject *)(void *)&winspool_AsyncDeletePerMachineConnection_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumPerMachineConnections_Type); PyModule_AddObject(m, "AsyncEnumPerMachineConnections", (PyObject *)(void *)&winspool_AsyncEnumPerMachineConnections_Type); Py_INCREF((PyObject *)(void *)&winspool_SyncRegisterForRemoteNotifications_Type); PyModule_AddObject(m, "SyncRegisterForRemoteNotifications", (PyObject *)(void *)&winspool_SyncRegisterForRemoteNotifications_Type); Py_INCREF((PyObject *)(void *)&winspool_SyncUnRegisterForRemoteNotifications_Type); PyModule_AddObject(m, "SyncUnRegisterForRemoteNotifications", (PyObject *)(void *)&winspool_SyncUnRegisterForRemoteNotifications_Type); Py_INCREF((PyObject *)(void *)&winspool_SyncRefreshRemoteNotifications_Type); PyModule_AddObject(m, "SyncRefreshRemoteNotifications", (PyObject *)(void *)&winspool_SyncRefreshRemoteNotifications_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetRemoteNotifications_Type); PyModule_AddObject(m, "AsyncGetRemoteNotifications", (PyObject *)(void *)&winspool_AsyncGetRemoteNotifications_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncInstallPrinterDriverFromPackage_Type); PyModule_AddObject(m, "AsyncInstallPrinterDriverFromPackage", (PyObject *)(void *)&winspool_AsyncInstallPrinterDriverFromPackage_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncUploadPrinterDriverPackage_Type); PyModule_AddObject(m, "AsyncUploadPrinterDriverPackage", (PyObject *)(void *)&winspool_AsyncUploadPrinterDriverPackage_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetCorePrinterDrivers_Type); PyModule_AddObject(m, "AsyncGetCorePrinterDrivers", (PyObject *)(void *)&winspool_AsyncGetCorePrinterDrivers_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncCorePrinterDriverInstalled_Type); PyModule_AddObject(m, "AsyncCorePrinterDriverInstalled", (PyObject *)(void *)&winspool_AsyncCorePrinterDriverInstalled_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetPrinterDriverPackagePath_Type); PyModule_AddObject(m, "AsyncGetPrinterDriverPackagePath", (PyObject *)(void *)&winspool_AsyncGetPrinterDriverPackagePath_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeletePrinterDriverPackage_Type); PyModule_AddObject(m, "AsyncDeletePrinterDriverPackage", (PyObject *)(void *)&winspool_AsyncDeletePrinterDriverPackage_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncReadPrinter_Type); PyModule_AddObject(m, "AsyncReadPrinter", (PyObject *)(void *)&winspool_AsyncReadPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncResetPrinter_Type); PyModule_AddObject(m, "AsyncResetPrinter", (PyObject *)(void *)&winspool_AsyncResetPrinter_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncGetJobNamedPropertyValue_Type); PyModule_AddObject(m, "AsyncGetJobNamedPropertyValue", (PyObject *)(void *)&winspool_AsyncGetJobNamedPropertyValue_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncSetJobNamedProperty_Type); PyModule_AddObject(m, "AsyncSetJobNamedProperty", (PyObject *)(void *)&winspool_AsyncSetJobNamedProperty_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncDeleteJobNamedProperty_Type); PyModule_AddObject(m, "AsyncDeleteJobNamedProperty", (PyObject *)(void *)&winspool_AsyncDeleteJobNamedProperty_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncEnumJobNamedProperties_Type); PyModule_AddObject(m, "AsyncEnumJobNamedProperties", (PyObject *)(void *)&winspool_AsyncEnumJobNamedProperties_Type); Py_INCREF((PyObject *)(void *)&winspool_AsyncLogJobInfoForBranchOffice_Type); PyModule_AddObject(m, "AsyncLogJobInfoForBranchOffice", (PyObject *)(void *)&winspool_AsyncLogJobInfoForBranchOffice_Type); Py_INCREF((PyObject *)(void *)&iremotewinspool_InterfaceType); PyModule_AddObject(m, "iremotewinspool", (PyObject *)(void *)&iremotewinspool_InterfaceType); Py_INCREF((PyObject *)(void *)&iremotewinspool_SyntaxType); PyModule_AddObject(m, "iremotewinspool_abstract_syntax", (PyObject *)(void *)&iremotewinspool_SyntaxType); Py_INCREF((PyObject *)(void *)&iremotewinspool_SyntaxType); PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&iremotewinspool_SyntaxType); #ifdef PY_MOD_WINSPOOL_PATCH PY_MOD_WINSPOOL_PATCH(m); #endif out: Py_XDECREF(dep_samba_dcerpc_misc); Py_XDECREF(dep_samba_dcerpc_security); Py_XDECREF(dep_samba_dcerpc_winreg); Py_XDECREF(dep_samba_dcerpc_spoolss); Py_XDECREF(dep_talloc); Py_XDECREF(dep_samba_dcerpc_base); return m; }