/* 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_svcctl.h" #include "bin/default/librpc/gen_ndr/ndr_svcctl_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" static PyTypeObject SERVICE_LOCK_STATUS_Type; static PyTypeObject SERVICE_STATUS_Type; static PyTypeObject SERVICE_STATUS_PROCESS_Type; static PyTypeObject ENUM_SERVICE_STATUSW_Type; static PyTypeObject ENUM_SERVICE_STATUSA_Type; static PyTypeObject QUERY_SERVICE_CONFIG_Type; static PyTypeObject svcctl_ArgumentString_Type; static PyTypeObject SERVICE_DESCRIPTION_Type; static PyTypeObject SC_ACTION_Type; static PyTypeObject SERVICE_FAILURE_ACTIONS_Type; static PyTypeObject svcctl_InterfaceType; static PyTypeObject svcctl_CloseServiceHandle_Type; static PyTypeObject svcctl_ControlService_Type; static PyTypeObject svcctl_DeleteService_Type; static PyTypeObject svcctl_LockServiceDatabase_Type; static PyTypeObject svcctl_QueryServiceObjectSecurity_Type; static PyTypeObject svcctl_SetServiceObjectSecurity_Type; static PyTypeObject svcctl_QueryServiceStatus_Type; static PyTypeObject svcctl_UnlockServiceDatabase_Type; static PyTypeObject svcctl_SCSetServiceBitsW_Type; static PyTypeObject svcctl_ChangeServiceConfigW_Type; static PyTypeObject svcctl_CreateServiceW_Type; static PyTypeObject svcctl_EnumDependentServicesW_Type; static PyTypeObject svcctl_EnumServicesStatusW_Type; static PyTypeObject svcctl_OpenSCManagerW_Type; static PyTypeObject svcctl_OpenServiceW_Type; static PyTypeObject svcctl_QueryServiceConfigW_Type; static PyTypeObject svcctl_QueryServiceLockStatusW_Type; static PyTypeObject svcctl_StartServiceW_Type; static PyTypeObject svcctl_GetServiceDisplayNameW_Type; static PyTypeObject svcctl_GetServiceKeyNameW_Type; static PyTypeObject svcctl_SCSetServiceBitsA_Type; static PyTypeObject svcctl_ChangeServiceConfigA_Type; static PyTypeObject svcctl_CreateServiceA_Type; static PyTypeObject svcctl_EnumDependentServicesA_Type; static PyTypeObject svcctl_EnumServicesStatusA_Type; static PyTypeObject svcctl_OpenSCManagerA_Type; static PyTypeObject svcctl_OpenServiceA_Type; static PyTypeObject svcctl_QueryServiceConfigA_Type; static PyTypeObject svcctl_QueryServiceLockStatusA_Type; static PyTypeObject svcctl_StartServiceA_Type; static PyTypeObject svcctl_GetServiceDisplayNameA_Type; static PyTypeObject svcctl_GetServiceKeyNameA_Type; static PyTypeObject svcctl_ChangeServiceConfig2A_Type; static PyTypeObject svcctl_ChangeServiceConfig2W_Type; static PyTypeObject svcctl_QueryServiceConfig2A_Type; static PyTypeObject svcctl_QueryServiceConfig2W_Type; static PyTypeObject svcctl_QueryServiceStatusEx_Type; static PyTypeObject EnumServicesStatusExA_Type; static PyTypeObject EnumServicesStatusExW_Type; static PyTypeObject *BaseObject_Type; static PyTypeObject *policy_handle_Type; static PyTypeObject *ClientConnection_Type; static PyTypeObject *ndr_syntax_id_Type; static PyObject *py_SERVICE_LOCK_STATUS_get_is_locked(PyObject *obj, void *closure) { struct SERVICE_LOCK_STATUS *object = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(obj); PyObject *py_is_locked; py_is_locked = PyLong_FromUnsignedLongLong((uint32_t)object->is_locked); return py_is_locked; } static int py_SERVICE_LOCK_STATUS_set_is_locked(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_LOCK_STATUS *object = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->is_locked"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->is_locked)); 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->is_locked = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_LOCK_STATUS_get_lock_owner(PyObject *obj, void *closure) { struct SERVICE_LOCK_STATUS *object = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(obj); PyObject *py_lock_owner; if (object->lock_owner == NULL) { Py_RETURN_NONE; } if (object->lock_owner == NULL) { py_lock_owner = Py_None; Py_INCREF(py_lock_owner); } else { if (object->lock_owner == NULL) { py_lock_owner = Py_None; Py_INCREF(py_lock_owner); } else { py_lock_owner = PyUnicode_Decode(object->lock_owner, strlen(object->lock_owner), "utf-8", "ignore"); } } return py_lock_owner; } static int py_SERVICE_LOCK_STATUS_set_lock_owner(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_LOCK_STATUS *object = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->lock_owner"); return -1; } if (value == Py_None) { object->lock_owner = NULL; } else { object->lock_owner = 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->lock_owner = talloc_str; } } return 0; } static PyObject *py_SERVICE_LOCK_STATUS_get_lock_duration(PyObject *obj, void *closure) { struct SERVICE_LOCK_STATUS *object = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(obj); PyObject *py_lock_duration; py_lock_duration = PyLong_FromUnsignedLongLong((uint32_t)object->lock_duration); return py_lock_duration; } static int py_SERVICE_LOCK_STATUS_set_lock_duration(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_LOCK_STATUS *object = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->lock_duration"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->lock_duration)); 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->lock_duration = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_SERVICE_LOCK_STATUS_getsetters[] = { { .name = discard_const_p(char, "is_locked"), .get = py_SERVICE_LOCK_STATUS_get_is_locked, .set = py_SERVICE_LOCK_STATUS_set_is_locked, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "lock_owner"), .get = py_SERVICE_LOCK_STATUS_get_lock_owner, .set = py_SERVICE_LOCK_STATUS_set_lock_owner, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "lock_duration"), .get = py_SERVICE_LOCK_STATUS_get_lock_duration, .set = py_SERVICE_LOCK_STATUS_set_lock_duration, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = NULL } }; static PyObject *py_SERVICE_LOCK_STATUS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct SERVICE_LOCK_STATUS, type); } static PyTypeObject SERVICE_LOCK_STATUS_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SERVICE_LOCK_STATUS", .tp_getset = py_SERVICE_LOCK_STATUS_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_SERVICE_LOCK_STATUS_new, }; static PyObject *py_SERVICE_STATUS_get_type(PyObject *obj, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->type); return py_type; } static int py_SERVICE_STATUS_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->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->type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_STATUS_get_state(PyObject *obj, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(obj); PyObject *py_state; py_state = PyLong_FromUnsignedLongLong((uint32_t)object->state); return py_state; } static int py_SERVICE_STATUS_set_state(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->state"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->state)); 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->state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_STATUS_get_controls_accepted(PyObject *obj, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(obj); PyObject *py_controls_accepted; py_controls_accepted = PyLong_FromUnsignedLongLong((uint32_t)object->controls_accepted); return py_controls_accepted; } static int py_SERVICE_STATUS_set_controls_accepted(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->controls_accepted"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->controls_accepted)); 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->controls_accepted = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_STATUS_get_win32_exit_code(PyObject *obj, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(obj); PyObject *py_win32_exit_code; py_win32_exit_code = PyErr_FromWERROR(object->win32_exit_code); return py_win32_exit_code; } static int py_SERVICE_STATUS_set_win32_exit_code(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->win32_exit_code"); return -1; } object->win32_exit_code = W_ERROR(PyLong_AsLong(value)); return 0; } static PyObject *py_SERVICE_STATUS_get_service_exit_code(PyObject *obj, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(obj); PyObject *py_service_exit_code; py_service_exit_code = PyLong_FromUnsignedLongLong((uint32_t)object->service_exit_code); return py_service_exit_code; } static int py_SERVICE_STATUS_set_service_exit_code(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->service_exit_code"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->service_exit_code)); 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->service_exit_code = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_STATUS_get_check_point(PyObject *obj, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(obj); PyObject *py_check_point; py_check_point = PyLong_FromUnsignedLongLong((uint32_t)object->check_point); return py_check_point; } static int py_SERVICE_STATUS_set_check_point(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->check_point"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->check_point)); 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->check_point = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_STATUS_get_wait_hint(PyObject *obj, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(obj); PyObject *py_wait_hint; py_wait_hint = PyLong_FromUnsignedLongLong((uint32_t)object->wait_hint); return py_wait_hint; } static int py_SERVICE_STATUS_set_wait_hint(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS *object = (struct SERVICE_STATUS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->wait_hint"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->wait_hint)); 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->wait_hint = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_SERVICE_STATUS_getsetters[] = { { .name = discard_const_p(char, "type"), .get = py_SERVICE_STATUS_get_type, .set = py_SERVICE_STATUS_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "state"), .get = py_SERVICE_STATUS_get_state, .set = py_SERVICE_STATUS_set_state, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceStatus") }, { .name = discard_const_p(char, "controls_accepted"), .get = py_SERVICE_STATUS_get_controls_accepted, .set = py_SERVICE_STATUS_set_controls_accepted, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ControlsAccepted") }, { .name = discard_const_p(char, "win32_exit_code"), .get = py_SERVICE_STATUS_get_win32_exit_code, .set = py_SERVICE_STATUS_set_win32_exit_code, .doc = discard_const_p(char, "PIDL-generated element of base type WERROR") }, { .name = discard_const_p(char, "service_exit_code"), .get = py_SERVICE_STATUS_get_service_exit_code, .set = py_SERVICE_STATUS_set_service_exit_code, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "check_point"), .get = py_SERVICE_STATUS_get_check_point, .set = py_SERVICE_STATUS_set_check_point, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "wait_hint"), .get = py_SERVICE_STATUS_get_wait_hint, .set = py_SERVICE_STATUS_set_wait_hint, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = NULL } }; static PyObject *py_SERVICE_STATUS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct SERVICE_STATUS, type); } static PyTypeObject SERVICE_STATUS_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SERVICE_STATUS", .tp_getset = py_SERVICE_STATUS_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_SERVICE_STATUS_new, }; static PyObject *py_SERVICE_STATUS_PROCESS_get_status(PyObject *obj, void *closure) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(obj); PyObject *py_status; py_status = pytalloc_reference_ex(&SERVICE_STATUS_Type, pytalloc_get_mem_ctx(obj), &object->status); return py_status; } static int py_SERVICE_STATUS_PROCESS_set_status(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->status"); return -1; } PY_CHECK_TYPE(&SERVICE_STATUS_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->status = *(struct SERVICE_STATUS *)pytalloc_get_ptr(value); return 0; } static PyObject *py_SERVICE_STATUS_PROCESS_get_process_id(PyObject *obj, void *closure) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(obj); PyObject *py_process_id; py_process_id = PyLong_FromUnsignedLongLong((uint32_t)object->process_id); return py_process_id; } static int py_SERVICE_STATUS_PROCESS_set_process_id(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->process_id"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->process_id)); 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->process_id = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_STATUS_PROCESS_get_service_flags(PyObject *obj, void *closure) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(obj); PyObject *py_service_flags; py_service_flags = PyLong_FromUnsignedLongLong((uint32_t)object->service_flags); return py_service_flags; } static int py_SERVICE_STATUS_PROCESS_set_service_flags(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->service_flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->service_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->service_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_SERVICE_STATUS_PROCESS_getsetters[] = { { .name = discard_const_p(char, "status"), .get = py_SERVICE_STATUS_PROCESS_get_status, .set = py_SERVICE_STATUS_PROCESS_set_status, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_STATUS") }, { .name = discard_const_p(char, "process_id"), .get = py_SERVICE_STATUS_PROCESS_get_process_id, .set = py_SERVICE_STATUS_PROCESS_set_process_id, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "service_flags"), .get = py_SERVICE_STATUS_PROCESS_get_service_flags, .set = py_SERVICE_STATUS_PROCESS_set_service_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = NULL } }; static PyObject *py_SERVICE_STATUS_PROCESS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct SERVICE_STATUS_PROCESS, type); } static PyObject *py_SERVICE_STATUS_PROCESS_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_SERVICE_STATUS_PROCESS); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_SERVICE_STATUS_PROCESS_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_SERVICE_STATUS_PROCESS); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_SERVICE_STATUS_PROCESS); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_SERVICE_STATUS_PROCESS_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct SERVICE_STATUS_PROCESS *object = (struct SERVICE_STATUS_PROCESS *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_SERVICE_STATUS_PROCESS, "SERVICE_STATUS_PROCESS", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_SERVICE_STATUS_PROCESS_methods[] = { { "__ndr_pack__", (PyCFunction)py_SERVICE_STATUS_PROCESS_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_SERVICE_STATUS_PROCESS_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" }, { "__ndr_print__", (PyCFunction)py_SERVICE_STATUS_PROCESS_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject SERVICE_STATUS_PROCESS_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SERVICE_STATUS_PROCESS", .tp_getset = py_SERVICE_STATUS_PROCESS_getsetters, .tp_methods = py_SERVICE_STATUS_PROCESS_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_SERVICE_STATUS_PROCESS_new, }; static PyObject *py_ENUM_SERVICE_STATUSW_get_service_name(PyObject *obj, void *closure) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(obj); PyObject *py_service_name; if (object->service_name == NULL) { Py_RETURN_NONE; } if (object->service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { py_service_name = PyString_FromStringOrNULL(object->service_name); } return py_service_name; } static int py_ENUM_SERVICE_STATUSW_set_service_name(PyObject *py_obj, PyObject *value, void *closure) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->service_name"); return -1; } if (value == Py_None) { object->service_name = NULL; } else { object->service_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->service_name = talloc_str; } } return 0; } static PyObject *py_ENUM_SERVICE_STATUSW_get_display_name(PyObject *obj, void *closure) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(obj); PyObject *py_display_name; if (object->display_name == NULL) { Py_RETURN_NONE; } if (object->display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyString_FromStringOrNULL(object->display_name); } return py_display_name; } static int py_ENUM_SERVICE_STATUSW_set_display_name(PyObject *py_obj, PyObject *value, void *closure) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->display_name"); return -1; } if (value == Py_None) { object->display_name = NULL; } else { object->display_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->display_name = talloc_str; } } return 0; } static PyObject *py_ENUM_SERVICE_STATUSW_get_status(PyObject *obj, void *closure) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(obj); PyObject *py_status; py_status = pytalloc_reference_ex(&SERVICE_STATUS_Type, pytalloc_get_mem_ctx(obj), &object->status); return py_status; } static int py_ENUM_SERVICE_STATUSW_set_status(PyObject *py_obj, PyObject *value, void *closure) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->status"); return -1; } PY_CHECK_TYPE(&SERVICE_STATUS_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->status = *(struct SERVICE_STATUS *)pytalloc_get_ptr(value); return 0; } static PyGetSetDef py_ENUM_SERVICE_STATUSW_getsetters[] = { { .name = discard_const_p(char, "service_name"), .get = py_ENUM_SERVICE_STATUSW_get_service_name, .set = py_ENUM_SERVICE_STATUSW_set_service_name, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "display_name"), .get = py_ENUM_SERVICE_STATUSW_get_display_name, .set = py_ENUM_SERVICE_STATUSW_set_display_name, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "status"), .get = py_ENUM_SERVICE_STATUSW_get_status, .set = py_ENUM_SERVICE_STATUSW_set_status, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_STATUS") }, { .name = NULL } }; static PyObject *py_ENUM_SERVICE_STATUSW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct ENUM_SERVICE_STATUSW, type); } static PyObject *py_ENUM_SERVICE_STATUSW_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_ENUM_SERVICE_STATUSW); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_ENUM_SERVICE_STATUSW_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ENUM_SERVICE_STATUSW); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ENUM_SERVICE_STATUSW); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_ENUM_SERVICE_STATUSW_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct ENUM_SERVICE_STATUSW *object = (struct ENUM_SERVICE_STATUSW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_ENUM_SERVICE_STATUSW, "ENUM_SERVICE_STATUSW", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_ENUM_SERVICE_STATUSW_methods[] = { { "__ndr_pack__", (PyCFunction)py_ENUM_SERVICE_STATUSW_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ENUM_SERVICE_STATUSW_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" }, { "__ndr_print__", (PyCFunction)py_ENUM_SERVICE_STATUSW_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject ENUM_SERVICE_STATUSW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ENUM_SERVICE_STATUSW", .tp_getset = py_ENUM_SERVICE_STATUSW_getsetters, .tp_methods = py_ENUM_SERVICE_STATUSW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_ENUM_SERVICE_STATUSW_new, }; static PyObject *py_ENUM_SERVICE_STATUSA_get_service_name(PyObject *obj, void *closure) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(obj); PyObject *py_service_name; if (object->service_name == NULL) { Py_RETURN_NONE; } if (object->service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { py_service_name = PyString_FromStringOrNULL(object->service_name); } return py_service_name; } static int py_ENUM_SERVICE_STATUSA_set_service_name(PyObject *py_obj, PyObject *value, void *closure) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->service_name"); return -1; } if (value == Py_None) { object->service_name = NULL; } else { object->service_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->service_name = talloc_str; } } return 0; } static PyObject *py_ENUM_SERVICE_STATUSA_get_display_name(PyObject *obj, void *closure) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(obj); PyObject *py_display_name; if (object->display_name == NULL) { Py_RETURN_NONE; } if (object->display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyString_FromStringOrNULL(object->display_name); } return py_display_name; } static int py_ENUM_SERVICE_STATUSA_set_display_name(PyObject *py_obj, PyObject *value, void *closure) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->display_name"); return -1; } if (value == Py_None) { object->display_name = NULL; } else { object->display_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->display_name = talloc_str; } } return 0; } static PyObject *py_ENUM_SERVICE_STATUSA_get_status(PyObject *obj, void *closure) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(obj); PyObject *py_status; py_status = pytalloc_reference_ex(&SERVICE_STATUS_Type, pytalloc_get_mem_ctx(obj), &object->status); return py_status; } static int py_ENUM_SERVICE_STATUSA_set_status(PyObject *py_obj, PyObject *value, void *closure) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->status"); return -1; } PY_CHECK_TYPE(&SERVICE_STATUS_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->status = *(struct SERVICE_STATUS *)pytalloc_get_ptr(value); return 0; } static PyGetSetDef py_ENUM_SERVICE_STATUSA_getsetters[] = { { .name = discard_const_p(char, "service_name"), .get = py_ENUM_SERVICE_STATUSA_get_service_name, .set = py_ENUM_SERVICE_STATUSA_set_service_name, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "display_name"), .get = py_ENUM_SERVICE_STATUSA_get_display_name, .set = py_ENUM_SERVICE_STATUSA_set_display_name, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "status"), .get = py_ENUM_SERVICE_STATUSA_get_status, .set = py_ENUM_SERVICE_STATUSA_set_status, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_STATUS") }, { .name = NULL } }; static PyObject *py_ENUM_SERVICE_STATUSA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct ENUM_SERVICE_STATUSA, type); } static PyObject *py_ENUM_SERVICE_STATUSA_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_ENUM_SERVICE_STATUSA); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_ENUM_SERVICE_STATUSA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ENUM_SERVICE_STATUSA); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ENUM_SERVICE_STATUSA); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_ENUM_SERVICE_STATUSA_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct ENUM_SERVICE_STATUSA *object = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_ENUM_SERVICE_STATUSA, "ENUM_SERVICE_STATUSA", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_ENUM_SERVICE_STATUSA_methods[] = { { "__ndr_pack__", (PyCFunction)py_ENUM_SERVICE_STATUSA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ENUM_SERVICE_STATUSA_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" }, { "__ndr_print__", (PyCFunction)py_ENUM_SERVICE_STATUSA_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject ENUM_SERVICE_STATUSA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ENUM_SERVICE_STATUSA", .tp_getset = py_ENUM_SERVICE_STATUSA_getsetters, .tp_methods = py_ENUM_SERVICE_STATUSA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_ENUM_SERVICE_STATUSA_new, }; static PyObject *py_QUERY_SERVICE_CONFIG_get_service_type(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_service_type; py_service_type = PyLong_FromUnsignedLongLong((uint32_t)object->service_type); return py_service_type; } static int py_QUERY_SERVICE_CONFIG_set_service_type(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->service_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->service_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->service_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_start_type(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_start_type; py_start_type = PyLong_FromUnsignedLongLong((uint32_t)object->start_type); return py_start_type; } static int py_QUERY_SERVICE_CONFIG_set_start_type(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->start_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->start_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->start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_error_control(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_error_control; py_error_control = PyLong_FromUnsignedLongLong((uint32_t)object->error_control); return py_error_control; } static int py_QUERY_SERVICE_CONFIG_set_error_control(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->error_control"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->error_control)); 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->error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_executablepath(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_executablepath; if (object->executablepath == NULL) { Py_RETURN_NONE; } if (object->executablepath == NULL) { py_executablepath = Py_None; Py_INCREF(py_executablepath); } else { if (object->executablepath == NULL) { py_executablepath = Py_None; Py_INCREF(py_executablepath); } else { py_executablepath = PyUnicode_Decode(object->executablepath, strlen(object->executablepath), "utf-8", "ignore"); } } return py_executablepath; } static int py_QUERY_SERVICE_CONFIG_set_executablepath(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->executablepath"); return -1; } if (value == Py_None) { object->executablepath = NULL; } else { object->executablepath = 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->executablepath = talloc_str; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_loadordergroup(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_loadordergroup; if (object->loadordergroup == NULL) { Py_RETURN_NONE; } if (object->loadordergroup == NULL) { py_loadordergroup = Py_None; Py_INCREF(py_loadordergroup); } else { if (object->loadordergroup == NULL) { py_loadordergroup = Py_None; Py_INCREF(py_loadordergroup); } else { py_loadordergroup = PyUnicode_Decode(object->loadordergroup, strlen(object->loadordergroup), "utf-8", "ignore"); } } return py_loadordergroup; } static int py_QUERY_SERVICE_CONFIG_set_loadordergroup(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->loadordergroup"); return -1; } if (value == Py_None) { object->loadordergroup = NULL; } else { object->loadordergroup = 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->loadordergroup = talloc_str; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_tag_id(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_tag_id; py_tag_id = PyLong_FromUnsignedLongLong((uint32_t)object->tag_id); return py_tag_id; } static int py_QUERY_SERVICE_CONFIG_set_tag_id(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->tag_id"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->tag_id)); 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->tag_id = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_dependencies(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_dependencies; if (object->dependencies == NULL) { Py_RETURN_NONE; } if (object->dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { if (object->dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { py_dependencies = PyUnicode_Decode(object->dependencies, strlen(object->dependencies), "utf-8", "ignore"); } } return py_dependencies; } static int py_QUERY_SERVICE_CONFIG_set_dependencies(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dependencies"); return -1; } if (value == Py_None) { object->dependencies = NULL; } else { object->dependencies = 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->dependencies = talloc_str; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_startname(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_startname; if (object->startname == NULL) { Py_RETURN_NONE; } if (object->startname == NULL) { py_startname = Py_None; Py_INCREF(py_startname); } else { if (object->startname == NULL) { py_startname = Py_None; Py_INCREF(py_startname); } else { py_startname = PyUnicode_Decode(object->startname, strlen(object->startname), "utf-8", "ignore"); } } return py_startname; } static int py_QUERY_SERVICE_CONFIG_set_startname(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->startname"); return -1; } if (value == Py_None) { object->startname = NULL; } else { object->startname = 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->startname = talloc_str; } } return 0; } static PyObject *py_QUERY_SERVICE_CONFIG_get_displayname(PyObject *obj, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(obj); PyObject *py_displayname; if (object->displayname == NULL) { Py_RETURN_NONE; } if (object->displayname == NULL) { py_displayname = Py_None; Py_INCREF(py_displayname); } else { if (object->displayname == NULL) { py_displayname = Py_None; Py_INCREF(py_displayname); } else { py_displayname = PyUnicode_Decode(object->displayname, strlen(object->displayname), "utf-8", "ignore"); } } return py_displayname; } static int py_QUERY_SERVICE_CONFIG_set_displayname(PyObject *py_obj, PyObject *value, void *closure) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->displayname"); return -1; } if (value == Py_None) { object->displayname = NULL; } else { object->displayname = 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->displayname = talloc_str; } } return 0; } static PyGetSetDef py_QUERY_SERVICE_CONFIG_getsetters[] = { { .name = discard_const_p(char, "service_type"), .get = py_QUERY_SERVICE_CONFIG_get_service_type, .set = py_QUERY_SERVICE_CONFIG_set_service_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "start_type"), .get = py_QUERY_SERVICE_CONFIG_get_start_type, .set = py_QUERY_SERVICE_CONFIG_set_start_type, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_StartType") }, { .name = discard_const_p(char, "error_control"), .get = py_QUERY_SERVICE_CONFIG_get_error_control, .set = py_QUERY_SERVICE_CONFIG_set_error_control, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ErrorControl") }, { .name = discard_const_p(char, "executablepath"), .get = py_QUERY_SERVICE_CONFIG_get_executablepath, .set = py_QUERY_SERVICE_CONFIG_set_executablepath, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "loadordergroup"), .get = py_QUERY_SERVICE_CONFIG_get_loadordergroup, .set = py_QUERY_SERVICE_CONFIG_set_loadordergroup, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "tag_id"), .get = py_QUERY_SERVICE_CONFIG_get_tag_id, .set = py_QUERY_SERVICE_CONFIG_set_tag_id, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "dependencies"), .get = py_QUERY_SERVICE_CONFIG_get_dependencies, .set = py_QUERY_SERVICE_CONFIG_set_dependencies, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "startname"), .get = py_QUERY_SERVICE_CONFIG_get_startname, .set = py_QUERY_SERVICE_CONFIG_set_startname, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "displayname"), .get = py_QUERY_SERVICE_CONFIG_get_displayname, .set = py_QUERY_SERVICE_CONFIG_set_displayname, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = NULL } }; static PyObject *py_QUERY_SERVICE_CONFIG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct QUERY_SERVICE_CONFIG, type); } static PyObject *py_QUERY_SERVICE_CONFIG_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_QUERY_SERVICE_CONFIG); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_QUERY_SERVICE_CONFIG_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_QUERY_SERVICE_CONFIG); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_QUERY_SERVICE_CONFIG); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_QUERY_SERVICE_CONFIG_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct QUERY_SERVICE_CONFIG *object = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_QUERY_SERVICE_CONFIG, "QUERY_SERVICE_CONFIG", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_QUERY_SERVICE_CONFIG_methods[] = { { "__ndr_pack__", (PyCFunction)py_QUERY_SERVICE_CONFIG_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_QUERY_SERVICE_CONFIG_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" }, { "__ndr_print__", (PyCFunction)py_QUERY_SERVICE_CONFIG_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject QUERY_SERVICE_CONFIG_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QUERY_SERVICE_CONFIG", .tp_getset = py_QUERY_SERVICE_CONFIG_getsetters, .tp_methods = py_QUERY_SERVICE_CONFIG_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_QUERY_SERVICE_CONFIG_new, }; static PyObject *py_svcctl_ArgumentString_get_string(PyObject *obj, void *closure) { struct svcctl_ArgumentString *object = (struct svcctl_ArgumentString *)pytalloc_get_ptr(obj); PyObject *py_string; if (object->string == NULL) { Py_RETURN_NONE; } if (object->string == NULL) { py_string = Py_None; Py_INCREF(py_string); } else { if (object->string == NULL) { py_string = Py_None; Py_INCREF(py_string); } else { py_string = PyUnicode_Decode(object->string, strlen(object->string), "utf-8", "ignore"); } } return py_string; } static int py_svcctl_ArgumentString_set_string(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ArgumentString *object = (struct svcctl_ArgumentString *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->string"); return -1; } if (value == Py_None) { object->string = NULL; } else { object->string = 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->string = talloc_str; } } return 0; } static PyGetSetDef py_svcctl_ArgumentString_getsetters[] = { { .name = discard_const_p(char, "string"), .get = py_svcctl_ArgumentString_get_string, .set = py_svcctl_ArgumentString_set_string, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = NULL } }; static PyObject *py_svcctl_ArgumentString_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct svcctl_ArgumentString, type); } static PyTypeObject svcctl_ArgumentString_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ArgumentString", .tp_getset = py_svcctl_ArgumentString_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_ArgumentString_new, }; static PyObject *py_SERVICE_DESCRIPTION_get_description(PyObject *obj, void *closure) { struct SERVICE_DESCRIPTION *object = (struct SERVICE_DESCRIPTION *)pytalloc_get_ptr(obj); PyObject *py_description; if (object->description == NULL) { Py_RETURN_NONE; } if (object->description == NULL) { py_description = Py_None; Py_INCREF(py_description); } else { py_description = PyString_FromStringOrNULL(object->description); } return py_description; } static int py_SERVICE_DESCRIPTION_set_description(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_DESCRIPTION *object = (struct SERVICE_DESCRIPTION *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->description"); return -1; } if (value == Py_None) { object->description = NULL; } else { object->description = 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->description = talloc_str; } } return 0; } static PyGetSetDef py_SERVICE_DESCRIPTION_getsetters[] = { { .name = discard_const_p(char, "description"), .get = py_SERVICE_DESCRIPTION_get_description, .set = py_SERVICE_DESCRIPTION_set_description, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = NULL } }; static PyObject *py_SERVICE_DESCRIPTION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct SERVICE_DESCRIPTION, type); } static PyObject *py_SERVICE_DESCRIPTION_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct SERVICE_DESCRIPTION *object = (struct SERVICE_DESCRIPTION *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_SERVICE_DESCRIPTION); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_SERVICE_DESCRIPTION_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct SERVICE_DESCRIPTION *object = (struct SERVICE_DESCRIPTION *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_SERVICE_DESCRIPTION); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_SERVICE_DESCRIPTION); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_SERVICE_DESCRIPTION_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct SERVICE_DESCRIPTION *object = (struct SERVICE_DESCRIPTION *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_SERVICE_DESCRIPTION, "SERVICE_DESCRIPTION", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_SERVICE_DESCRIPTION_methods[] = { { "__ndr_pack__", (PyCFunction)py_SERVICE_DESCRIPTION_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_SERVICE_DESCRIPTION_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" }, { "__ndr_print__", (PyCFunction)py_SERVICE_DESCRIPTION_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject SERVICE_DESCRIPTION_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SERVICE_DESCRIPTION", .tp_getset = py_SERVICE_DESCRIPTION_getsetters, .tp_methods = py_SERVICE_DESCRIPTION_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_SERVICE_DESCRIPTION_new, }; static PyObject *py_SC_ACTION_get_type(PyObject *obj, void *closure) { struct SC_ACTION *object = (struct SC_ACTION *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->type); return py_type; } static int py_SC_ACTION_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct SC_ACTION *object = (struct SC_ACTION *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->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->type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SC_ACTION_get_delay(PyObject *obj, void *closure) { struct SC_ACTION *object = (struct SC_ACTION *)pytalloc_get_ptr(obj); PyObject *py_delay; py_delay = PyLong_FromUnsignedLongLong((uint32_t)object->delay); return py_delay; } static int py_SC_ACTION_set_delay(PyObject *py_obj, PyObject *value, void *closure) { struct SC_ACTION *object = (struct SC_ACTION *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->delay"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->delay)); 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->delay = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_SC_ACTION_getsetters[] = { { .name = discard_const_p(char, "type"), .get = py_SC_ACTION_get_type, .set = py_SC_ACTION_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type SC_ACTION_TYPE") }, { .name = discard_const_p(char, "delay"), .get = py_SC_ACTION_get_delay, .set = py_SC_ACTION_set_delay, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = NULL } }; static PyObject *py_SC_ACTION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct SC_ACTION, type); } static PyTypeObject SC_ACTION_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SC_ACTION", .tp_getset = py_SC_ACTION_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_SC_ACTION_new, }; static PyObject *py_SERVICE_FAILURE_ACTIONS_get_reset_period(PyObject *obj, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(obj); PyObject *py_reset_period; py_reset_period = PyLong_FromUnsignedLongLong((uint32_t)object->reset_period); return py_reset_period; } static int py_SERVICE_FAILURE_ACTIONS_set_reset_period(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->reset_period"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->reset_period)); 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->reset_period = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_FAILURE_ACTIONS_get_rebootmsg(PyObject *obj, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(obj); PyObject *py_rebootmsg; if (object->rebootmsg == NULL) { Py_RETURN_NONE; } if (object->rebootmsg == NULL) { py_rebootmsg = Py_None; Py_INCREF(py_rebootmsg); } else { py_rebootmsg = PyString_FromStringOrNULL(object->rebootmsg); } return py_rebootmsg; } static int py_SERVICE_FAILURE_ACTIONS_set_rebootmsg(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->rebootmsg"); return -1; } if (value == Py_None) { object->rebootmsg = NULL; } else { object->rebootmsg = 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->rebootmsg = talloc_str; } } return 0; } static PyObject *py_SERVICE_FAILURE_ACTIONS_get_command(PyObject *obj, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(obj); PyObject *py_command; if (object->command == NULL) { Py_RETURN_NONE; } if (object->command == NULL) { py_command = Py_None; Py_INCREF(py_command); } else { py_command = PyString_FromStringOrNULL(object->command); } return py_command; } static int py_SERVICE_FAILURE_ACTIONS_set_command(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->command"); return -1; } if (value == Py_None) { object->command = NULL; } else { object->command = 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->command = talloc_str; } } return 0; } static PyObject *py_SERVICE_FAILURE_ACTIONS_get_num_actions(PyObject *obj, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(obj); PyObject *py_num_actions; py_num_actions = PyLong_FromUnsignedLongLong((uint32_t)object->num_actions); return py_num_actions; } static int py_SERVICE_FAILURE_ACTIONS_set_num_actions(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_actions"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_actions)); 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->num_actions = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_SERVICE_FAILURE_ACTIONS_get_actions(PyObject *obj, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(obj); PyObject *py_actions; if (object->actions == NULL) { Py_RETURN_NONE; } if (object->actions == NULL) { py_actions = Py_None; Py_INCREF(py_actions); } else { py_actions = PyList_New(object->num_actions); if (py_actions == NULL) { return NULL; } { int actions_cntr_1; for (actions_cntr_1 = 0; actions_cntr_1 < (object->num_actions); actions_cntr_1++) { PyObject *py_actions_1; py_actions_1 = pytalloc_reference_ex(&SC_ACTION_Type, object->actions, &object->actions[actions_cntr_1]); PyList_SetItem(py_actions, actions_cntr_1, py_actions_1); } } } return py_actions; } static int py_SERVICE_FAILURE_ACTIONS_set_actions(PyObject *py_obj, PyObject *value, void *closure) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->actions)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->actions"); return -1; } if (value == Py_None) { object->actions = NULL; } else { object->actions = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int actions_cntr_1; object->actions = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->actions, PyList_GET_SIZE(value)); if (!object->actions) { return -1;; } talloc_set_name_const(object->actions, "ARRAY: object->actions"); for (actions_cntr_1 = 0; actions_cntr_1 < PyList_GET_SIZE(value); actions_cntr_1++) { if (PyList_GET_ITEM(value, actions_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->actions[actions_cntr_1]"); return -1; } PY_CHECK_TYPE(&SC_ACTION_Type, PyList_GET_ITEM(value, actions_cntr_1), return -1;); if (talloc_reference(object->actions, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, actions_cntr_1))) == NULL) { PyErr_NoMemory(); return -1; } object->actions[actions_cntr_1] = *(struct SC_ACTION *)pytalloc_get_ptr(PyList_GET_ITEM(value, actions_cntr_1)); } } } return 0; } static PyGetSetDef py_SERVICE_FAILURE_ACTIONS_getsetters[] = { { .name = discard_const_p(char, "reset_period"), .get = py_SERVICE_FAILURE_ACTIONS_get_reset_period, .set = py_SERVICE_FAILURE_ACTIONS_set_reset_period, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "rebootmsg"), .get = py_SERVICE_FAILURE_ACTIONS_get_rebootmsg, .set = py_SERVICE_FAILURE_ACTIONS_set_rebootmsg, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "command"), .get = py_SERVICE_FAILURE_ACTIONS_get_command, .set = py_SERVICE_FAILURE_ACTIONS_set_command, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "num_actions"), .get = py_SERVICE_FAILURE_ACTIONS_get_num_actions, .set = py_SERVICE_FAILURE_ACTIONS_set_num_actions, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "actions"), .get = py_SERVICE_FAILURE_ACTIONS_get_actions, .set = py_SERVICE_FAILURE_ACTIONS_set_actions, .doc = discard_const_p(char, "PIDL-generated element of base type SC_ACTION") }, { .name = NULL } }; static PyObject *py_SERVICE_FAILURE_ACTIONS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct SERVICE_FAILURE_ACTIONS, type); } static PyObject *py_SERVICE_FAILURE_ACTIONS_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_SERVICE_FAILURE_ACTIONS); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_SERVICE_FAILURE_ACTIONS_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_SERVICE_FAILURE_ACTIONS); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_SERVICE_FAILURE_ACTIONS); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_SERVICE_FAILURE_ACTIONS_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct SERVICE_FAILURE_ACTIONS *object = (struct SERVICE_FAILURE_ACTIONS *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_SERVICE_FAILURE_ACTIONS, "SERVICE_FAILURE_ACTIONS", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_SERVICE_FAILURE_ACTIONS_methods[] = { { "__ndr_pack__", (PyCFunction)py_SERVICE_FAILURE_ACTIONS_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_SERVICE_FAILURE_ACTIONS_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" }, { "__ndr_print__", (PyCFunction)py_SERVICE_FAILURE_ACTIONS_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject SERVICE_FAILURE_ACTIONS_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SERVICE_FAILURE_ACTIONS", .tp_getset = py_SERVICE_FAILURE_ACTIONS_getsetters, .tp_methods = py_SERVICE_FAILURE_ACTIONS_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_SERVICE_FAILURE_ACTIONS_new, }; static PyObject *py_svcctl_CloseServiceHandle_in_get_handle(PyObject *obj, void *closure) { struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_CloseServiceHandle_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_CloseServiceHandle_out_get_handle(PyObject *obj, void *closure) { struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->out.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle); return py_handle; } static int py_svcctl_CloseServiceHandle_out_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle"); return -1; } object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle); if (object->out.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_CloseServiceHandle_get_result(PyObject *obj, void *closure) { struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_CloseServiceHandle_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)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_svcctl_CloseServiceHandle_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_CloseServiceHandle_in_get_handle, .set = py_svcctl_CloseServiceHandle_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_handle"), .get = py_svcctl_CloseServiceHandle_out_get_handle, .set = py_svcctl_CloseServiceHandle_out_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_CloseServiceHandle_get_result, .set = py_svcctl_CloseServiceHandle_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_CloseServiceHandle_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_CloseServiceHandle, type); struct svcctl_CloseServiceHandle *_self = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_CloseServiceHandle_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(0); } static PyObject *py_svcctl_CloseServiceHandle_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CloseServiceHandle_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_CloseServiceHandle_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 svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CloseServiceHandle_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_CloseServiceHandle_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_CloseServiceHandle *object = (struct svcctl_CloseServiceHandle *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CloseServiceHandle_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CloseServiceHandle_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_CloseServiceHandle_ndr_print(py_obj, "svcctl_CloseServiceHandle_in", NDR_IN); } static PyObject *py_svcctl_CloseServiceHandle_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_CloseServiceHandle_ndr_print(py_obj, "svcctl_CloseServiceHandle_out", NDR_OUT); } static PyMethodDef py_svcctl_CloseServiceHandle_methods[] = { { "opnum", (PyCFunction)py_svcctl_CloseServiceHandle_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.CloseServiceHandle.opnum() -> 0 (0x00) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_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_svcctl_CloseServiceHandle_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_CloseServiceHandle_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_CloseServiceHandle_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.CloseServiceHandle", .tp_getset = py_svcctl_CloseServiceHandle_getsetters, .tp_methods = py_svcctl_CloseServiceHandle_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_CloseServiceHandle_new, }; static bool pack_py_svcctl_CloseServiceHandle_args_in(PyObject *args, PyObject *kwargs, struct svcctl_CloseServiceHandle *r) { PyObject *py_handle; const char *kwnames[] = { "handle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:svcctl_CloseServiceHandle", discard_const_p(char *, kwnames), &py_handle)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); return true; } static PyObject *unpack_py_svcctl_CloseServiceHandle_args_out(struct svcctl_CloseServiceHandle *r) { PyObject *result; PyObject *py_handle; py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle); result = py_handle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_ControlService_in_get_handle(PyObject *obj, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_ControlService_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_ControlService_in_get_control(PyObject *obj, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(obj); PyObject *py_control; py_control = PyLong_FromUnsignedLongLong((uint32_t)object->in.control); return py_control; } static int py_svcctl_ControlService_in_set_control(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.control"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.control)); 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.control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ControlService_out_get_service_status(PyObject *obj, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(obj); PyObject *py_service_status; if (object->out.service_status == NULL) { Py_RETURN_NONE; } py_service_status = pytalloc_reference_ex(&SERVICE_STATUS_Type, object->out.service_status, object->out.service_status); return py_service_status; } static int py_svcctl_ControlService_out_set_service_status(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.service_status)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service_status"); return -1; } object->out.service_status = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service_status); if (object->out.service_status == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&SERVICE_STATUS_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.service_status = (struct SERVICE_STATUS *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_ControlService_get_result(PyObject *obj, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_ControlService_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ControlService *object = (struct svcctl_ControlService *)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_svcctl_ControlService_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_ControlService_in_get_handle, .set = py_svcctl_ControlService_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_control"), .get = py_svcctl_ControlService_in_get_control, .set = py_svcctl_ControlService_in_set_control, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_CONTROL") }, { .name = discard_const_p(char, "out_service_status"), .get = py_svcctl_ControlService_out_get_service_status, .set = py_svcctl_ControlService_out_set_service_status, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_STATUS") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_ControlService_get_result, .set = py_svcctl_ControlService_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_ControlService_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_ControlService, type); struct svcctl_ControlService *_self = (struct svcctl_ControlService *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS); return self; } static PyObject *py_svcctl_ControlService_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(1); } static PyObject *py_svcctl_ControlService_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 2) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ControlService_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ControlService_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_svcctl_ControlService_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_ControlService_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_svcctl_ControlService_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_ControlService_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 svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 2) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ControlService_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ControlService_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_svcctl_ControlService_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ControlService_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_svcctl_ControlService_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ControlService_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ControlService *object = (struct svcctl_ControlService *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 2) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ControlService_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ControlService_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ControlService_ndr_print(py_obj, "svcctl_ControlService_in", NDR_IN); } static PyObject *py_svcctl_ControlService_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ControlService_ndr_print(py_obj, "svcctl_ControlService_out", NDR_OUT); } static PyMethodDef py_svcctl_ControlService_methods[] = { { "opnum", (PyCFunction)py_svcctl_ControlService_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.ControlService.opnum() -> 1 (0x01) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_ControlService_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_svcctl_ControlService_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_svcctl_ControlService_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_svcctl_ControlService_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_svcctl_ControlService_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_ControlService_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_ControlService_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ControlService", .tp_getset = py_svcctl_ControlService_getsetters, .tp_methods = py_svcctl_ControlService_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_ControlService_new, }; static bool pack_py_svcctl_ControlService_args_in(PyObject *args, PyObject *kwargs, struct svcctl_ControlService *r) { PyObject *py_handle; PyObject *py_control; const char *kwnames[] = { "handle", "control", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:svcctl_ControlService", discard_const_p(char *, kwnames), &py_handle, &py_control)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_control == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.control"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.control)); if (PyLong_Check(py_control)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_control); 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.control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_ControlService_args_out(struct svcctl_ControlService *r) { PyObject *result; PyObject *py_service_status; py_service_status = pytalloc_reference_ex(&SERVICE_STATUS_Type, r->out.service_status, r->out.service_status); result = py_service_status; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_DeleteService_in_get_handle(PyObject *obj, void *closure) { struct svcctl_DeleteService *object = (struct svcctl_DeleteService *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_DeleteService_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_DeleteService *object = (struct svcctl_DeleteService *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_DeleteService_get_result(PyObject *obj, void *closure) { struct svcctl_DeleteService *object = (struct svcctl_DeleteService *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_DeleteService_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_DeleteService *object = (struct svcctl_DeleteService *)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_svcctl_DeleteService_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_DeleteService_in_get_handle, .set = py_svcctl_DeleteService_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_DeleteService_get_result, .set = py_svcctl_DeleteService_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_DeleteService_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_DeleteService, type); struct svcctl_DeleteService *_self = (struct svcctl_DeleteService *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_DeleteService_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(2); } static PyObject *py_svcctl_DeleteService_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_DeleteService *object = (struct svcctl_DeleteService *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_DeleteService_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_DeleteService_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_svcctl_DeleteService_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_DeleteService_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_svcctl_DeleteService_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_DeleteService_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 svcctl_DeleteService *object = (struct svcctl_DeleteService *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_DeleteService_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_DeleteService_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_svcctl_DeleteService_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_DeleteService_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_svcctl_DeleteService_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_DeleteService_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_DeleteService *object = (struct svcctl_DeleteService *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 3) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_DeleteService_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_DeleteService_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_DeleteService_ndr_print(py_obj, "svcctl_DeleteService_in", NDR_IN); } static PyObject *py_svcctl_DeleteService_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_DeleteService_ndr_print(py_obj, "svcctl_DeleteService_out", NDR_OUT); } static PyMethodDef py_svcctl_DeleteService_methods[] = { { "opnum", (PyCFunction)py_svcctl_DeleteService_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.DeleteService.opnum() -> 2 (0x02) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_DeleteService_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_svcctl_DeleteService_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_svcctl_DeleteService_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_svcctl_DeleteService_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_svcctl_DeleteService_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_DeleteService_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_DeleteService_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.DeleteService", .tp_getset = py_svcctl_DeleteService_getsetters, .tp_methods = py_svcctl_DeleteService_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_DeleteService_new, }; static bool pack_py_svcctl_DeleteService_args_in(PyObject *args, PyObject *kwargs, struct svcctl_DeleteService *r) { PyObject *py_handle; const char *kwnames[] = { "handle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:svcctl_DeleteService", discard_const_p(char *, kwnames), &py_handle)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); return true; } static PyObject *unpack_py_svcctl_DeleteService_args_out(struct svcctl_DeleteService *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_svcctl_LockServiceDatabase_in_get_handle(PyObject *obj, void *closure) { struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_LockServiceDatabase_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_LockServiceDatabase_out_get_lock(PyObject *obj, void *closure) { struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(obj); PyObject *py_lock; if (object->out.lock == NULL) { Py_RETURN_NONE; } py_lock = pytalloc_reference_ex(policy_handle_Type, object->out.lock, object->out.lock); return py_lock; } static int py_svcctl_LockServiceDatabase_out_set_lock(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.lock)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.lock"); return -1; } object->out.lock = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.lock); if (object->out.lock == 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.lock = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_LockServiceDatabase_get_result(PyObject *obj, void *closure) { struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_LockServiceDatabase_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)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_svcctl_LockServiceDatabase_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_LockServiceDatabase_in_get_handle, .set = py_svcctl_LockServiceDatabase_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_lock"), .get = py_svcctl_LockServiceDatabase_out_get_lock, .set = py_svcctl_LockServiceDatabase_out_set_lock, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_LockServiceDatabase_get_result, .set = py_svcctl_LockServiceDatabase_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_LockServiceDatabase_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_LockServiceDatabase, type); struct svcctl_LockServiceDatabase *_self = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.lock = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_LockServiceDatabase_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(3); } static PyObject *py_svcctl_LockServiceDatabase_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 4) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_LockServiceDatabase_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_LockServiceDatabase_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 svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 4) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_LockServiceDatabase_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_LockServiceDatabase_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_LockServiceDatabase *object = (struct svcctl_LockServiceDatabase *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 4) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_LockServiceDatabase_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_LockServiceDatabase_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_LockServiceDatabase_ndr_print(py_obj, "svcctl_LockServiceDatabase_in", NDR_IN); } static PyObject *py_svcctl_LockServiceDatabase_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_LockServiceDatabase_ndr_print(py_obj, "svcctl_LockServiceDatabase_out", NDR_OUT); } static PyMethodDef py_svcctl_LockServiceDatabase_methods[] = { { "opnum", (PyCFunction)py_svcctl_LockServiceDatabase_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.LockServiceDatabase.opnum() -> 3 (0x03) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_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_svcctl_LockServiceDatabase_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_LockServiceDatabase_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_LockServiceDatabase_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.LockServiceDatabase", .tp_getset = py_svcctl_LockServiceDatabase_getsetters, .tp_methods = py_svcctl_LockServiceDatabase_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_LockServiceDatabase_new, }; static bool pack_py_svcctl_LockServiceDatabase_args_in(PyObject *args, PyObject *kwargs, struct svcctl_LockServiceDatabase *r) { PyObject *py_handle; const char *kwnames[] = { "handle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:svcctl_LockServiceDatabase", discard_const_p(char *, kwnames), &py_handle)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); return true; } static PyObject *unpack_py_svcctl_LockServiceDatabase_args_out(struct svcctl_LockServiceDatabase *r) { PyObject *result; PyObject *py_lock; py_lock = pytalloc_reference_ex(policy_handle_Type, r->out.lock, r->out.lock); result = py_lock; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_QueryServiceObjectSecurity_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceObjectSecurity_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceObjectSecurity_in_get_security_flags(PyObject *obj, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_security_flags; py_security_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.security_flags); return py_security_flags; } static int py_svcctl_QueryServiceObjectSecurity_in_set_security_flags(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.security_flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.security_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.security_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceObjectSecurity_out_get_buffer(PyObject *obj, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_buffer; if (object->out.buffer == NULL) { Py_RETURN_NONE; } py_buffer = PyList_New(object->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (object->in.offered); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } return py_buffer; } static int py_svcctl_QueryServiceObjectSecurity_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer"); return -1; } object->out.buffer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer); if (object->out.buffer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int buffer_cntr_1; object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value)); if (!object->out.buffer) { return -1;; } talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer"); for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) { if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.buffer[buffer_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_QueryServiceObjectSecurity_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceObjectSecurity_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceObjectSecurity_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceObjectSecurity_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceObjectSecurity_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceObjectSecurity_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)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_svcctl_QueryServiceObjectSecurity_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceObjectSecurity_in_get_handle, .set = py_svcctl_QueryServiceObjectSecurity_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_security_flags"), .get = py_svcctl_QueryServiceObjectSecurity_in_get_security_flags, .set = py_svcctl_QueryServiceObjectSecurity_in_set_security_flags, .doc = discard_const_p(char, "PIDL-generated element of base type security_secinfo") }, { .name = discard_const_p(char, "out_buffer"), .get = py_svcctl_QueryServiceObjectSecurity_out_get_buffer, .set = py_svcctl_QueryServiceObjectSecurity_out_set_buffer, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceObjectSecurity_in_get_offered, .set = py_svcctl_QueryServiceObjectSecurity_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceObjectSecurity_out_get_needed, .set = py_svcctl_QueryServiceObjectSecurity_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceObjectSecurity_get_result, .set = py_svcctl_QueryServiceObjectSecurity_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceObjectSecurity_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceObjectSecurity, type); struct svcctl_QueryServiceObjectSecurity *_self = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.buffer = talloc_zero(mem_ctx, uint8_t); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceObjectSecurity_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(4); } static PyObject *py_svcctl_QueryServiceObjectSecurity_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceObjectSecurity_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceObjectSecurity_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 svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceObjectSecurity_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceObjectSecurity_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceObjectSecurity *object = (struct svcctl_QueryServiceObjectSecurity *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 5) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceObjectSecurity_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceObjectSecurity_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceObjectSecurity_ndr_print(py_obj, "svcctl_QueryServiceObjectSecurity_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceObjectSecurity_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceObjectSecurity_ndr_print(py_obj, "svcctl_QueryServiceObjectSecurity_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceObjectSecurity_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceObjectSecurity_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceObjectSecurity.opnum() -> 4 (0x04) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_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_svcctl_QueryServiceObjectSecurity_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceObjectSecurity_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceObjectSecurity_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceObjectSecurity", .tp_getset = py_svcctl_QueryServiceObjectSecurity_getsetters, .tp_methods = py_svcctl_QueryServiceObjectSecurity_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceObjectSecurity_new, }; static bool pack_py_svcctl_QueryServiceObjectSecurity_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceObjectSecurity *r) { PyObject *py_handle; PyObject *py_security_flags; PyObject *py_offered; const char *kwnames[] = { "handle", "security_flags", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_QueryServiceObjectSecurity", discard_const_p(char *, kwnames), &py_handle, &py_security_flags, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_security_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.security_flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.security_flags)); if (PyLong_Check(py_security_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_security_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.security_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceObjectSecurity_args_out(struct svcctl_QueryServiceObjectSecurity *r) { PyObject *result; PyObject *py_buffer; PyObject *py_needed; result = PyTuple_New(2); py_buffer = PyList_New(r->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (r->in.offered); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } PyTuple_SetItem(result, 0, py_buffer); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_SetServiceObjectSecurity_in_get_handle(PyObject *obj, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_SetServiceObjectSecurity_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_SetServiceObjectSecurity_in_get_security_flags(PyObject *obj, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_security_flags; py_security_flags = PyLong_FromUnsignedLongLong((uint32_t)object->in.security_flags); return py_security_flags; } static int py_svcctl_SetServiceObjectSecurity_in_set_security_flags(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.security_flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.security_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.security_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SetServiceObjectSecurity_in_get_buffer(PyObject *obj, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_buffer; if (object->in.buffer == NULL) { Py_RETURN_NONE; } py_buffer = PyList_New(object->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (object->in.offered); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)object->in.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } return py_buffer; } static int py_svcctl_SetServiceObjectSecurity_in_set_buffer(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.buffer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer"); return -1; } object->in.buffer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer); if (object->in.buffer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int buffer_cntr_1; object->in.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.buffer, PyList_GET_SIZE(value)); if (!object->in.buffer) { return -1;; } talloc_set_name_const(object->in.buffer, "ARRAY: object->in.buffer"); for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) { if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.buffer[buffer_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.buffer[buffer_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.buffer[buffer_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_SetServiceObjectSecurity_in_get_offered(PyObject *obj, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_SetServiceObjectSecurity_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SetServiceObjectSecurity_get_result(PyObject *obj, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_SetServiceObjectSecurity_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)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_svcctl_SetServiceObjectSecurity_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_SetServiceObjectSecurity_in_get_handle, .set = py_svcctl_SetServiceObjectSecurity_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_security_flags"), .get = py_svcctl_SetServiceObjectSecurity_in_get_security_flags, .set = py_svcctl_SetServiceObjectSecurity_in_set_security_flags, .doc = discard_const_p(char, "PIDL-generated element of base type security_secinfo") }, { .name = discard_const_p(char, "in_buffer"), .get = py_svcctl_SetServiceObjectSecurity_in_get_buffer, .set = py_svcctl_SetServiceObjectSecurity_in_set_buffer, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_SetServiceObjectSecurity_in_get_offered, .set = py_svcctl_SetServiceObjectSecurity_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_SetServiceObjectSecurity_get_result, .set = py_svcctl_SetServiceObjectSecurity_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_SetServiceObjectSecurity_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_SetServiceObjectSecurity, type); struct svcctl_SetServiceObjectSecurity *_self = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->in.buffer = talloc_zero(mem_ctx, uint8_t); return self; } static PyObject *py_svcctl_SetServiceObjectSecurity_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(5); } static PyObject *py_svcctl_SetServiceObjectSecurity_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SetServiceObjectSecurity_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_SetServiceObjectSecurity_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 svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SetServiceObjectSecurity_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_SetServiceObjectSecurity_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_SetServiceObjectSecurity *object = (struct svcctl_SetServiceObjectSecurity *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 6) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SetServiceObjectSecurity_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SetServiceObjectSecurity_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_SetServiceObjectSecurity_ndr_print(py_obj, "svcctl_SetServiceObjectSecurity_in", NDR_IN); } static PyObject *py_svcctl_SetServiceObjectSecurity_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_SetServiceObjectSecurity_ndr_print(py_obj, "svcctl_SetServiceObjectSecurity_out", NDR_OUT); } static PyMethodDef py_svcctl_SetServiceObjectSecurity_methods[] = { { "opnum", (PyCFunction)py_svcctl_SetServiceObjectSecurity_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.SetServiceObjectSecurity.opnum() -> 5 (0x05) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_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_svcctl_SetServiceObjectSecurity_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_SetServiceObjectSecurity_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_SetServiceObjectSecurity_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SetServiceObjectSecurity", .tp_getset = py_svcctl_SetServiceObjectSecurity_getsetters, .tp_methods = py_svcctl_SetServiceObjectSecurity_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_SetServiceObjectSecurity_new, }; static bool pack_py_svcctl_SetServiceObjectSecurity_args_in(PyObject *args, PyObject *kwargs, struct svcctl_SetServiceObjectSecurity *r) { PyObject *py_handle; PyObject *py_security_flags; PyObject *py_buffer; const char *kwnames[] = { "handle", "security_flags", "buffer", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_SetServiceObjectSecurity", discard_const_p(char *, kwnames), &py_handle, &py_security_flags, &py_buffer)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_security_flags == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.security_flags"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.security_flags)); if (PyLong_Check(py_security_flags)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_security_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.security_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_buffer == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.buffer"); return false; } r->in.buffer = talloc_ptrtype(r, r->in.buffer); if (r->in.buffer == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;); { int buffer_cntr_1; r->in.buffer = talloc_array_ptrtype(r, r->in.buffer, PyList_GET_SIZE(py_buffer)); if (!r->in.buffer) { return false;; } talloc_set_name_const(r->in.buffer, "ARRAY: r->in.buffer"); for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(py_buffer); buffer_cntr_1++) { if (PyList_GET_ITEM(py_buffer, buffer_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.buffer[buffer_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.buffer[buffer_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_buffer, buffer_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_buffer, buffer_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.buffer[buffer_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } PY_CHECK_TYPE(&PyList_Type, py_buffer, return false;); r->in.offered = PyList_GET_SIZE(py_buffer); return true; } static PyObject *unpack_py_svcctl_SetServiceObjectSecurity_args_out(struct svcctl_SetServiceObjectSecurity *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_svcctl_QueryServiceStatus_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceStatus_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceStatus_out_get_service_status(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(obj); PyObject *py_service_status; if (object->out.service_status == NULL) { Py_RETURN_NONE; } py_service_status = pytalloc_reference_ex(&SERVICE_STATUS_Type, object->out.service_status, object->out.service_status); return py_service_status; } static int py_svcctl_QueryServiceStatus_out_set_service_status(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.service_status)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service_status"); return -1; } object->out.service_status = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service_status); if (object->out.service_status == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&SERVICE_STATUS_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.service_status = (struct SERVICE_STATUS *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceStatus_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceStatus_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)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_svcctl_QueryServiceStatus_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceStatus_in_get_handle, .set = py_svcctl_QueryServiceStatus_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_service_status"), .get = py_svcctl_QueryServiceStatus_out_get_service_status, .set = py_svcctl_QueryServiceStatus_out_set_service_status, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_STATUS") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceStatus_get_result, .set = py_svcctl_QueryServiceStatus_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceStatus_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceStatus, type); struct svcctl_QueryServiceStatus *_self = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS); return self; } static PyObject *py_svcctl_QueryServiceStatus_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(6); } static PyObject *py_svcctl_QueryServiceStatus_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceStatus_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceStatus_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 svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceStatus_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceStatus_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceStatus *object = (struct svcctl_QueryServiceStatus *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 7) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceStatus_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceStatus_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceStatus_ndr_print(py_obj, "svcctl_QueryServiceStatus_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceStatus_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceStatus_ndr_print(py_obj, "svcctl_QueryServiceStatus_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceStatus_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceStatus_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceStatus.opnum() -> 6 (0x06) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_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_svcctl_QueryServiceStatus_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceStatus_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceStatus_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceStatus", .tp_getset = py_svcctl_QueryServiceStatus_getsetters, .tp_methods = py_svcctl_QueryServiceStatus_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceStatus_new, }; static bool pack_py_svcctl_QueryServiceStatus_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceStatus *r) { PyObject *py_handle; const char *kwnames[] = { "handle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:svcctl_QueryServiceStatus", discard_const_p(char *, kwnames), &py_handle)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); return true; } static PyObject *unpack_py_svcctl_QueryServiceStatus_args_out(struct svcctl_QueryServiceStatus *r) { PyObject *result; PyObject *py_service_status; py_service_status = pytalloc_reference_ex(&SERVICE_STATUS_Type, r->out.service_status, r->out.service_status); result = py_service_status; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_UnlockServiceDatabase_in_get_lock(PyObject *obj, void *closure) { struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(obj); PyObject *py_lock; if (object->in.lock == NULL) { Py_RETURN_NONE; } py_lock = pytalloc_reference_ex(policy_handle_Type, object->in.lock, object->in.lock); return py_lock; } static int py_svcctl_UnlockServiceDatabase_in_set_lock(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.lock)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.lock"); return -1; } object->in.lock = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.lock); if (object->in.lock == 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.lock = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_UnlockServiceDatabase_out_get_lock(PyObject *obj, void *closure) { struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(obj); PyObject *py_lock; if (object->out.lock == NULL) { Py_RETURN_NONE; } py_lock = pytalloc_reference_ex(policy_handle_Type, object->out.lock, object->out.lock); return py_lock; } static int py_svcctl_UnlockServiceDatabase_out_set_lock(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.lock)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.lock"); return -1; } object->out.lock = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.lock); if (object->out.lock == 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.lock = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_UnlockServiceDatabase_get_result(PyObject *obj, void *closure) { struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_UnlockServiceDatabase_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)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_svcctl_UnlockServiceDatabase_getsetters[] = { { .name = discard_const_p(char, "in_lock"), .get = py_svcctl_UnlockServiceDatabase_in_get_lock, .set = py_svcctl_UnlockServiceDatabase_in_set_lock, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_lock"), .get = py_svcctl_UnlockServiceDatabase_out_get_lock, .set = py_svcctl_UnlockServiceDatabase_out_set_lock, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_UnlockServiceDatabase_get_result, .set = py_svcctl_UnlockServiceDatabase_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_UnlockServiceDatabase_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_UnlockServiceDatabase, type); struct svcctl_UnlockServiceDatabase *_self = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.lock = talloc_zero(mem_ctx, struct policy_handle); _self->out.lock = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_UnlockServiceDatabase_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(8); } static PyObject *py_svcctl_UnlockServiceDatabase_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_UnlockServiceDatabase_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_UnlockServiceDatabase_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 svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_UnlockServiceDatabase_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_UnlockServiceDatabase_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_UnlockServiceDatabase *object = (struct svcctl_UnlockServiceDatabase *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 9) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_UnlockServiceDatabase_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_UnlockServiceDatabase_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_UnlockServiceDatabase_ndr_print(py_obj, "svcctl_UnlockServiceDatabase_in", NDR_IN); } static PyObject *py_svcctl_UnlockServiceDatabase_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_UnlockServiceDatabase_ndr_print(py_obj, "svcctl_UnlockServiceDatabase_out", NDR_OUT); } static PyMethodDef py_svcctl_UnlockServiceDatabase_methods[] = { { "opnum", (PyCFunction)py_svcctl_UnlockServiceDatabase_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.UnlockServiceDatabase.opnum() -> 8 (0x08) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_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_svcctl_UnlockServiceDatabase_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_UnlockServiceDatabase_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_UnlockServiceDatabase_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.UnlockServiceDatabase", .tp_getset = py_svcctl_UnlockServiceDatabase_getsetters, .tp_methods = py_svcctl_UnlockServiceDatabase_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_UnlockServiceDatabase_new, }; static bool pack_py_svcctl_UnlockServiceDatabase_args_in(PyObject *args, PyObject *kwargs, struct svcctl_UnlockServiceDatabase *r) { PyObject *py_lock; const char *kwnames[] = { "lock", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:svcctl_UnlockServiceDatabase", discard_const_p(char *, kwnames), &py_lock)) { return false; } if (py_lock == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.lock"); return false; } r->in.lock = talloc_ptrtype(r, r->in.lock); if (r->in.lock == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_lock, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_lock)) == NULL) { PyErr_NoMemory(); return false; } r->in.lock = (struct policy_handle *)pytalloc_get_ptr(py_lock); return true; } static PyObject *unpack_py_svcctl_UnlockServiceDatabase_args_out(struct svcctl_UnlockServiceDatabase *r) { PyObject *result; PyObject *py_lock; py_lock = pytalloc_reference_ex(policy_handle_Type, r->out.lock, r->out.lock); result = py_lock; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_SCSetServiceBitsW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_SCSetServiceBitsW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_SCSetServiceBitsW_in_get_bits(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(obj); PyObject *py_bits; py_bits = PyLong_FromUnsignedLongLong((uint32_t)object->in.bits); return py_bits; } static int py_svcctl_SCSetServiceBitsW_in_set_bits(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.bits"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.bits)); 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.bits = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SCSetServiceBitsW_in_get_bitson(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(obj); PyObject *py_bitson; py_bitson = PyLong_FromUnsignedLongLong((uint32_t)object->in.bitson); return py_bitson; } static int py_svcctl_SCSetServiceBitsW_in_set_bitson(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.bitson"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.bitson)); 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.bitson = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SCSetServiceBitsW_in_get_immediate(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(obj); PyObject *py_immediate; py_immediate = PyLong_FromUnsignedLongLong((uint32_t)object->in.immediate); return py_immediate; } static int py_svcctl_SCSetServiceBitsW_in_set_immediate(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.immediate"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.immediate)); 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.immediate = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SCSetServiceBitsW_get_result(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_SCSetServiceBitsW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)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_svcctl_SCSetServiceBitsW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_SCSetServiceBitsW_in_get_handle, .set = py_svcctl_SCSetServiceBitsW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_bits"), .get = py_svcctl_SCSetServiceBitsW_in_get_bits, .set = py_svcctl_SCSetServiceBitsW_in_set_bits, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_bitson"), .get = py_svcctl_SCSetServiceBitsW_in_get_bitson, .set = py_svcctl_SCSetServiceBitsW_in_set_bitson, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_immediate"), .get = py_svcctl_SCSetServiceBitsW_in_get_immediate, .set = py_svcctl_SCSetServiceBitsW_in_set_immediate, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_SCSetServiceBitsW_get_result, .set = py_svcctl_SCSetServiceBitsW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_SCSetServiceBitsW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_SCSetServiceBitsW, type); struct svcctl_SCSetServiceBitsW *_self = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_SCSetServiceBitsW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(10); } static PyObject *py_svcctl_SCSetServiceBitsW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SCSetServiceBitsW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_SCSetServiceBitsW_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 svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SCSetServiceBitsW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_SCSetServiceBitsW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_SCSetServiceBitsW *object = (struct svcctl_SCSetServiceBitsW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 11) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SCSetServiceBitsW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SCSetServiceBitsW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_SCSetServiceBitsW_ndr_print(py_obj, "svcctl_SCSetServiceBitsW_in", NDR_IN); } static PyObject *py_svcctl_SCSetServiceBitsW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_SCSetServiceBitsW_ndr_print(py_obj, "svcctl_SCSetServiceBitsW_out", NDR_OUT); } static PyMethodDef py_svcctl_SCSetServiceBitsW_methods[] = { { "opnum", (PyCFunction)py_svcctl_SCSetServiceBitsW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.SCSetServiceBitsW.opnum() -> 10 (0x0a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_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_svcctl_SCSetServiceBitsW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_SCSetServiceBitsW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_SCSetServiceBitsW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SCSetServiceBitsW", .tp_getset = py_svcctl_SCSetServiceBitsW_getsetters, .tp_methods = py_svcctl_SCSetServiceBitsW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_SCSetServiceBitsW_new, }; static bool pack_py_svcctl_SCSetServiceBitsW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_SCSetServiceBitsW *r) { PyObject *py_handle; PyObject *py_bits; PyObject *py_bitson; PyObject *py_immediate; const char *kwnames[] = { "handle", "bits", "bitson", "immediate", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:svcctl_SCSetServiceBitsW", discard_const_p(char *, kwnames), &py_handle, &py_bits, &py_bitson, &py_immediate)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_bits == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.bits"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.bits)); if (PyLong_Check(py_bits)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_bits); 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.bits = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_bitson == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.bitson"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.bitson)); if (PyLong_Check(py_bitson)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_bitson); 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.bitson = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_immediate == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.immediate"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.immediate)); if (PyLong_Check(py_immediate)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_immediate); 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.immediate = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_SCSetServiceBitsW_args_out(struct svcctl_SCSetServiceBitsW *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_svcctl_ChangeServiceConfigW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_ChangeServiceConfigW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_type(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_svcctl_ChangeServiceConfigW_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)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_svcctl_ChangeServiceConfigW_in_get_start_type(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_start_type; py_start_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.start_type); return py_start_type; } static int py_svcctl_ChangeServiceConfigW_in_set_start_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.start_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_error_control(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_error_control; py_error_control = PyLong_FromUnsignedLongLong((uint32_t)object->in.error_control); return py_error_control; } static int py_svcctl_ChangeServiceConfigW_in_set_error_control(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.error_control"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.error_control)); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_binary_path(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_binary_path; if (object->in.binary_path == NULL) { Py_RETURN_NONE; } if (object->in.binary_path == NULL) { py_binary_path = Py_None; Py_INCREF(py_binary_path); } else { if (object->in.binary_path == NULL) { py_binary_path = Py_None; Py_INCREF(py_binary_path); } else { py_binary_path = PyUnicode_Decode(object->in.binary_path, strlen(object->in.binary_path), "utf-8", "ignore"); } } return py_binary_path; } static int py_svcctl_ChangeServiceConfigW_in_set_binary_path(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.binary_path"); return -1; } if (value == Py_None) { object->in.binary_path = NULL; } else { object->in.binary_path = 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.binary_path = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_load_order_group(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_load_order_group; if (object->in.load_order_group == NULL) { Py_RETURN_NONE; } if (object->in.load_order_group == NULL) { py_load_order_group = Py_None; Py_INCREF(py_load_order_group); } else { if (object->in.load_order_group == NULL) { py_load_order_group = Py_None; Py_INCREF(py_load_order_group); } else { py_load_order_group = PyUnicode_Decode(object->in.load_order_group, strlen(object->in.load_order_group), "utf-8", "ignore"); } } return py_load_order_group; } static int py_svcctl_ChangeServiceConfigW_in_set_load_order_group(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.load_order_group"); return -1; } if (value == Py_None) { object->in.load_order_group = NULL; } else { object->in.load_order_group = 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.load_order_group = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_tag_id(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_tag_id; if (object->in.tag_id == NULL) { Py_RETURN_NONE; } if (object->in.tag_id == NULL) { py_tag_id = Py_None; Py_INCREF(py_tag_id); } else { py_tag_id = PyLong_FromUnsignedLongLong((uint32_t)*object->in.tag_id); } return py_tag_id; } static int py_svcctl_ChangeServiceConfigW_in_set_tag_id(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.tag_id)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.tag_id"); return -1; } if (value == Py_None) { object->in.tag_id = NULL; } else { object->in.tag_id = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.tag_id); if (object->in.tag_id == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.tag_id)); 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.tag_id = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_out_get_tag_id(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_tag_id; if (object->out.tag_id == NULL) { Py_RETURN_NONE; } if (object->out.tag_id == NULL) { py_tag_id = Py_None; Py_INCREF(py_tag_id); } else { py_tag_id = PyLong_FromUnsignedLongLong((uint32_t)*object->out.tag_id); } return py_tag_id; } static int py_svcctl_ChangeServiceConfigW_out_set_tag_id(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.tag_id)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.tag_id"); return -1; } if (value == Py_None) { object->out.tag_id = NULL; } else { object->out.tag_id = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.tag_id); if (object->out.tag_id == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.tag_id)); 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.tag_id = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_dependencies(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_dependencies; if (object->in.dependencies == NULL) { Py_RETURN_NONE; } if (object->in.dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { if (object->in.dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { py_dependencies = PyUnicode_Decode(object->in.dependencies, strlen(object->in.dependencies), "utf-8", "ignore"); } } return py_dependencies; } static int py_svcctl_ChangeServiceConfigW_in_set_dependencies(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dependencies"); return -1; } if (value == Py_None) { object->in.dependencies = NULL; } else { object->in.dependencies = 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.dependencies = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_dwDependSize(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_dwDependSize; py_dwDependSize = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwDependSize); return py_dwDependSize; } static int py_svcctl_ChangeServiceConfigW_in_set_dwDependSize(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwDependSize"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwDependSize)); 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.dwDependSize = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_service_start_name(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_service_start_name; if (object->in.service_start_name == NULL) { Py_RETURN_NONE; } if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { py_service_start_name = PyUnicode_Decode(object->in.service_start_name, strlen(object->in.service_start_name), "utf-8", "ignore"); } } return py_service_start_name; } static int py_svcctl_ChangeServiceConfigW_in_set_service_start_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_start_name"); return -1; } if (value == Py_None) { object->in.service_start_name = NULL; } else { object->in.service_start_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.service_start_name = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_password(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_password; if (object->in.password == NULL) { Py_RETURN_NONE; } if (object->in.password == NULL) { py_password = Py_None; Py_INCREF(py_password); } else { if (object->in.password == NULL) { py_password = Py_None; Py_INCREF(py_password); } else { py_password = PyUnicode_Decode(object->in.password, strlen(object->in.password), "utf-8", "ignore"); } } return py_password; } static int py_svcctl_ChangeServiceConfigW_in_set_password(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.password"); return -1; } if (value == Py_None) { object->in.password = NULL; } else { object->in.password = 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.password = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_dwPwSize(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_dwPwSize; py_dwPwSize = PyLong_FromUnsignedLongLong((uint32_t)object->in.dwPwSize); return py_dwPwSize; } static int py_svcctl_ChangeServiceConfigW_in_set_dwPwSize(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dwPwSize"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dwPwSize)); 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.dwPwSize = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_in_get_display_name(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_display_name; if (object->in.display_name == NULL) { Py_RETURN_NONE; } if (object->in.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { if (object->in.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyUnicode_Decode(object->in.display_name, strlen(object->in.display_name), "utf-8", "ignore"); } } return py_display_name; } static int py_svcctl_ChangeServiceConfigW_in_set_display_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.display_name"); return -1; } if (value == Py_None) { object->in.display_name = NULL; } else { object->in.display_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.display_name = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigW_get_result(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_ChangeServiceConfigW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)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_svcctl_ChangeServiceConfigW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_ChangeServiceConfigW_in_get_handle, .set = py_svcctl_ChangeServiceConfigW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_type"), .get = py_svcctl_ChangeServiceConfigW_in_get_type, .set = py_svcctl_ChangeServiceConfigW_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_start_type"), .get = py_svcctl_ChangeServiceConfigW_in_get_start_type, .set = py_svcctl_ChangeServiceConfigW_in_set_start_type, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_StartType") }, { .name = discard_const_p(char, "in_error_control"), .get = py_svcctl_ChangeServiceConfigW_in_get_error_control, .set = py_svcctl_ChangeServiceConfigW_in_set_error_control, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ErrorControl") }, { .name = discard_const_p(char, "in_binary_path"), .get = py_svcctl_ChangeServiceConfigW_in_get_binary_path, .set = py_svcctl_ChangeServiceConfigW_in_set_binary_path, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_load_order_group"), .get = py_svcctl_ChangeServiceConfigW_in_get_load_order_group, .set = py_svcctl_ChangeServiceConfigW_in_set_load_order_group, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_tag_id"), .get = py_svcctl_ChangeServiceConfigW_in_get_tag_id, .set = py_svcctl_ChangeServiceConfigW_in_set_tag_id, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_tag_id"), .get = py_svcctl_ChangeServiceConfigW_out_get_tag_id, .set = py_svcctl_ChangeServiceConfigW_out_set_tag_id, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_dependencies"), .get = py_svcctl_ChangeServiceConfigW_in_get_dependencies, .set = py_svcctl_ChangeServiceConfigW_in_set_dependencies, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_dwDependSize"), .get = py_svcctl_ChangeServiceConfigW_in_get_dwDependSize, .set = py_svcctl_ChangeServiceConfigW_in_set_dwDependSize, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_service_start_name"), .get = py_svcctl_ChangeServiceConfigW_in_get_service_start_name, .set = py_svcctl_ChangeServiceConfigW_in_set_service_start_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_password"), .get = py_svcctl_ChangeServiceConfigW_in_get_password, .set = py_svcctl_ChangeServiceConfigW_in_set_password, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_dwPwSize"), .get = py_svcctl_ChangeServiceConfigW_in_get_dwPwSize, .set = py_svcctl_ChangeServiceConfigW_in_set_dwPwSize, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_display_name"), .get = py_svcctl_ChangeServiceConfigW_in_get_display_name, .set = py_svcctl_ChangeServiceConfigW_in_set_display_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_ChangeServiceConfigW_get_result, .set = py_svcctl_ChangeServiceConfigW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_ChangeServiceConfigW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_ChangeServiceConfigW, type); struct svcctl_ChangeServiceConfigW *_self = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_ChangeServiceConfigW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(11); } static PyObject *py_svcctl_ChangeServiceConfigW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfigW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfigW_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 svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfigW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfigW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfigW *object = (struct svcctl_ChangeServiceConfigW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 12) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfigW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfigW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfigW_ndr_print(py_obj, "svcctl_ChangeServiceConfigW_in", NDR_IN); } static PyObject *py_svcctl_ChangeServiceConfigW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfigW_ndr_print(py_obj, "svcctl_ChangeServiceConfigW_out", NDR_OUT); } static PyMethodDef py_svcctl_ChangeServiceConfigW_methods[] = { { "opnum", (PyCFunction)py_svcctl_ChangeServiceConfigW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.ChangeServiceConfigW.opnum() -> 11 (0x0b) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_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_svcctl_ChangeServiceConfigW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_ChangeServiceConfigW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_ChangeServiceConfigW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ChangeServiceConfigW", .tp_getset = py_svcctl_ChangeServiceConfigW_getsetters, .tp_methods = py_svcctl_ChangeServiceConfigW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_ChangeServiceConfigW_new, }; static bool pack_py_svcctl_ChangeServiceConfigW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_ChangeServiceConfigW *r) { PyObject *py_handle; PyObject *py_type; PyObject *py_start_type; PyObject *py_error_control; PyObject *py_binary_path; PyObject *py_load_order_group; PyObject *py_tag_id; PyObject *py_dependencies; PyObject *py_service_start_name; PyObject *py_password; PyObject *py_display_name; const char *kwnames[] = { "handle", "type", "start_type", "error_control", "binary_path", "load_order_group", "tag_id", "dependencies", "service_start_name", "password", "display_name", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOOOOOO:svcctl_ChangeServiceConfigW", discard_const_p(char *, kwnames), &py_handle, &py_type, &py_start_type, &py_error_control, &py_binary_path, &py_load_order_group, &py_tag_id, &py_dependencies, &py_service_start_name, &py_password, &py_display_name)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); 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_start_type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.start_type"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.start_type)); if (PyLong_Check(py_start_type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_error_control == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.error_control"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.error_control)); if (PyLong_Check(py_error_control)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_error_control); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_binary_path == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.binary_path"); return false; } if (py_binary_path == Py_None) { r->in.binary_path = NULL; } else { r->in.binary_path = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_binary_path)) { unicode = PyUnicode_AsEncodedString(py_binary_path, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_binary_path)) { test_str = PyBytes_AS_STRING(py_binary_path); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_binary_path)->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.binary_path = talloc_str; } } if (py_load_order_group == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.load_order_group"); return false; } if (py_load_order_group == Py_None) { r->in.load_order_group = NULL; } else { r->in.load_order_group = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_load_order_group)) { unicode = PyUnicode_AsEncodedString(py_load_order_group, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_load_order_group)) { test_str = PyBytes_AS_STRING(py_load_order_group); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_load_order_group)->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.load_order_group = talloc_str; } } if (py_tag_id == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.tag_id"); return false; } if (py_tag_id == Py_None) { r->in.tag_id = NULL; } else { r->in.tag_id = talloc_ptrtype(r, r->in.tag_id); if (r->in.tag_id == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.tag_id)); if (PyLong_Check(py_tag_id)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_tag_id); 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.tag_id = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } if (py_dependencies == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dependencies"); return false; } if (py_dependencies == Py_None) { r->in.dependencies = NULL; } else { r->in.dependencies = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_dependencies)) { unicode = PyUnicode_AsEncodedString(py_dependencies, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_dependencies)) { test_str = PyBytes_AS_STRING(py_dependencies); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_dependencies)->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.dependencies = talloc_str; } } PY_CHECK_TYPE(&PyList_Type, py_dependencies, return false;); r->in.dwDependSize = PyList_GET_SIZE(py_dependencies); if (py_service_start_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_start_name"); return false; } if (py_service_start_name == Py_None) { r->in.service_start_name = NULL; } else { r->in.service_start_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_start_name)) { unicode = PyUnicode_AsEncodedString(py_service_start_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_start_name)) { test_str = PyBytes_AS_STRING(py_service_start_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_start_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.service_start_name = talloc_str; } } if (py_password == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.password"); return false; } if (py_password == Py_None) { r->in.password = NULL; } else { r->in.password = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_password)) { unicode = PyUnicode_AsEncodedString(py_password, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_password)) { test_str = PyBytes_AS_STRING(py_password); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_password)->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.password = talloc_str; } } PY_CHECK_TYPE(&PyList_Type, py_password, return false;); r->in.dwPwSize = PyList_GET_SIZE(py_password); if (py_display_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.display_name"); return false; } if (py_display_name == Py_None) { r->in.display_name = NULL; } else { r->in.display_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_display_name)) { unicode = PyUnicode_AsEncodedString(py_display_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_display_name)) { test_str = PyBytes_AS_STRING(py_display_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_display_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.display_name = talloc_str; } } return true; } static PyObject *unpack_py_svcctl_ChangeServiceConfigW_args_out(struct svcctl_ChangeServiceConfigW *r) { PyObject *result; PyObject *py_tag_id; if (r->out.tag_id == NULL) { py_tag_id = Py_None; Py_INCREF(py_tag_id); } else { py_tag_id = PyLong_FromUnsignedLongLong((uint32_t)*r->out.tag_id); } result = py_tag_id; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_CreateServiceW_in_get_scmanager_handle(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_scmanager_handle; if (object->in.scmanager_handle == NULL) { Py_RETURN_NONE; } py_scmanager_handle = pytalloc_reference_ex(policy_handle_Type, object->in.scmanager_handle, object->in.scmanager_handle); return py_scmanager_handle; } static int py_svcctl_CreateServiceW_in_set_scmanager_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.scmanager_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.scmanager_handle"); return -1; } object->in.scmanager_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.scmanager_handle); if (object->in.scmanager_handle == 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.scmanager_handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_ServiceName(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_ServiceName; if (object->in.ServiceName == NULL) { py_ServiceName = Py_None; Py_INCREF(py_ServiceName); } else { py_ServiceName = PyUnicode_Decode(object->in.ServiceName, strlen(object->in.ServiceName), "utf-8", "ignore"); } return py_ServiceName; } static int py_svcctl_CreateServiceW_in_set_ServiceName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.ServiceName"); 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.ServiceName = talloc_str; } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_DisplayName(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_DisplayName; if (object->in.DisplayName == NULL) { Py_RETURN_NONE; } if (object->in.DisplayName == NULL) { py_DisplayName = Py_None; Py_INCREF(py_DisplayName); } else { if (object->in.DisplayName == NULL) { py_DisplayName = Py_None; Py_INCREF(py_DisplayName); } else { py_DisplayName = PyUnicode_Decode(object->in.DisplayName, strlen(object->in.DisplayName), "utf-8", "ignore"); } } return py_DisplayName; } static int py_svcctl_CreateServiceW_in_set_DisplayName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.DisplayName"); return -1; } if (value == Py_None) { object->in.DisplayName = NULL; } else { object->in.DisplayName = 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.DisplayName = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_desired_access(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_desired_access; py_desired_access = PyLong_FromUnsignedLongLong((uint32_t)object->in.desired_access); return py_desired_access; } static int py_svcctl_CreateServiceW_in_set_desired_access(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.desired_access"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.desired_access)); 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.desired_access = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_type(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_svcctl_CreateServiceW_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)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_svcctl_CreateServiceW_in_get_start_type(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_start_type; py_start_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.start_type); return py_start_type; } static int py_svcctl_CreateServiceW_in_set_start_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.start_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_error_control(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_error_control; py_error_control = PyLong_FromUnsignedLongLong((uint32_t)object->in.error_control); return py_error_control; } static int py_svcctl_CreateServiceW_in_set_error_control(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.error_control"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.error_control)); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_binary_path(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_binary_path; if (object->in.binary_path == NULL) { py_binary_path = Py_None; Py_INCREF(py_binary_path); } else { py_binary_path = PyUnicode_Decode(object->in.binary_path, strlen(object->in.binary_path), "utf-8", "ignore"); } return py_binary_path; } static int py_svcctl_CreateServiceW_in_set_binary_path(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.binary_path"); 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.binary_path = talloc_str; } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_LoadOrderGroupKey(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_LoadOrderGroupKey; if (object->in.LoadOrderGroupKey == NULL) { Py_RETURN_NONE; } if (object->in.LoadOrderGroupKey == NULL) { py_LoadOrderGroupKey = Py_None; Py_INCREF(py_LoadOrderGroupKey); } else { if (object->in.LoadOrderGroupKey == NULL) { py_LoadOrderGroupKey = Py_None; Py_INCREF(py_LoadOrderGroupKey); } else { py_LoadOrderGroupKey = PyUnicode_Decode(object->in.LoadOrderGroupKey, strlen(object->in.LoadOrderGroupKey), "utf-8", "ignore"); } } return py_LoadOrderGroupKey; } static int py_svcctl_CreateServiceW_in_set_LoadOrderGroupKey(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.LoadOrderGroupKey"); return -1; } if (value == Py_None) { object->in.LoadOrderGroupKey = NULL; } else { object->in.LoadOrderGroupKey = 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.LoadOrderGroupKey = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_TagId(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_TagId; if (object->in.TagId == NULL) { Py_RETURN_NONE; } if (object->in.TagId == NULL) { py_TagId = Py_None; Py_INCREF(py_TagId); } else { py_TagId = PyLong_FromUnsignedLongLong((uint32_t)*object->in.TagId); } return py_TagId; } static int py_svcctl_CreateServiceW_in_set_TagId(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.TagId)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.TagId"); return -1; } if (value == Py_None) { object->in.TagId = NULL; } else { object->in.TagId = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.TagId); if (object->in.TagId == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.TagId)); 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.TagId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_CreateServiceW_out_get_TagId(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_TagId; if (object->out.TagId == NULL) { Py_RETURN_NONE; } if (object->out.TagId == NULL) { py_TagId = Py_None; Py_INCREF(py_TagId); } else { py_TagId = PyLong_FromUnsignedLongLong((uint32_t)*object->out.TagId); } return py_TagId; } static int py_svcctl_CreateServiceW_out_set_TagId(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.TagId)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.TagId"); return -1; } if (value == Py_None) { object->out.TagId = NULL; } else { object->out.TagId = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.TagId); if (object->out.TagId == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.TagId)); 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.TagId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_dependencies(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_dependencies; if (object->in.dependencies == NULL) { Py_RETURN_NONE; } if (object->in.dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { py_dependencies = PyList_New(object->in.dependencies_size); if (py_dependencies == NULL) { return NULL; } { int dependencies_cntr_1; for (dependencies_cntr_1 = 0; dependencies_cntr_1 < (object->in.dependencies_size); dependencies_cntr_1++) { PyObject *py_dependencies_1; py_dependencies_1 = PyLong_FromLong((uint16_t)object->in.dependencies[dependencies_cntr_1]); PyList_SetItem(py_dependencies, dependencies_cntr_1, py_dependencies_1); } } } return py_dependencies; } static int py_svcctl_CreateServiceW_in_set_dependencies(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.dependencies)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dependencies"); return -1; } if (value == Py_None) { object->in.dependencies = NULL; } else { object->in.dependencies = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int dependencies_cntr_1; object->in.dependencies = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.dependencies, PyList_GET_SIZE(value)); if (!object->in.dependencies) { return -1;; } talloc_set_name_const(object->in.dependencies, "ARRAY: object->in.dependencies"); for (dependencies_cntr_1 = 0; dependencies_cntr_1 < PyList_GET_SIZE(value); dependencies_cntr_1++) { if (PyList_GET_ITEM(value, dependencies_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dependencies[dependencies_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dependencies[dependencies_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, dependencies_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, dependencies_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.dependencies[dependencies_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_dependencies_size(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_dependencies_size; py_dependencies_size = PyLong_FromUnsignedLongLong((uint32_t)object->in.dependencies_size); return py_dependencies_size; } static int py_svcctl_CreateServiceW_in_set_dependencies_size(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dependencies_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.dependencies_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.dependencies_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_service_start_name(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_service_start_name; if (object->in.service_start_name == NULL) { Py_RETURN_NONE; } if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { py_service_start_name = PyUnicode_Decode(object->in.service_start_name, strlen(object->in.service_start_name), "utf-8", "ignore"); } } return py_service_start_name; } static int py_svcctl_CreateServiceW_in_set_service_start_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_start_name"); return -1; } if (value == Py_None) { object->in.service_start_name = NULL; } else { object->in.service_start_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.service_start_name = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_password(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_password; if (object->in.password == NULL) { Py_RETURN_NONE; } if (object->in.password == NULL) { py_password = Py_None; Py_INCREF(py_password); } else { py_password = PyList_New(object->in.password_size); if (py_password == NULL) { return NULL; } { int password_cntr_1; for (password_cntr_1 = 0; password_cntr_1 < (object->in.password_size); password_cntr_1++) { PyObject *py_password_1; py_password_1 = PyLong_FromLong((uint16_t)object->in.password[password_cntr_1]); PyList_SetItem(py_password, password_cntr_1, py_password_1); } } } return py_password; } static int py_svcctl_CreateServiceW_in_set_password(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.password)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.password"); return -1; } if (value == Py_None) { object->in.password = NULL; } else { object->in.password = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int password_cntr_1; object->in.password = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.password, PyList_GET_SIZE(value)); if (!object->in.password) { return -1;; } talloc_set_name_const(object->in.password, "ARRAY: object->in.password"); for (password_cntr_1 = 0; password_cntr_1 < PyList_GET_SIZE(value); password_cntr_1++) { if (PyList_GET_ITEM(value, password_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.password[password_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.password[password_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, password_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, password_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.password[password_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } } return 0; } static PyObject *py_svcctl_CreateServiceW_in_get_password_size(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_password_size; py_password_size = PyLong_FromUnsignedLongLong((uint32_t)object->in.password_size); return py_password_size; } static int py_svcctl_CreateServiceW_in_set_password_size(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.password_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.password_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->in.password_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceW_out_get_handle(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->out.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle); return py_handle; } static int py_svcctl_CreateServiceW_out_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle"); return -1; } object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle); if (object->out.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_CreateServiceW_get_result(PyObject *obj, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_CreateServiceW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)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_svcctl_CreateServiceW_getsetters[] = { { .name = discard_const_p(char, "in_scmanager_handle"), .get = py_svcctl_CreateServiceW_in_get_scmanager_handle, .set = py_svcctl_CreateServiceW_in_set_scmanager_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_ServiceName"), .get = py_svcctl_CreateServiceW_in_get_ServiceName, .set = py_svcctl_CreateServiceW_in_set_ServiceName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_DisplayName"), .get = py_svcctl_CreateServiceW_in_get_DisplayName, .set = py_svcctl_CreateServiceW_in_set_DisplayName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_desired_access"), .get = py_svcctl_CreateServiceW_in_get_desired_access, .set = py_svcctl_CreateServiceW_in_set_desired_access, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_type"), .get = py_svcctl_CreateServiceW_in_get_type, .set = py_svcctl_CreateServiceW_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_start_type"), .get = py_svcctl_CreateServiceW_in_get_start_type, .set = py_svcctl_CreateServiceW_in_set_start_type, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_StartType") }, { .name = discard_const_p(char, "in_error_control"), .get = py_svcctl_CreateServiceW_in_get_error_control, .set = py_svcctl_CreateServiceW_in_set_error_control, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ErrorControl") }, { .name = discard_const_p(char, "in_binary_path"), .get = py_svcctl_CreateServiceW_in_get_binary_path, .set = py_svcctl_CreateServiceW_in_set_binary_path, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_LoadOrderGroupKey"), .get = py_svcctl_CreateServiceW_in_get_LoadOrderGroupKey, .set = py_svcctl_CreateServiceW_in_set_LoadOrderGroupKey, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_TagId"), .get = py_svcctl_CreateServiceW_in_get_TagId, .set = py_svcctl_CreateServiceW_in_set_TagId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_TagId"), .get = py_svcctl_CreateServiceW_out_get_TagId, .set = py_svcctl_CreateServiceW_out_set_TagId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_dependencies"), .get = py_svcctl_CreateServiceW_in_get_dependencies, .set = py_svcctl_CreateServiceW_in_set_dependencies, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_dependencies_size"), .get = py_svcctl_CreateServiceW_in_get_dependencies_size, .set = py_svcctl_CreateServiceW_in_set_dependencies_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_service_start_name"), .get = py_svcctl_CreateServiceW_in_get_service_start_name, .set = py_svcctl_CreateServiceW_in_set_service_start_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_password"), .get = py_svcctl_CreateServiceW_in_get_password, .set = py_svcctl_CreateServiceW_in_set_password, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_password_size"), .get = py_svcctl_CreateServiceW_in_get_password_size, .set = py_svcctl_CreateServiceW_in_set_password_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_handle"), .get = py_svcctl_CreateServiceW_out_get_handle, .set = py_svcctl_CreateServiceW_out_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_CreateServiceW_get_result, .set = py_svcctl_CreateServiceW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_CreateServiceW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_CreateServiceW, type); struct svcctl_CreateServiceW *_self = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.scmanager_handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_CreateServiceW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(12); } static PyObject *py_svcctl_CreateServiceW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 13) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CreateServiceW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CreateServiceW_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_svcctl_CreateServiceW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_CreateServiceW_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_svcctl_CreateServiceW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_CreateServiceW_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 svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 13) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CreateServiceW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CreateServiceW_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_svcctl_CreateServiceW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_CreateServiceW_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_svcctl_CreateServiceW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_CreateServiceW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_CreateServiceW *object = (struct svcctl_CreateServiceW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 13) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CreateServiceW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CreateServiceW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_CreateServiceW_ndr_print(py_obj, "svcctl_CreateServiceW_in", NDR_IN); } static PyObject *py_svcctl_CreateServiceW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_CreateServiceW_ndr_print(py_obj, "svcctl_CreateServiceW_out", NDR_OUT); } static PyMethodDef py_svcctl_CreateServiceW_methods[] = { { "opnum", (PyCFunction)py_svcctl_CreateServiceW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.CreateServiceW.opnum() -> 12 (0x0c) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_CreateServiceW_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_svcctl_CreateServiceW_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_svcctl_CreateServiceW_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_svcctl_CreateServiceW_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_svcctl_CreateServiceW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_CreateServiceW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_CreateServiceW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.CreateServiceW", .tp_getset = py_svcctl_CreateServiceW_getsetters, .tp_methods = py_svcctl_CreateServiceW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_CreateServiceW_new, }; static bool pack_py_svcctl_CreateServiceW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_CreateServiceW *r) { PyObject *py_scmanager_handle; PyObject *py_ServiceName; PyObject *py_DisplayName; PyObject *py_desired_access; PyObject *py_type; PyObject *py_start_type; PyObject *py_error_control; PyObject *py_binary_path; PyObject *py_LoadOrderGroupKey; PyObject *py_TagId; PyObject *py_dependencies; PyObject *py_service_start_name; PyObject *py_password; const char *kwnames[] = { "scmanager_handle", "ServiceName", "DisplayName", "desired_access", "type", "start_type", "error_control", "binary_path", "LoadOrderGroupKey", "TagId", "dependencies", "service_start_name", "password", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOOOOOOOO:svcctl_CreateServiceW", discard_const_p(char *, kwnames), &py_scmanager_handle, &py_ServiceName, &py_DisplayName, &py_desired_access, &py_type, &py_start_type, &py_error_control, &py_binary_path, &py_LoadOrderGroupKey, &py_TagId, &py_dependencies, &py_service_start_name, &py_password)) { return false; } if (py_scmanager_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.scmanager_handle"); return false; } r->in.scmanager_handle = talloc_ptrtype(r, r->in.scmanager_handle); if (r->in.scmanager_handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_scmanager_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_scmanager_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.scmanager_handle = (struct policy_handle *)pytalloc_get_ptr(py_scmanager_handle); if (py_ServiceName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.ServiceName"); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_ServiceName)) { unicode = PyUnicode_AsEncodedString(py_ServiceName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_ServiceName)) { test_str = PyBytes_AS_STRING(py_ServiceName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_ServiceName)->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.ServiceName = talloc_str; } if (py_DisplayName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.DisplayName"); return false; } if (py_DisplayName == Py_None) { r->in.DisplayName = NULL; } else { r->in.DisplayName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_DisplayName)) { unicode = PyUnicode_AsEncodedString(py_DisplayName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_DisplayName)) { test_str = PyBytes_AS_STRING(py_DisplayName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_DisplayName)->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.DisplayName = talloc_str; } } if (py_desired_access == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.desired_access"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.desired_access)); if (PyLong_Check(py_desired_access)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_desired_access); 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.desired_access = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } 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_start_type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.start_type"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.start_type)); if (PyLong_Check(py_start_type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_error_control == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.error_control"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.error_control)); if (PyLong_Check(py_error_control)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_error_control); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_binary_path == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.binary_path"); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_binary_path)) { unicode = PyUnicode_AsEncodedString(py_binary_path, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_binary_path)) { test_str = PyBytes_AS_STRING(py_binary_path); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_binary_path)->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.binary_path = talloc_str; } if (py_LoadOrderGroupKey == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.LoadOrderGroupKey"); return false; } if (py_LoadOrderGroupKey == Py_None) { r->in.LoadOrderGroupKey = NULL; } else { r->in.LoadOrderGroupKey = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_LoadOrderGroupKey)) { unicode = PyUnicode_AsEncodedString(py_LoadOrderGroupKey, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_LoadOrderGroupKey)) { test_str = PyBytes_AS_STRING(py_LoadOrderGroupKey); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_LoadOrderGroupKey)->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.LoadOrderGroupKey = talloc_str; } } if (py_TagId == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.TagId"); return false; } if (py_TagId == Py_None) { r->in.TagId = NULL; } else { r->in.TagId = talloc_ptrtype(r, r->in.TagId); if (r->in.TagId == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.TagId)); if (PyLong_Check(py_TagId)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_TagId); 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.TagId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } if (py_dependencies == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dependencies"); return false; } if (py_dependencies == Py_None) { r->in.dependencies = NULL; } else { r->in.dependencies = NULL; PY_CHECK_TYPE(&PyList_Type, py_dependencies, return false;); { int dependencies_cntr_1; r->in.dependencies = talloc_array_ptrtype(r, r->in.dependencies, PyList_GET_SIZE(py_dependencies)); if (!r->in.dependencies) { return false;; } talloc_set_name_const(r->in.dependencies, "ARRAY: r->in.dependencies"); for (dependencies_cntr_1 = 0; dependencies_cntr_1 < PyList_GET_SIZE(py_dependencies); dependencies_cntr_1++) { if (PyList_GET_ITEM(py_dependencies, dependencies_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dependencies[dependencies_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.dependencies[dependencies_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_dependencies, dependencies_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_dependencies, dependencies_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.dependencies[dependencies_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_dependencies, return false;); r->in.dependencies_size = PyList_GET_SIZE(py_dependencies); if (py_service_start_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_start_name"); return false; } if (py_service_start_name == Py_None) { r->in.service_start_name = NULL; } else { r->in.service_start_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_start_name)) { unicode = PyUnicode_AsEncodedString(py_service_start_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_start_name)) { test_str = PyBytes_AS_STRING(py_service_start_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_start_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.service_start_name = talloc_str; } } if (py_password == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.password"); return false; } if (py_password == Py_None) { r->in.password = NULL; } else { r->in.password = NULL; PY_CHECK_TYPE(&PyList_Type, py_password, return false;); { int password_cntr_1; r->in.password = talloc_array_ptrtype(r, r->in.password, PyList_GET_SIZE(py_password)); if (!r->in.password) { return false;; } talloc_set_name_const(r->in.password, "ARRAY: r->in.password"); for (password_cntr_1 = 0; password_cntr_1 < PyList_GET_SIZE(py_password); password_cntr_1++) { if (PyList_GET_ITEM(py_password, password_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.password[password_cntr_1]"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.password[password_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(py_password, password_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_password, password_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.password[password_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } } } PY_CHECK_TYPE(&PyList_Type, py_password, return false;); r->in.password_size = PyList_GET_SIZE(py_password); return true; } static PyObject *unpack_py_svcctl_CreateServiceW_args_out(struct svcctl_CreateServiceW *r) { PyObject *result; PyObject *py_TagId; PyObject *py_handle; result = PyTuple_New(2); if (r->out.TagId == NULL) { py_TagId = Py_None; Py_INCREF(py_TagId); } else { py_TagId = PyLong_FromUnsignedLongLong((uint32_t)*r->out.TagId); } PyTuple_SetItem(result, 0, py_TagId); py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle); PyTuple_SetItem(result, 1, py_handle); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_EnumDependentServicesW_in_get_service(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(obj); PyObject *py_service; if (object->in.service == NULL) { Py_RETURN_NONE; } py_service = pytalloc_reference_ex(policy_handle_Type, object->in.service, object->in.service); return py_service; } static int py_svcctl_EnumDependentServicesW_in_set_service(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.service)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service"); return -1; } object->in.service = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.service); if (object->in.service == 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.service = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_EnumDependentServicesW_in_get_state(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(obj); PyObject *py_state; py_state = PyLong_FromUnsignedLongLong((uint32_t)object->in.state); return py_state; } static int py_svcctl_EnumDependentServicesW_in_set_state(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.state"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.state)); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesW_out_get_service_status(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(obj); PyObject *py_service_status; if (object->out.service_status == NULL) { Py_RETURN_NONE; } py_service_status = PyList_New(object->in.offered); if (py_service_status == NULL) { return NULL; } { int service_status_cntr_1; for (service_status_cntr_1 = 0; service_status_cntr_1 < (object->in.offered); service_status_cntr_1++) { PyObject *py_service_status_1; py_service_status_1 = PyLong_FromLong((uint16_t)object->out.service_status[service_status_cntr_1]); PyList_SetItem(py_service_status, service_status_cntr_1, py_service_status_1); } } return py_service_status; } static int py_svcctl_EnumDependentServicesW_out_set_service_status(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.service_status)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service_status"); return -1; } object->out.service_status = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service_status); if (object->out.service_status == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int service_status_cntr_1; object->out.service_status = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service_status, PyList_GET_SIZE(value)); if (!object->out.service_status) { return -1;; } talloc_set_name_const(object->out.service_status, "ARRAY: object->out.service_status"); for (service_status_cntr_1 = 0; service_status_cntr_1 < PyList_GET_SIZE(value); service_status_cntr_1++) { if (PyList_GET_ITEM(value, service_status_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service_status[service_status_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.service_status[service_status_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, service_status_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, service_status_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.service_status[service_status_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_EnumDependentServicesW_in_get_offered(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_EnumDependentServicesW_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesW_out_get_needed(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_EnumDependentServicesW_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesW_out_get_services_returned(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(obj); PyObject *py_services_returned; if (object->out.services_returned == NULL) { Py_RETURN_NONE; } py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.services_returned); return py_services_returned; } static int py_svcctl_EnumDependentServicesW_out_set_services_returned(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.services_returned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services_returned"); return -1; } object->out.services_returned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.services_returned); if (object->out.services_returned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.services_returned)); 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.services_returned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesW_get_result(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_EnumDependentServicesW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)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_svcctl_EnumDependentServicesW_getsetters[] = { { .name = discard_const_p(char, "in_service"), .get = py_svcctl_EnumDependentServicesW_in_get_service, .set = py_svcctl_EnumDependentServicesW_in_set_service, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_state"), .get = py_svcctl_EnumDependentServicesW_in_get_state, .set = py_svcctl_EnumDependentServicesW_in_set_state, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceState") }, { .name = discard_const_p(char, "out_service_status"), .get = py_svcctl_EnumDependentServicesW_out_get_service_status, .set = py_svcctl_EnumDependentServicesW_out_set_service_status, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_EnumDependentServicesW_in_get_offered, .set = py_svcctl_EnumDependentServicesW_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_EnumDependentServicesW_out_get_needed, .set = py_svcctl_EnumDependentServicesW_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_services_returned"), .get = py_svcctl_EnumDependentServicesW_out_get_services_returned, .set = py_svcctl_EnumDependentServicesW_out_set_services_returned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_EnumDependentServicesW_get_result, .set = py_svcctl_EnumDependentServicesW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_EnumDependentServicesW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_EnumDependentServicesW, type); struct svcctl_EnumDependentServicesW *_self = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.service = talloc_zero(mem_ctx, struct policy_handle); _self->out.service_status = talloc_zero(mem_ctx, uint8_t); _self->out.needed = talloc_zero(mem_ctx, uint32_t); _self->out.services_returned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_EnumDependentServicesW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(13); } static PyObject *py_svcctl_EnumDependentServicesW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumDependentServicesW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_EnumDependentServicesW_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 svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumDependentServicesW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumDependentServicesW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumDependentServicesW *object = (struct svcctl_EnumDependentServicesW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 14) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumDependentServicesW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumDependentServicesW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumDependentServicesW_ndr_print(py_obj, "svcctl_EnumDependentServicesW_in", NDR_IN); } static PyObject *py_svcctl_EnumDependentServicesW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumDependentServicesW_ndr_print(py_obj, "svcctl_EnumDependentServicesW_out", NDR_OUT); } static PyMethodDef py_svcctl_EnumDependentServicesW_methods[] = { { "opnum", (PyCFunction)py_svcctl_EnumDependentServicesW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.EnumDependentServicesW.opnum() -> 13 (0x0d) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_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_svcctl_EnumDependentServicesW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_EnumDependentServicesW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_EnumDependentServicesW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.EnumDependentServicesW", .tp_getset = py_svcctl_EnumDependentServicesW_getsetters, .tp_methods = py_svcctl_EnumDependentServicesW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_EnumDependentServicesW_new, }; static bool pack_py_svcctl_EnumDependentServicesW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_EnumDependentServicesW *r) { PyObject *py_service; PyObject *py_state; PyObject *py_offered; const char *kwnames[] = { "service", "state", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_EnumDependentServicesW", discard_const_p(char *, kwnames), &py_service, &py_state, &py_offered)) { return false; } if (py_service == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service"); return false; } r->in.service = talloc_ptrtype(r, r->in.service); if (r->in.service == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_service, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_service)) == NULL) { PyErr_NoMemory(); return false; } r->in.service = (struct policy_handle *)pytalloc_get_ptr(py_service); if (py_state == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.state"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.state)); if (PyLong_Check(py_state)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_state); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_EnumDependentServicesW_args_out(struct svcctl_EnumDependentServicesW *r) { PyObject *result; PyObject *py_service_status; PyObject *py_needed; PyObject *py_services_returned; result = PyTuple_New(3); py_service_status = PyList_New(r->in.offered); if (py_service_status == NULL) { return NULL; } { int service_status_cntr_1; for (service_status_cntr_1 = 0; service_status_cntr_1 < (r->in.offered); service_status_cntr_1++) { PyObject *py_service_status_1; py_service_status_1 = PyLong_FromLong((uint16_t)r->out.service_status[service_status_cntr_1]); PyList_SetItem(py_service_status, service_status_cntr_1, py_service_status_1); } } PyTuple_SetItem(result, 0, py_service_status); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.services_returned); PyTuple_SetItem(result, 2, py_services_returned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_EnumServicesStatusW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_EnumServicesStatusW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_EnumServicesStatusW_in_get_type(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_svcctl_EnumServicesStatusW_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)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_svcctl_EnumServicesStatusW_in_get_state(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_state; py_state = PyLong_FromUnsignedLongLong((uint32_t)object->in.state); return py_state; } static int py_svcctl_EnumServicesStatusW_in_set_state(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.state"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.state)); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusW_out_get_service(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_service; if (object->out.service == NULL) { Py_RETURN_NONE; } py_service = PyList_New(object->in.offered); if (py_service == NULL) { return NULL; } { int service_cntr_1; for (service_cntr_1 = 0; service_cntr_1 < (object->in.offered); service_cntr_1++) { PyObject *py_service_1; py_service_1 = PyLong_FromLong((uint16_t)object->out.service[service_cntr_1]); PyList_SetItem(py_service, service_cntr_1, py_service_1); } } return py_service; } static int py_svcctl_EnumServicesStatusW_out_set_service(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.service)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service"); return -1; } object->out.service = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service); if (object->out.service == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int service_cntr_1; object->out.service = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service, PyList_GET_SIZE(value)); if (!object->out.service) { return -1;; } talloc_set_name_const(object->out.service, "ARRAY: object->out.service"); for (service_cntr_1 = 0; service_cntr_1 < PyList_GET_SIZE(value); service_cntr_1++) { if (PyList_GET_ITEM(value, service_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service[service_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.service[service_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, service_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, service_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.service[service_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_EnumServicesStatusW_in_get_offered(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_EnumServicesStatusW_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusW_out_get_needed(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_EnumServicesStatusW_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusW_out_get_services_returned(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_services_returned; if (object->out.services_returned == NULL) { Py_RETURN_NONE; } py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.services_returned); return py_services_returned; } static int py_svcctl_EnumServicesStatusW_out_set_services_returned(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.services_returned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services_returned"); return -1; } object->out.services_returned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.services_returned); if (object->out.services_returned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.services_returned)); 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.services_returned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusW_in_get_resume_handle(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->in.resume_handle == NULL) { Py_RETURN_NONE; } if (object->in.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->in.resume_handle); } return py_resume_handle; } static int py_svcctl_EnumServicesStatusW_in_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.resume_handle"); return -1; } if (value == Py_None) { object->in.resume_handle = NULL; } else { object->in.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.resume_handle); if (object->in.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_EnumServicesStatusW_out_get_resume_handle(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->out.resume_handle == NULL) { Py_RETURN_NONE; } if (object->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->out.resume_handle); } return py_resume_handle; } static int py_svcctl_EnumServicesStatusW_out_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.resume_handle"); return -1; } if (value == Py_None) { object->out.resume_handle = NULL; } else { object->out.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.resume_handle); if (object->out.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_EnumServicesStatusW_get_result(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_EnumServicesStatusW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)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_svcctl_EnumServicesStatusW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_EnumServicesStatusW_in_get_handle, .set = py_svcctl_EnumServicesStatusW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_type"), .get = py_svcctl_EnumServicesStatusW_in_get_type, .set = py_svcctl_EnumServicesStatusW_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_state"), .get = py_svcctl_EnumServicesStatusW_in_get_state, .set = py_svcctl_EnumServicesStatusW_in_set_state, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceState") }, { .name = discard_const_p(char, "out_service"), .get = py_svcctl_EnumServicesStatusW_out_get_service, .set = py_svcctl_EnumServicesStatusW_out_set_service, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_EnumServicesStatusW_in_get_offered, .set = py_svcctl_EnumServicesStatusW_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_EnumServicesStatusW_out_get_needed, .set = py_svcctl_EnumServicesStatusW_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_services_returned"), .get = py_svcctl_EnumServicesStatusW_out_get_services_returned, .set = py_svcctl_EnumServicesStatusW_out_set_services_returned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_resume_handle"), .get = py_svcctl_EnumServicesStatusW_in_get_resume_handle, .set = py_svcctl_EnumServicesStatusW_in_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_resume_handle"), .get = py_svcctl_EnumServicesStatusW_out_get_resume_handle, .set = py_svcctl_EnumServicesStatusW_out_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_EnumServicesStatusW_get_result, .set = py_svcctl_EnumServicesStatusW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_EnumServicesStatusW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_EnumServicesStatusW, type); struct svcctl_EnumServicesStatusW *_self = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.service = talloc_zero(mem_ctx, uint8_t); _self->out.needed = talloc_zero(mem_ctx, uint32_t); _self->out.services_returned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_EnumServicesStatusW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(14); } static PyObject *py_svcctl_EnumServicesStatusW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 15) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumServicesStatusW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_EnumServicesStatusW_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 svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 15) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumServicesStatusW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumServicesStatusW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumServicesStatusW *object = (struct svcctl_EnumServicesStatusW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 15) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumServicesStatusW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumServicesStatusW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumServicesStatusW_ndr_print(py_obj, "svcctl_EnumServicesStatusW_in", NDR_IN); } static PyObject *py_svcctl_EnumServicesStatusW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumServicesStatusW_ndr_print(py_obj, "svcctl_EnumServicesStatusW_out", NDR_OUT); } static PyMethodDef py_svcctl_EnumServicesStatusW_methods[] = { { "opnum", (PyCFunction)py_svcctl_EnumServicesStatusW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.EnumServicesStatusW.opnum() -> 14 (0x0e) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_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_svcctl_EnumServicesStatusW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_EnumServicesStatusW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_EnumServicesStatusW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.EnumServicesStatusW", .tp_getset = py_svcctl_EnumServicesStatusW_getsetters, .tp_methods = py_svcctl_EnumServicesStatusW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_EnumServicesStatusW_new, }; static bool pack_py_svcctl_EnumServicesStatusW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_EnumServicesStatusW *r) { PyObject *py_handle; PyObject *py_type; PyObject *py_state; PyObject *py_offered; PyObject *py_resume_handle; const char *kwnames[] = { "handle", "type", "state", "offered", "resume_handle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:svcctl_EnumServicesStatusW", discard_const_p(char *, kwnames), &py_handle, &py_type, &py_state, &py_offered, &py_resume_handle)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); 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_state == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.state"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.state)); if (PyLong_Check(py_state)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_state); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_resume_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.resume_handle"); return false; } if (py_resume_handle == Py_None) { r->in.resume_handle = NULL; } else { r->in.resume_handle = talloc_ptrtype(r, r->in.resume_handle); if (r->in.resume_handle == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.resume_handle)); if (PyLong_Check(py_resume_handle)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_resume_handle); 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.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_EnumServicesStatusW_args_out(struct svcctl_EnumServicesStatusW *r) { PyObject *result; PyObject *py_service; PyObject *py_needed; PyObject *py_services_returned; PyObject *py_resume_handle; result = PyTuple_New(4); py_service = PyList_New(r->in.offered); if (py_service == NULL) { return NULL; } { int service_cntr_1; for (service_cntr_1 = 0; service_cntr_1 < (r->in.offered); service_cntr_1++) { PyObject *py_service_1; py_service_1 = PyLong_FromLong((uint16_t)r->out.service[service_cntr_1]); PyList_SetItem(py_service, service_cntr_1, py_service_1); } } PyTuple_SetItem(result, 0, py_service); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.services_returned); PyTuple_SetItem(result, 2, py_services_returned); if (r->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*r->out.resume_handle); } PyTuple_SetItem(result, 3, py_resume_handle); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_OpenSCManagerW_in_get_MachineName(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(obj); PyObject *py_MachineName; if (object->in.MachineName == NULL) { Py_RETURN_NONE; } if (object->in.MachineName == NULL) { py_MachineName = Py_None; Py_INCREF(py_MachineName); } else { if (object->in.MachineName == NULL) { py_MachineName = Py_None; Py_INCREF(py_MachineName); } else { py_MachineName = PyUnicode_Decode(object->in.MachineName, strlen(object->in.MachineName), "utf-8", "ignore"); } } return py_MachineName; } static int py_svcctl_OpenSCManagerW_in_set_MachineName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.MachineName"); return -1; } if (value == Py_None) { object->in.MachineName = NULL; } else { object->in.MachineName = 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.MachineName = talloc_str; } } return 0; } static PyObject *py_svcctl_OpenSCManagerW_in_get_DatabaseName(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(obj); PyObject *py_DatabaseName; if (object->in.DatabaseName == NULL) { Py_RETURN_NONE; } if (object->in.DatabaseName == NULL) { py_DatabaseName = Py_None; Py_INCREF(py_DatabaseName); } else { if (object->in.DatabaseName == NULL) { py_DatabaseName = Py_None; Py_INCREF(py_DatabaseName); } else { py_DatabaseName = PyUnicode_Decode(object->in.DatabaseName, strlen(object->in.DatabaseName), "utf-8", "ignore"); } } return py_DatabaseName; } static int py_svcctl_OpenSCManagerW_in_set_DatabaseName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.DatabaseName"); return -1; } if (value == Py_None) { object->in.DatabaseName = NULL; } else { object->in.DatabaseName = 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.DatabaseName = talloc_str; } } return 0; } static PyObject *py_svcctl_OpenSCManagerW_in_get_access_mask(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(obj); PyObject *py_access_mask; py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask); return py_access_mask; } static int py_svcctl_OpenSCManagerW_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask)); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_OpenSCManagerW_out_get_handle(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->out.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle); return py_handle; } static int py_svcctl_OpenSCManagerW_out_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle"); return -1; } object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle); if (object->out.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_OpenSCManagerW_get_result(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_OpenSCManagerW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)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_svcctl_OpenSCManagerW_getsetters[] = { { .name = discard_const_p(char, "in_MachineName"), .get = py_svcctl_OpenSCManagerW_in_get_MachineName, .set = py_svcctl_OpenSCManagerW_in_set_MachineName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_DatabaseName"), .get = py_svcctl_OpenSCManagerW_in_get_DatabaseName, .set = py_svcctl_OpenSCManagerW_in_set_DatabaseName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_access_mask"), .get = py_svcctl_OpenSCManagerW_in_get_access_mask, .set = py_svcctl_OpenSCManagerW_in_set_access_mask, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_MgrAccessMask") }, { .name = discard_const_p(char, "out_handle"), .get = py_svcctl_OpenSCManagerW_out_get_handle, .set = py_svcctl_OpenSCManagerW_out_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_OpenSCManagerW_get_result, .set = py_svcctl_OpenSCManagerW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_OpenSCManagerW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_OpenSCManagerW, type); struct svcctl_OpenSCManagerW *_self = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_OpenSCManagerW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(15); } static PyObject *py_svcctl_OpenSCManagerW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 16) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenSCManagerW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_OpenSCManagerW_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 svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 16) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenSCManagerW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenSCManagerW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenSCManagerW *object = (struct svcctl_OpenSCManagerW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 16) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenSCManagerW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenSCManagerW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenSCManagerW_ndr_print(py_obj, "svcctl_OpenSCManagerW_in", NDR_IN); } static PyObject *py_svcctl_OpenSCManagerW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenSCManagerW_ndr_print(py_obj, "svcctl_OpenSCManagerW_out", NDR_OUT); } static PyMethodDef py_svcctl_OpenSCManagerW_methods[] = { { "opnum", (PyCFunction)py_svcctl_OpenSCManagerW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.OpenSCManagerW.opnum() -> 15 (0x0f) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_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_svcctl_OpenSCManagerW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_OpenSCManagerW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_OpenSCManagerW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.OpenSCManagerW", .tp_getset = py_svcctl_OpenSCManagerW_getsetters, .tp_methods = py_svcctl_OpenSCManagerW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_OpenSCManagerW_new, }; static bool pack_py_svcctl_OpenSCManagerW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_OpenSCManagerW *r) { PyObject *py_MachineName; PyObject *py_DatabaseName; PyObject *py_access_mask; const char *kwnames[] = { "MachineName", "DatabaseName", "access_mask", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_OpenSCManagerW", discard_const_p(char *, kwnames), &py_MachineName, &py_DatabaseName, &py_access_mask)) { return false; } if (py_MachineName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.MachineName"); return false; } if (py_MachineName == Py_None) { r->in.MachineName = NULL; } else { r->in.MachineName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_MachineName)) { unicode = PyUnicode_AsEncodedString(py_MachineName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_MachineName)) { test_str = PyBytes_AS_STRING(py_MachineName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_MachineName)->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.MachineName = talloc_str; } } if (py_DatabaseName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.DatabaseName"); return false; } if (py_DatabaseName == Py_None) { r->in.DatabaseName = NULL; } else { r->in.DatabaseName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_DatabaseName)) { unicode = PyUnicode_AsEncodedString(py_DatabaseName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_DatabaseName)) { test_str = PyBytes_AS_STRING(py_DatabaseName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_DatabaseName)->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.DatabaseName = talloc_str; } } if (py_access_mask == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask)); if (PyLong_Check(py_access_mask)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_access_mask); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_OpenSCManagerW_args_out(struct svcctl_OpenSCManagerW *r) { PyObject *result; PyObject *py_handle; py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle); result = py_handle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_OpenServiceW_in_get_scmanager_handle(PyObject *obj, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(obj); PyObject *py_scmanager_handle; if (object->in.scmanager_handle == NULL) { Py_RETURN_NONE; } py_scmanager_handle = pytalloc_reference_ex(policy_handle_Type, object->in.scmanager_handle, object->in.scmanager_handle); return py_scmanager_handle; } static int py_svcctl_OpenServiceW_in_set_scmanager_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.scmanager_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.scmanager_handle"); return -1; } object->in.scmanager_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.scmanager_handle); if (object->in.scmanager_handle == 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.scmanager_handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_OpenServiceW_in_get_ServiceName(PyObject *obj, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(obj); PyObject *py_ServiceName; if (object->in.ServiceName == NULL) { py_ServiceName = Py_None; Py_INCREF(py_ServiceName); } else { py_ServiceName = PyUnicode_Decode(object->in.ServiceName, strlen(object->in.ServiceName), "utf-8", "ignore"); } return py_ServiceName; } static int py_svcctl_OpenServiceW_in_set_ServiceName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.ServiceName"); 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.ServiceName = talloc_str; } return 0; } static PyObject *py_svcctl_OpenServiceW_in_get_access_mask(PyObject *obj, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(obj); PyObject *py_access_mask; py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask); return py_access_mask; } static int py_svcctl_OpenServiceW_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask)); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_OpenServiceW_out_get_handle(PyObject *obj, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->out.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle); return py_handle; } static int py_svcctl_OpenServiceW_out_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle"); return -1; } object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle); if (object->out.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_OpenServiceW_get_result(PyObject *obj, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_OpenServiceW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)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_svcctl_OpenServiceW_getsetters[] = { { .name = discard_const_p(char, "in_scmanager_handle"), .get = py_svcctl_OpenServiceW_in_get_scmanager_handle, .set = py_svcctl_OpenServiceW_in_set_scmanager_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_ServiceName"), .get = py_svcctl_OpenServiceW_in_get_ServiceName, .set = py_svcctl_OpenServiceW_in_set_ServiceName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_access_mask"), .get = py_svcctl_OpenServiceW_in_get_access_mask, .set = py_svcctl_OpenServiceW_in_set_access_mask, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceAccessMask") }, { .name = discard_const_p(char, "out_handle"), .get = py_svcctl_OpenServiceW_out_get_handle, .set = py_svcctl_OpenServiceW_out_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_OpenServiceW_get_result, .set = py_svcctl_OpenServiceW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_OpenServiceW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_OpenServiceW, type); struct svcctl_OpenServiceW *_self = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.scmanager_handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_OpenServiceW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(16); } static PyObject *py_svcctl_OpenServiceW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 17) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenServiceW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenServiceW_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_svcctl_OpenServiceW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_OpenServiceW_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_svcctl_OpenServiceW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_OpenServiceW_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 svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 17) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenServiceW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenServiceW_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_svcctl_OpenServiceW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenServiceW_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_svcctl_OpenServiceW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenServiceW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenServiceW *object = (struct svcctl_OpenServiceW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 17) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenServiceW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenServiceW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenServiceW_ndr_print(py_obj, "svcctl_OpenServiceW_in", NDR_IN); } static PyObject *py_svcctl_OpenServiceW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenServiceW_ndr_print(py_obj, "svcctl_OpenServiceW_out", NDR_OUT); } static PyMethodDef py_svcctl_OpenServiceW_methods[] = { { "opnum", (PyCFunction)py_svcctl_OpenServiceW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.OpenServiceW.opnum() -> 16 (0x10) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_OpenServiceW_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_svcctl_OpenServiceW_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_svcctl_OpenServiceW_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_svcctl_OpenServiceW_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_svcctl_OpenServiceW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_OpenServiceW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_OpenServiceW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.OpenServiceW", .tp_getset = py_svcctl_OpenServiceW_getsetters, .tp_methods = py_svcctl_OpenServiceW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_OpenServiceW_new, }; static bool pack_py_svcctl_OpenServiceW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_OpenServiceW *r) { PyObject *py_scmanager_handle; PyObject *py_ServiceName; PyObject *py_access_mask; const char *kwnames[] = { "scmanager_handle", "ServiceName", "access_mask", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_OpenServiceW", discard_const_p(char *, kwnames), &py_scmanager_handle, &py_ServiceName, &py_access_mask)) { return false; } if (py_scmanager_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.scmanager_handle"); return false; } r->in.scmanager_handle = talloc_ptrtype(r, r->in.scmanager_handle); if (r->in.scmanager_handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_scmanager_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_scmanager_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.scmanager_handle = (struct policy_handle *)pytalloc_get_ptr(py_scmanager_handle); if (py_ServiceName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.ServiceName"); return false; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_ServiceName)) { unicode = PyUnicode_AsEncodedString(py_ServiceName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_ServiceName)) { test_str = PyBytes_AS_STRING(py_ServiceName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_ServiceName)->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.ServiceName = talloc_str; } if (py_access_mask == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask)); if (PyLong_Check(py_access_mask)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_access_mask); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_OpenServiceW_args_out(struct svcctl_OpenServiceW *r) { PyObject *result; PyObject *py_handle; py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle); result = py_handle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_QueryServiceConfigW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceConfigW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceConfigW_out_get_query(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_query; if (object->out.query == NULL) { Py_RETURN_NONE; } py_query = pytalloc_reference_ex(&QUERY_SERVICE_CONFIG_Type, object->out.query, object->out.query); return py_query; } static int py_svcctl_QueryServiceConfigW_out_set_query(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.query)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.query"); return -1; } object->out.query = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.query); if (object->out.query == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&QUERY_SERVICE_CONFIG_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.query = (struct QUERY_SERVICE_CONFIG *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceConfigW_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceConfigW_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfigW_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceConfigW_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfigW_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceConfigW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)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_svcctl_QueryServiceConfigW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceConfigW_in_get_handle, .set = py_svcctl_QueryServiceConfigW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_query"), .get = py_svcctl_QueryServiceConfigW_out_get_query, .set = py_svcctl_QueryServiceConfigW_out_set_query, .doc = discard_const_p(char, "PIDL-generated element of base type QUERY_SERVICE_CONFIG") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceConfigW_in_get_offered, .set = py_svcctl_QueryServiceConfigW_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceConfigW_out_get_needed, .set = py_svcctl_QueryServiceConfigW_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceConfigW_get_result, .set = py_svcctl_QueryServiceConfigW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceConfigW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceConfigW, type); struct svcctl_QueryServiceConfigW *_self = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.query = talloc_zero(mem_ctx, struct QUERY_SERVICE_CONFIG); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceConfigW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(17); } static PyObject *py_svcctl_QueryServiceConfigW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 18) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfigW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfigW_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 svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 18) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfigW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfigW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfigW *object = (struct svcctl_QueryServiceConfigW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 18) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfigW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfigW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfigW_ndr_print(py_obj, "svcctl_QueryServiceConfigW_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceConfigW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfigW_ndr_print(py_obj, "svcctl_QueryServiceConfigW_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceConfigW_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceConfigW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceConfigW.opnum() -> 17 (0x11) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_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_svcctl_QueryServiceConfigW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceConfigW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceConfigW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceConfigW", .tp_getset = py_svcctl_QueryServiceConfigW_getsetters, .tp_methods = py_svcctl_QueryServiceConfigW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceConfigW_new, }; static bool pack_py_svcctl_QueryServiceConfigW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceConfigW *r) { PyObject *py_handle; PyObject *py_offered; const char *kwnames[] = { "handle", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:svcctl_QueryServiceConfigW", discard_const_p(char *, kwnames), &py_handle, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceConfigW_args_out(struct svcctl_QueryServiceConfigW *r) { PyObject *result; PyObject *py_query; PyObject *py_needed; result = PyTuple_New(2); py_query = pytalloc_reference_ex(&QUERY_SERVICE_CONFIG_Type, r->out.query, r->out.query); PyTuple_SetItem(result, 0, py_query); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_QueryServiceLockStatusW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceLockStatusW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceLockStatusW_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceLockStatusW_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceLockStatusW_out_get_lock_status(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(obj); PyObject *py_lock_status; if (object->out.lock_status == NULL) { Py_RETURN_NONE; } py_lock_status = pytalloc_reference_ex(&SERVICE_LOCK_STATUS_Type, object->out.lock_status, object->out.lock_status); return py_lock_status; } static int py_svcctl_QueryServiceLockStatusW_out_set_lock_status(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.lock_status)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.lock_status"); return -1; } object->out.lock_status = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.lock_status); if (object->out.lock_status == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&SERVICE_LOCK_STATUS_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.lock_status = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceLockStatusW_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceLockStatusW_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceLockStatusW_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceLockStatusW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)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_svcctl_QueryServiceLockStatusW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceLockStatusW_in_get_handle, .set = py_svcctl_QueryServiceLockStatusW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceLockStatusW_in_get_offered, .set = py_svcctl_QueryServiceLockStatusW_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_lock_status"), .get = py_svcctl_QueryServiceLockStatusW_out_get_lock_status, .set = py_svcctl_QueryServiceLockStatusW_out_set_lock_status, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_LOCK_STATUS") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceLockStatusW_out_get_needed, .set = py_svcctl_QueryServiceLockStatusW_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceLockStatusW_get_result, .set = py_svcctl_QueryServiceLockStatusW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceLockStatusW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceLockStatusW, type); struct svcctl_QueryServiceLockStatusW *_self = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceLockStatusW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(18); } static PyObject *py_svcctl_QueryServiceLockStatusW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 19) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceLockStatusW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceLockStatusW_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 svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 19) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceLockStatusW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceLockStatusW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceLockStatusW *object = (struct svcctl_QueryServiceLockStatusW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 19) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceLockStatusW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceLockStatusW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceLockStatusW_ndr_print(py_obj, "svcctl_QueryServiceLockStatusW_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceLockStatusW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceLockStatusW_ndr_print(py_obj, "svcctl_QueryServiceLockStatusW_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceLockStatusW_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceLockStatusW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceLockStatusW.opnum() -> 18 (0x12) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_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_svcctl_QueryServiceLockStatusW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceLockStatusW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceLockStatusW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceLockStatusW", .tp_getset = py_svcctl_QueryServiceLockStatusW_getsetters, .tp_methods = py_svcctl_QueryServiceLockStatusW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceLockStatusW_new, }; static bool pack_py_svcctl_QueryServiceLockStatusW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceLockStatusW *r) { PyObject *py_handle; PyObject *py_offered; const char *kwnames[] = { "handle", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:svcctl_QueryServiceLockStatusW", discard_const_p(char *, kwnames), &py_handle, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceLockStatusW_args_out(struct svcctl_QueryServiceLockStatusW *r) { PyObject *result; PyObject *py_lock_status; PyObject *py_needed; result = PyTuple_New(2); py_lock_status = pytalloc_reference_ex(&SERVICE_LOCK_STATUS_Type, r->out.lock_status, r->out.lock_status); PyTuple_SetItem(result, 0, py_lock_status); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_StartServiceW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_StartServiceW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_StartServiceW_in_get_NumArgs(PyObject *obj, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(obj); PyObject *py_NumArgs; py_NumArgs = PyLong_FromUnsignedLongLong((uint32_t)object->in.NumArgs); return py_NumArgs; } static int py_svcctl_StartServiceW_in_set_NumArgs(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.NumArgs"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.NumArgs)); 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.NumArgs = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_StartServiceW_in_get_Arguments(PyObject *obj, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(obj); PyObject *py_Arguments; if (object->in.Arguments == NULL) { Py_RETURN_NONE; } if (object->in.Arguments == NULL) { py_Arguments = Py_None; Py_INCREF(py_Arguments); } else { py_Arguments = PyList_New(object->in.NumArgs); if (py_Arguments == NULL) { return NULL; } { int Arguments_cntr_1; for (Arguments_cntr_1 = 0; Arguments_cntr_1 < (object->in.NumArgs); Arguments_cntr_1++) { PyObject *py_Arguments_1; py_Arguments_1 = pytalloc_reference_ex(&svcctl_ArgumentString_Type, object->in.Arguments, &object->in.Arguments[Arguments_cntr_1]); PyList_SetItem(py_Arguments, Arguments_cntr_1, py_Arguments_1); } } } return py_Arguments; } static int py_svcctl_StartServiceW_in_set_Arguments(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.Arguments)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Arguments"); return -1; } if (value == Py_None) { object->in.Arguments = NULL; } else { object->in.Arguments = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int Arguments_cntr_1; object->in.Arguments = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.Arguments, PyList_GET_SIZE(value)); if (!object->in.Arguments) { return -1;; } talloc_set_name_const(object->in.Arguments, "ARRAY: object->in.Arguments"); for (Arguments_cntr_1 = 0; Arguments_cntr_1 < PyList_GET_SIZE(value); Arguments_cntr_1++) { if (PyList_GET_ITEM(value, Arguments_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Arguments[Arguments_cntr_1]"); return -1; } PY_CHECK_TYPE(&svcctl_ArgumentString_Type, PyList_GET_ITEM(value, Arguments_cntr_1), return -1;); if (talloc_reference(object->in.Arguments, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, Arguments_cntr_1))) == NULL) { PyErr_NoMemory(); return -1; } object->in.Arguments[Arguments_cntr_1] = *(struct svcctl_ArgumentString *)pytalloc_get_ptr(PyList_GET_ITEM(value, Arguments_cntr_1)); } } } return 0; } static PyObject *py_svcctl_StartServiceW_get_result(PyObject *obj, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_StartServiceW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)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_svcctl_StartServiceW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_StartServiceW_in_get_handle, .set = py_svcctl_StartServiceW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_NumArgs"), .get = py_svcctl_StartServiceW_in_get_NumArgs, .set = py_svcctl_StartServiceW_in_set_NumArgs, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_Arguments"), .get = py_svcctl_StartServiceW_in_get_Arguments, .set = py_svcctl_StartServiceW_in_set_Arguments, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ArgumentString") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_StartServiceW_get_result, .set = py_svcctl_StartServiceW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_StartServiceW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_StartServiceW, type); struct svcctl_StartServiceW *_self = (struct svcctl_StartServiceW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_StartServiceW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(19); } static PyObject *py_svcctl_StartServiceW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 20) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_StartServiceW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_StartServiceW_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_svcctl_StartServiceW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_StartServiceW_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_svcctl_StartServiceW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_StartServiceW_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 svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 20) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_StartServiceW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_StartServiceW_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_svcctl_StartServiceW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_StartServiceW_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_svcctl_StartServiceW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_StartServiceW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_StartServiceW *object = (struct svcctl_StartServiceW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 20) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_StartServiceW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_StartServiceW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_StartServiceW_ndr_print(py_obj, "svcctl_StartServiceW_in", NDR_IN); } static PyObject *py_svcctl_StartServiceW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_StartServiceW_ndr_print(py_obj, "svcctl_StartServiceW_out", NDR_OUT); } static PyMethodDef py_svcctl_StartServiceW_methods[] = { { "opnum", (PyCFunction)py_svcctl_StartServiceW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.StartServiceW.opnum() -> 19 (0x13) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_StartServiceW_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_svcctl_StartServiceW_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_svcctl_StartServiceW_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_svcctl_StartServiceW_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_svcctl_StartServiceW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_StartServiceW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_StartServiceW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.StartServiceW", .tp_getset = py_svcctl_StartServiceW_getsetters, .tp_methods = py_svcctl_StartServiceW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_StartServiceW_new, }; static bool pack_py_svcctl_StartServiceW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_StartServiceW *r) { PyObject *py_handle; PyObject *py_Arguments; const char *kwnames[] = { "handle", "Arguments", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:svcctl_StartServiceW", discard_const_p(char *, kwnames), &py_handle, &py_Arguments)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); PY_CHECK_TYPE(&PyList_Type, py_Arguments, return false;); r->in.NumArgs = PyList_GET_SIZE(py_Arguments); if (py_Arguments == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Arguments"); return false; } if (py_Arguments == Py_None) { r->in.Arguments = NULL; } else { r->in.Arguments = NULL; PY_CHECK_TYPE(&PyList_Type, py_Arguments, return false;); { int Arguments_cntr_1; r->in.Arguments = talloc_array_ptrtype(r, r->in.Arguments, PyList_GET_SIZE(py_Arguments)); if (!r->in.Arguments) { return false;; } talloc_set_name_const(r->in.Arguments, "ARRAY: r->in.Arguments"); for (Arguments_cntr_1 = 0; Arguments_cntr_1 < PyList_GET_SIZE(py_Arguments); Arguments_cntr_1++) { if (PyList_GET_ITEM(py_Arguments, Arguments_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Arguments[Arguments_cntr_1]"); return false; } PY_CHECK_TYPE(&svcctl_ArgumentString_Type, PyList_GET_ITEM(py_Arguments, Arguments_cntr_1), return false;); if (talloc_reference(r->in.Arguments, pytalloc_get_mem_ctx(PyList_GET_ITEM(py_Arguments, Arguments_cntr_1))) == NULL) { PyErr_NoMemory(); return false; } r->in.Arguments[Arguments_cntr_1] = *(struct svcctl_ArgumentString *)pytalloc_get_ptr(PyList_GET_ITEM(py_Arguments, Arguments_cntr_1)); } } } return true; } static PyObject *unpack_py_svcctl_StartServiceW_args_out(struct svcctl_StartServiceW *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_svcctl_GetServiceDisplayNameW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_GetServiceDisplayNameW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_GetServiceDisplayNameW_in_get_service_name(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(obj); PyObject *py_service_name; if (object->in.service_name == NULL) { Py_RETURN_NONE; } if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { py_service_name = PyUnicode_Decode(object->in.service_name, strlen(object->in.service_name), "utf-8", "ignore"); } } return py_service_name; } static int py_svcctl_GetServiceDisplayNameW_in_set_service_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_name"); return -1; } if (value == Py_None) { object->in.service_name = NULL; } else { object->in.service_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.service_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameW_out_get_display_name(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(obj); PyObject *py_display_name; if (object->out.display_name == NULL) { Py_RETURN_NONE; } if (*object->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { if (*object->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyUnicode_Decode(*object->out.display_name, strlen(*object->out.display_name), "utf-8", "ignore"); } } return py_display_name; } static int py_svcctl_GetServiceDisplayNameW_out_set_display_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.display_name)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.display_name"); return -1; } object->out.display_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.display_name); if (object->out.display_name == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.display_name = NULL; } else { *object->out.display_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->out.display_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameW_in_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->in.display_name_length == NULL) { Py_RETURN_NONE; } if (object->in.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->in.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceDisplayNameW_in_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.display_name_length"); return -1; } if (value == Py_None) { object->in.display_name_length = NULL; } else { object->in.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.display_name_length); if (object->in.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameW_out_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->out.display_name_length == NULL) { Py_RETURN_NONE; } if (object->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->out.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceDisplayNameW_out_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.display_name_length"); return -1; } if (value == Py_None) { object->out.display_name_length = NULL; } else { object->out.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.display_name_length); if (object->out.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameW_get_result(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_GetServiceDisplayNameW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)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_svcctl_GetServiceDisplayNameW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_GetServiceDisplayNameW_in_get_handle, .set = py_svcctl_GetServiceDisplayNameW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_service_name"), .get = py_svcctl_GetServiceDisplayNameW_in_get_service_name, .set = py_svcctl_GetServiceDisplayNameW_in_set_service_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_display_name"), .get = py_svcctl_GetServiceDisplayNameW_out_get_display_name, .set = py_svcctl_GetServiceDisplayNameW_out_set_display_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_display_name_length"), .get = py_svcctl_GetServiceDisplayNameW_in_get_display_name_length, .set = py_svcctl_GetServiceDisplayNameW_in_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_display_name_length"), .get = py_svcctl_GetServiceDisplayNameW_out_get_display_name_length, .set = py_svcctl_GetServiceDisplayNameW_out_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_GetServiceDisplayNameW_get_result, .set = py_svcctl_GetServiceDisplayNameW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_GetServiceDisplayNameW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_GetServiceDisplayNameW, type); struct svcctl_GetServiceDisplayNameW *_self = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_GetServiceDisplayNameW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(20); } static PyObject *py_svcctl_GetServiceDisplayNameW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 21) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceDisplayNameW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_GetServiceDisplayNameW_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 svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 21) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceDisplayNameW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceDisplayNameW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceDisplayNameW *object = (struct svcctl_GetServiceDisplayNameW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 21) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceDisplayNameW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceDisplayNameW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceDisplayNameW_ndr_print(py_obj, "svcctl_GetServiceDisplayNameW_in", NDR_IN); } static PyObject *py_svcctl_GetServiceDisplayNameW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceDisplayNameW_ndr_print(py_obj, "svcctl_GetServiceDisplayNameW_out", NDR_OUT); } static PyMethodDef py_svcctl_GetServiceDisplayNameW_methods[] = { { "opnum", (PyCFunction)py_svcctl_GetServiceDisplayNameW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.GetServiceDisplayNameW.opnum() -> 20 (0x14) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_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_svcctl_GetServiceDisplayNameW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_GetServiceDisplayNameW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_GetServiceDisplayNameW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.GetServiceDisplayNameW", .tp_getset = py_svcctl_GetServiceDisplayNameW_getsetters, .tp_methods = py_svcctl_GetServiceDisplayNameW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_GetServiceDisplayNameW_new, }; static bool pack_py_svcctl_GetServiceDisplayNameW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_GetServiceDisplayNameW *r) { PyObject *py_handle; PyObject *py_service_name; PyObject *py_display_name_length; const char *kwnames[] = { "handle", "service_name", "display_name_length", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_GetServiceDisplayNameW", discard_const_p(char *, kwnames), &py_handle, &py_service_name, &py_display_name_length)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_service_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_name"); return false; } if (py_service_name == Py_None) { r->in.service_name = NULL; } else { r->in.service_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_name)) { unicode = PyUnicode_AsEncodedString(py_service_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_name)) { test_str = PyBytes_AS_STRING(py_service_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_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.service_name = talloc_str; } } if (py_display_name_length == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.display_name_length"); return false; } if (py_display_name_length == Py_None) { r->in.display_name_length = NULL; } else { r->in.display_name_length = talloc_ptrtype(r, r->in.display_name_length); if (r->in.display_name_length == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.display_name_length)); if (PyLong_Check(py_display_name_length)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_display_name_length); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_GetServiceDisplayNameW_args_out(struct svcctl_GetServiceDisplayNameW *r) { PyObject *result; PyObject *py_display_name; PyObject *py_display_name_length; result = PyTuple_New(2); if (*r->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { if (*r->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyUnicode_Decode(*r->out.display_name, strlen(*r->out.display_name), "utf-8", "ignore"); } } PyTuple_SetItem(result, 0, py_display_name); if (r->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*r->out.display_name_length); } PyTuple_SetItem(result, 1, py_display_name_length); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_GetServiceKeyNameW_in_get_handle(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_GetServiceKeyNameW_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_GetServiceKeyNameW_in_get_service_name(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(obj); PyObject *py_service_name; if (object->in.service_name == NULL) { Py_RETURN_NONE; } if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { py_service_name = PyUnicode_Decode(object->in.service_name, strlen(object->in.service_name), "utf-8", "ignore"); } } return py_service_name; } static int py_svcctl_GetServiceKeyNameW_in_set_service_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_name"); return -1; } if (value == Py_None) { object->in.service_name = NULL; } else { object->in.service_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.service_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameW_out_get_key_name(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(obj); PyObject *py_key_name; if (object->out.key_name == NULL) { Py_RETURN_NONE; } if (*object->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { if (*object->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { py_key_name = PyUnicode_Decode(*object->out.key_name, strlen(*object->out.key_name), "utf-8", "ignore"); } } return py_key_name; } static int py_svcctl_GetServiceKeyNameW_out_set_key_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.key_name)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.key_name"); return -1; } object->out.key_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.key_name); if (object->out.key_name == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.key_name = NULL; } else { *object->out.key_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->out.key_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameW_in_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->in.display_name_length == NULL) { Py_RETURN_NONE; } if (object->in.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->in.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceKeyNameW_in_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.display_name_length"); return -1; } if (value == Py_None) { object->in.display_name_length = NULL; } else { object->in.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.display_name_length); if (object->in.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameW_out_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->out.display_name_length == NULL) { Py_RETURN_NONE; } if (object->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->out.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceKeyNameW_out_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.display_name_length"); return -1; } if (value == Py_None) { object->out.display_name_length = NULL; } else { object->out.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.display_name_length); if (object->out.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameW_get_result(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_GetServiceKeyNameW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)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_svcctl_GetServiceKeyNameW_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_GetServiceKeyNameW_in_get_handle, .set = py_svcctl_GetServiceKeyNameW_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_service_name"), .get = py_svcctl_GetServiceKeyNameW_in_get_service_name, .set = py_svcctl_GetServiceKeyNameW_in_set_service_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_key_name"), .get = py_svcctl_GetServiceKeyNameW_out_get_key_name, .set = py_svcctl_GetServiceKeyNameW_out_set_key_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_display_name_length"), .get = py_svcctl_GetServiceKeyNameW_in_get_display_name_length, .set = py_svcctl_GetServiceKeyNameW_in_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_display_name_length"), .get = py_svcctl_GetServiceKeyNameW_out_get_display_name_length, .set = py_svcctl_GetServiceKeyNameW_out_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_GetServiceKeyNameW_get_result, .set = py_svcctl_GetServiceKeyNameW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_GetServiceKeyNameW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_GetServiceKeyNameW, type); struct svcctl_GetServiceKeyNameW *_self = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_GetServiceKeyNameW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(21); } static PyObject *py_svcctl_GetServiceKeyNameW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 22) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceKeyNameW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_GetServiceKeyNameW_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 svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 22) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceKeyNameW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceKeyNameW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceKeyNameW *object = (struct svcctl_GetServiceKeyNameW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 22) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceKeyNameW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceKeyNameW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceKeyNameW_ndr_print(py_obj, "svcctl_GetServiceKeyNameW_in", NDR_IN); } static PyObject *py_svcctl_GetServiceKeyNameW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceKeyNameW_ndr_print(py_obj, "svcctl_GetServiceKeyNameW_out", NDR_OUT); } static PyMethodDef py_svcctl_GetServiceKeyNameW_methods[] = { { "opnum", (PyCFunction)py_svcctl_GetServiceKeyNameW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.GetServiceKeyNameW.opnum() -> 21 (0x15) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_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_svcctl_GetServiceKeyNameW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_GetServiceKeyNameW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_GetServiceKeyNameW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.GetServiceKeyNameW", .tp_getset = py_svcctl_GetServiceKeyNameW_getsetters, .tp_methods = py_svcctl_GetServiceKeyNameW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_GetServiceKeyNameW_new, }; static bool pack_py_svcctl_GetServiceKeyNameW_args_in(PyObject *args, PyObject *kwargs, struct svcctl_GetServiceKeyNameW *r) { PyObject *py_handle; PyObject *py_service_name; PyObject *py_display_name_length; const char *kwnames[] = { "handle", "service_name", "display_name_length", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_GetServiceKeyNameW", discard_const_p(char *, kwnames), &py_handle, &py_service_name, &py_display_name_length)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_service_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_name"); return false; } if (py_service_name == Py_None) { r->in.service_name = NULL; } else { r->in.service_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_name)) { unicode = PyUnicode_AsEncodedString(py_service_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_name)) { test_str = PyBytes_AS_STRING(py_service_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_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.service_name = talloc_str; } } if (py_display_name_length == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.display_name_length"); return false; } if (py_display_name_length == Py_None) { r->in.display_name_length = NULL; } else { r->in.display_name_length = talloc_ptrtype(r, r->in.display_name_length); if (r->in.display_name_length == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.display_name_length)); if (PyLong_Check(py_display_name_length)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_display_name_length); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_GetServiceKeyNameW_args_out(struct svcctl_GetServiceKeyNameW *r) { PyObject *result; PyObject *py_key_name; PyObject *py_display_name_length; result = PyTuple_New(2); if (*r->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { if (*r->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { py_key_name = PyUnicode_Decode(*r->out.key_name, strlen(*r->out.key_name), "utf-8", "ignore"); } } PyTuple_SetItem(result, 0, py_key_name); if (r->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*r->out.display_name_length); } PyTuple_SetItem(result, 1, py_display_name_length); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_SCSetServiceBitsA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_SCSetServiceBitsA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_SCSetServiceBitsA_in_get_bits(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(obj); PyObject *py_bits; py_bits = PyLong_FromUnsignedLongLong((uint32_t)object->in.bits); return py_bits; } static int py_svcctl_SCSetServiceBitsA_in_set_bits(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.bits"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.bits)); 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.bits = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SCSetServiceBitsA_in_get_bitson(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(obj); PyObject *py_bitson; py_bitson = PyLong_FromUnsignedLongLong((uint32_t)object->in.bitson); return py_bitson; } static int py_svcctl_SCSetServiceBitsA_in_set_bitson(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.bitson"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.bitson)); 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.bitson = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SCSetServiceBitsA_in_get_immediate(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(obj); PyObject *py_immediate; py_immediate = PyLong_FromUnsignedLongLong((uint32_t)object->in.immediate); return py_immediate; } static int py_svcctl_SCSetServiceBitsA_in_set_immediate(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.immediate"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.immediate)); 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.immediate = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_SCSetServiceBitsA_get_result(PyObject *obj, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_SCSetServiceBitsA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)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_svcctl_SCSetServiceBitsA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_SCSetServiceBitsA_in_get_handle, .set = py_svcctl_SCSetServiceBitsA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_bits"), .get = py_svcctl_SCSetServiceBitsA_in_get_bits, .set = py_svcctl_SCSetServiceBitsA_in_set_bits, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_bitson"), .get = py_svcctl_SCSetServiceBitsA_in_get_bitson, .set = py_svcctl_SCSetServiceBitsA_in_set_bitson, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_immediate"), .get = py_svcctl_SCSetServiceBitsA_in_get_immediate, .set = py_svcctl_SCSetServiceBitsA_in_set_immediate, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_SCSetServiceBitsA_get_result, .set = py_svcctl_SCSetServiceBitsA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_SCSetServiceBitsA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_SCSetServiceBitsA, type); struct svcctl_SCSetServiceBitsA *_self = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_SCSetServiceBitsA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(22); } static PyObject *py_svcctl_SCSetServiceBitsA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 23) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SCSetServiceBitsA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_SCSetServiceBitsA_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 svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 23) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SCSetServiceBitsA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_SCSetServiceBitsA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_SCSetServiceBitsA *object = (struct svcctl_SCSetServiceBitsA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 23) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_SCSetServiceBitsA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_SCSetServiceBitsA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_SCSetServiceBitsA_ndr_print(py_obj, "svcctl_SCSetServiceBitsA_in", NDR_IN); } static PyObject *py_svcctl_SCSetServiceBitsA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_SCSetServiceBitsA_ndr_print(py_obj, "svcctl_SCSetServiceBitsA_out", NDR_OUT); } static PyMethodDef py_svcctl_SCSetServiceBitsA_methods[] = { { "opnum", (PyCFunction)py_svcctl_SCSetServiceBitsA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.SCSetServiceBitsA.opnum() -> 22 (0x16) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_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_svcctl_SCSetServiceBitsA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_SCSetServiceBitsA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_SCSetServiceBitsA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.SCSetServiceBitsA", .tp_getset = py_svcctl_SCSetServiceBitsA_getsetters, .tp_methods = py_svcctl_SCSetServiceBitsA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_SCSetServiceBitsA_new, }; static bool pack_py_svcctl_SCSetServiceBitsA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_SCSetServiceBitsA *r) { PyObject *py_handle; PyObject *py_bits; PyObject *py_bitson; PyObject *py_immediate; const char *kwnames[] = { "handle", "bits", "bitson", "immediate", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:svcctl_SCSetServiceBitsA", discard_const_p(char *, kwnames), &py_handle, &py_bits, &py_bitson, &py_immediate)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_bits == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.bits"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.bits)); if (PyLong_Check(py_bits)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_bits); 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.bits = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_bitson == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.bitson"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.bitson)); if (PyLong_Check(py_bitson)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_bitson); 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.bitson = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_immediate == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.immediate"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.immediate)); if (PyLong_Check(py_immediate)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_immediate); 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.immediate = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_SCSetServiceBitsA_args_out(struct svcctl_SCSetServiceBitsA *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_svcctl_ChangeServiceConfigA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_ChangeServiceConfigA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_type(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_svcctl_ChangeServiceConfigA_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)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_svcctl_ChangeServiceConfigA_in_get_start_type(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_start_type; py_start_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.start_type); return py_start_type; } static int py_svcctl_ChangeServiceConfigA_in_set_start_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.start_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_error_control(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_error_control; py_error_control = PyLong_FromUnsignedLongLong((uint32_t)object->in.error_control); return py_error_control; } static int py_svcctl_ChangeServiceConfigA_in_set_error_control(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.error_control"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.error_control)); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_binary_path(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_binary_path; if (object->in.binary_path == NULL) { Py_RETURN_NONE; } if (object->in.binary_path == NULL) { py_binary_path = Py_None; Py_INCREF(py_binary_path); } else { if (object->in.binary_path == NULL) { py_binary_path = Py_None; Py_INCREF(py_binary_path); } else { py_binary_path = PyUnicode_Decode(object->in.binary_path, strlen(object->in.binary_path), "utf-8", "ignore"); } } return py_binary_path; } static int py_svcctl_ChangeServiceConfigA_in_set_binary_path(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.binary_path"); return -1; } if (value == Py_None) { object->in.binary_path = NULL; } else { object->in.binary_path = 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.binary_path = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_load_order_group(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_load_order_group; if (object->in.load_order_group == NULL) { Py_RETURN_NONE; } if (object->in.load_order_group == NULL) { py_load_order_group = Py_None; Py_INCREF(py_load_order_group); } else { if (object->in.load_order_group == NULL) { py_load_order_group = Py_None; Py_INCREF(py_load_order_group); } else { py_load_order_group = PyUnicode_Decode(object->in.load_order_group, strlen(object->in.load_order_group), "utf-8", "ignore"); } } return py_load_order_group; } static int py_svcctl_ChangeServiceConfigA_in_set_load_order_group(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.load_order_group"); return -1; } if (value == Py_None) { object->in.load_order_group = NULL; } else { object->in.load_order_group = 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.load_order_group = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_out_get_tag_id(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_tag_id; if (object->out.tag_id == NULL) { Py_RETURN_NONE; } py_tag_id = PyLong_FromUnsignedLongLong((uint32_t)*object->out.tag_id); return py_tag_id; } static int py_svcctl_ChangeServiceConfigA_out_set_tag_id(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.tag_id)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.tag_id"); return -1; } object->out.tag_id = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.tag_id); if (object->out.tag_id == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.tag_id)); 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.tag_id = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_dependencies(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_dependencies; if (object->in.dependencies == NULL) { Py_RETURN_NONE; } if (object->in.dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { if (object->in.dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { py_dependencies = PyUnicode_Decode(object->in.dependencies, strlen(object->in.dependencies), "utf-8", "ignore"); } } return py_dependencies; } static int py_svcctl_ChangeServiceConfigA_in_set_dependencies(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dependencies"); return -1; } if (value == Py_None) { object->in.dependencies = NULL; } else { object->in.dependencies = 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.dependencies = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_service_start_name(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_service_start_name; if (object->in.service_start_name == NULL) { Py_RETURN_NONE; } if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { py_service_start_name = PyUnicode_Decode(object->in.service_start_name, strlen(object->in.service_start_name), "utf-8", "ignore"); } } return py_service_start_name; } static int py_svcctl_ChangeServiceConfigA_in_set_service_start_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_start_name"); return -1; } if (value == Py_None) { object->in.service_start_name = NULL; } else { object->in.service_start_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.service_start_name = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_password(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_password; if (object->in.password == NULL) { Py_RETURN_NONE; } if (object->in.password == NULL) { py_password = Py_None; Py_INCREF(py_password); } else { if (object->in.password == NULL) { py_password = Py_None; Py_INCREF(py_password); } else { py_password = PyUnicode_Decode(object->in.password, strlen(object->in.password), "utf-8", "ignore"); } } return py_password; } static int py_svcctl_ChangeServiceConfigA_in_set_password(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.password"); return -1; } if (value == Py_None) { object->in.password = NULL; } else { object->in.password = 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.password = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_in_get_display_name(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_display_name; if (object->in.display_name == NULL) { Py_RETURN_NONE; } if (object->in.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { if (object->in.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyUnicode_Decode(object->in.display_name, strlen(object->in.display_name), "utf-8", "ignore"); } } return py_display_name; } static int py_svcctl_ChangeServiceConfigA_in_set_display_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.display_name"); return -1; } if (value == Py_None) { object->in.display_name = NULL; } else { object->in.display_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.display_name = talloc_str; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfigA_get_result(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_ChangeServiceConfigA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)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_svcctl_ChangeServiceConfigA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_ChangeServiceConfigA_in_get_handle, .set = py_svcctl_ChangeServiceConfigA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_type"), .get = py_svcctl_ChangeServiceConfigA_in_get_type, .set = py_svcctl_ChangeServiceConfigA_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_start_type"), .get = py_svcctl_ChangeServiceConfigA_in_get_start_type, .set = py_svcctl_ChangeServiceConfigA_in_set_start_type, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_StartType") }, { .name = discard_const_p(char, "in_error_control"), .get = py_svcctl_ChangeServiceConfigA_in_get_error_control, .set = py_svcctl_ChangeServiceConfigA_in_set_error_control, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ErrorControl") }, { .name = discard_const_p(char, "in_binary_path"), .get = py_svcctl_ChangeServiceConfigA_in_get_binary_path, .set = py_svcctl_ChangeServiceConfigA_in_set_binary_path, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_load_order_group"), .get = py_svcctl_ChangeServiceConfigA_in_get_load_order_group, .set = py_svcctl_ChangeServiceConfigA_in_set_load_order_group, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_tag_id"), .get = py_svcctl_ChangeServiceConfigA_out_get_tag_id, .set = py_svcctl_ChangeServiceConfigA_out_set_tag_id, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_dependencies"), .get = py_svcctl_ChangeServiceConfigA_in_get_dependencies, .set = py_svcctl_ChangeServiceConfigA_in_set_dependencies, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_service_start_name"), .get = py_svcctl_ChangeServiceConfigA_in_get_service_start_name, .set = py_svcctl_ChangeServiceConfigA_in_set_service_start_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_password"), .get = py_svcctl_ChangeServiceConfigA_in_get_password, .set = py_svcctl_ChangeServiceConfigA_in_set_password, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_display_name"), .get = py_svcctl_ChangeServiceConfigA_in_get_display_name, .set = py_svcctl_ChangeServiceConfigA_in_set_display_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_ChangeServiceConfigA_get_result, .set = py_svcctl_ChangeServiceConfigA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_ChangeServiceConfigA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_ChangeServiceConfigA, type); struct svcctl_ChangeServiceConfigA *_self = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.tag_id = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_ChangeServiceConfigA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(23); } static PyObject *py_svcctl_ChangeServiceConfigA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 24) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfigA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfigA_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 svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 24) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfigA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfigA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfigA *object = (struct svcctl_ChangeServiceConfigA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 24) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfigA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfigA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfigA_ndr_print(py_obj, "svcctl_ChangeServiceConfigA_in", NDR_IN); } static PyObject *py_svcctl_ChangeServiceConfigA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfigA_ndr_print(py_obj, "svcctl_ChangeServiceConfigA_out", NDR_OUT); } static PyMethodDef py_svcctl_ChangeServiceConfigA_methods[] = { { "opnum", (PyCFunction)py_svcctl_ChangeServiceConfigA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.ChangeServiceConfigA.opnum() -> 23 (0x17) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_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_svcctl_ChangeServiceConfigA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_ChangeServiceConfigA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_ChangeServiceConfigA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ChangeServiceConfigA", .tp_getset = py_svcctl_ChangeServiceConfigA_getsetters, .tp_methods = py_svcctl_ChangeServiceConfigA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_ChangeServiceConfigA_new, }; static bool pack_py_svcctl_ChangeServiceConfigA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_ChangeServiceConfigA *r) { PyObject *py_handle; PyObject *py_type; PyObject *py_start_type; PyObject *py_error_control; PyObject *py_binary_path; PyObject *py_load_order_group; PyObject *py_dependencies; PyObject *py_service_start_name; PyObject *py_password; PyObject *py_display_name; const char *kwnames[] = { "handle", "type", "start_type", "error_control", "binary_path", "load_order_group", "dependencies", "service_start_name", "password", "display_name", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOOOOO:svcctl_ChangeServiceConfigA", discard_const_p(char *, kwnames), &py_handle, &py_type, &py_start_type, &py_error_control, &py_binary_path, &py_load_order_group, &py_dependencies, &py_service_start_name, &py_password, &py_display_name)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); 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_start_type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.start_type"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.start_type)); if (PyLong_Check(py_start_type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_error_control == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.error_control"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.error_control)); if (PyLong_Check(py_error_control)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_error_control); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_binary_path == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.binary_path"); return false; } if (py_binary_path == Py_None) { r->in.binary_path = NULL; } else { r->in.binary_path = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_binary_path)) { unicode = PyUnicode_AsEncodedString(py_binary_path, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_binary_path)) { test_str = PyBytes_AS_STRING(py_binary_path); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_binary_path)->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.binary_path = talloc_str; } } if (py_load_order_group == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.load_order_group"); return false; } if (py_load_order_group == Py_None) { r->in.load_order_group = NULL; } else { r->in.load_order_group = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_load_order_group)) { unicode = PyUnicode_AsEncodedString(py_load_order_group, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_load_order_group)) { test_str = PyBytes_AS_STRING(py_load_order_group); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_load_order_group)->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.load_order_group = talloc_str; } } if (py_dependencies == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dependencies"); return false; } if (py_dependencies == Py_None) { r->in.dependencies = NULL; } else { r->in.dependencies = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_dependencies)) { unicode = PyUnicode_AsEncodedString(py_dependencies, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_dependencies)) { test_str = PyBytes_AS_STRING(py_dependencies); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_dependencies)->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.dependencies = talloc_str; } } if (py_service_start_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_start_name"); return false; } if (py_service_start_name == Py_None) { r->in.service_start_name = NULL; } else { r->in.service_start_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_start_name)) { unicode = PyUnicode_AsEncodedString(py_service_start_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_start_name)) { test_str = PyBytes_AS_STRING(py_service_start_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_start_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.service_start_name = talloc_str; } } if (py_password == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.password"); return false; } if (py_password == Py_None) { r->in.password = NULL; } else { r->in.password = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_password)) { unicode = PyUnicode_AsEncodedString(py_password, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_password)) { test_str = PyBytes_AS_STRING(py_password); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_password)->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.password = talloc_str; } } if (py_display_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.display_name"); return false; } if (py_display_name == Py_None) { r->in.display_name = NULL; } else { r->in.display_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_display_name)) { unicode = PyUnicode_AsEncodedString(py_display_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_display_name)) { test_str = PyBytes_AS_STRING(py_display_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_display_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.display_name = talloc_str; } } return true; } static PyObject *unpack_py_svcctl_ChangeServiceConfigA_args_out(struct svcctl_ChangeServiceConfigA *r) { PyObject *result; PyObject *py_tag_id; py_tag_id = PyLong_FromUnsignedLongLong((uint32_t)*r->out.tag_id); result = py_tag_id; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_CreateServiceA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_CreateServiceA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_ServiceName(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_ServiceName; if (object->in.ServiceName == NULL) { Py_RETURN_NONE; } if (object->in.ServiceName == NULL) { py_ServiceName = Py_None; Py_INCREF(py_ServiceName); } else { if (object->in.ServiceName == NULL) { py_ServiceName = Py_None; Py_INCREF(py_ServiceName); } else { py_ServiceName = PyUnicode_Decode(object->in.ServiceName, strlen(object->in.ServiceName), "utf-8", "ignore"); } } return py_ServiceName; } static int py_svcctl_CreateServiceA_in_set_ServiceName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.ServiceName"); return -1; } if (value == Py_None) { object->in.ServiceName = NULL; } else { object->in.ServiceName = 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.ServiceName = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_DisplayName(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_DisplayName; if (object->in.DisplayName == NULL) { Py_RETURN_NONE; } if (object->in.DisplayName == NULL) { py_DisplayName = Py_None; Py_INCREF(py_DisplayName); } else { if (object->in.DisplayName == NULL) { py_DisplayName = Py_None; Py_INCREF(py_DisplayName); } else { py_DisplayName = PyUnicode_Decode(object->in.DisplayName, strlen(object->in.DisplayName), "utf-8", "ignore"); } } return py_DisplayName; } static int py_svcctl_CreateServiceA_in_set_DisplayName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.DisplayName"); return -1; } if (value == Py_None) { object->in.DisplayName = NULL; } else { object->in.DisplayName = 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.DisplayName = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_desired_access(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_desired_access; py_desired_access = PyLong_FromUnsignedLongLong((uint32_t)object->in.desired_access); return py_desired_access; } static int py_svcctl_CreateServiceA_in_set_desired_access(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.desired_access"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.desired_access)); 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.desired_access = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_type(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_svcctl_CreateServiceA_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)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_svcctl_CreateServiceA_in_get_start_type(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_start_type; py_start_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.start_type); return py_start_type; } static int py_svcctl_CreateServiceA_in_set_start_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.start_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_error_control(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_error_control; py_error_control = PyLong_FromUnsignedLongLong((uint32_t)object->in.error_control); return py_error_control; } static int py_svcctl_CreateServiceA_in_set_error_control(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.error_control"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.error_control)); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_binary_path(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_binary_path; if (object->in.binary_path == NULL) { Py_RETURN_NONE; } if (object->in.binary_path == NULL) { py_binary_path = Py_None; Py_INCREF(py_binary_path); } else { if (object->in.binary_path == NULL) { py_binary_path = Py_None; Py_INCREF(py_binary_path); } else { py_binary_path = PyUnicode_Decode(object->in.binary_path, strlen(object->in.binary_path), "utf-8", "ignore"); } } return py_binary_path; } static int py_svcctl_CreateServiceA_in_set_binary_path(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.binary_path"); return -1; } if (value == Py_None) { object->in.binary_path = NULL; } else { object->in.binary_path = 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.binary_path = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_LoadOrderGroupKey(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_LoadOrderGroupKey; if (object->in.LoadOrderGroupKey == NULL) { Py_RETURN_NONE; } if (object->in.LoadOrderGroupKey == NULL) { py_LoadOrderGroupKey = Py_None; Py_INCREF(py_LoadOrderGroupKey); } else { if (object->in.LoadOrderGroupKey == NULL) { py_LoadOrderGroupKey = Py_None; Py_INCREF(py_LoadOrderGroupKey); } else { py_LoadOrderGroupKey = PyUnicode_Decode(object->in.LoadOrderGroupKey, strlen(object->in.LoadOrderGroupKey), "utf-8", "ignore"); } } return py_LoadOrderGroupKey; } static int py_svcctl_CreateServiceA_in_set_LoadOrderGroupKey(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.LoadOrderGroupKey"); return -1; } if (value == Py_None) { object->in.LoadOrderGroupKey = NULL; } else { object->in.LoadOrderGroupKey = 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.LoadOrderGroupKey = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceA_out_get_TagId(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_TagId; if (object->out.TagId == NULL) { Py_RETURN_NONE; } if (object->out.TagId == NULL) { py_TagId = Py_None; Py_INCREF(py_TagId); } else { py_TagId = PyLong_FromUnsignedLongLong((uint32_t)*object->out.TagId); } return py_TagId; } static int py_svcctl_CreateServiceA_out_set_TagId(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.TagId)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.TagId"); return -1; } if (value == Py_None) { object->out.TagId = NULL; } else { object->out.TagId = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.TagId); if (object->out.TagId == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.TagId)); 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.TagId = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_dependencies(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_dependencies; if (object->in.dependencies == NULL) { Py_RETURN_NONE; } if (object->in.dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { if (object->in.dependencies == NULL) { py_dependencies = Py_None; Py_INCREF(py_dependencies); } else { py_dependencies = PyUnicode_Decode(object->in.dependencies, strlen(object->in.dependencies), "utf-8", "ignore"); } } return py_dependencies; } static int py_svcctl_CreateServiceA_in_set_dependencies(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.dependencies"); return -1; } if (value == Py_None) { object->in.dependencies = NULL; } else { object->in.dependencies = 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.dependencies = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_service_start_name(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_service_start_name; if (object->in.service_start_name == NULL) { Py_RETURN_NONE; } if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { if (object->in.service_start_name == NULL) { py_service_start_name = Py_None; Py_INCREF(py_service_start_name); } else { py_service_start_name = PyUnicode_Decode(object->in.service_start_name, strlen(object->in.service_start_name), "utf-8", "ignore"); } } return py_service_start_name; } static int py_svcctl_CreateServiceA_in_set_service_start_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_start_name"); return -1; } if (value == Py_None) { object->in.service_start_name = NULL; } else { object->in.service_start_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.service_start_name = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceA_in_get_password(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_password; if (object->in.password == NULL) { Py_RETURN_NONE; } if (object->in.password == NULL) { py_password = Py_None; Py_INCREF(py_password); } else { if (object->in.password == NULL) { py_password = Py_None; Py_INCREF(py_password); } else { py_password = PyUnicode_Decode(object->in.password, strlen(object->in.password), "utf-8", "ignore"); } } return py_password; } static int py_svcctl_CreateServiceA_in_set_password(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.password"); return -1; } if (value == Py_None) { object->in.password = NULL; } else { object->in.password = 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.password = talloc_str; } } return 0; } static PyObject *py_svcctl_CreateServiceA_get_result(PyObject *obj, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_CreateServiceA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)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_svcctl_CreateServiceA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_CreateServiceA_in_get_handle, .set = py_svcctl_CreateServiceA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_ServiceName"), .get = py_svcctl_CreateServiceA_in_get_ServiceName, .set = py_svcctl_CreateServiceA_in_set_ServiceName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_DisplayName"), .get = py_svcctl_CreateServiceA_in_get_DisplayName, .set = py_svcctl_CreateServiceA_in_set_DisplayName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_desired_access"), .get = py_svcctl_CreateServiceA_in_get_desired_access, .set = py_svcctl_CreateServiceA_in_set_desired_access, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_type"), .get = py_svcctl_CreateServiceA_in_get_type, .set = py_svcctl_CreateServiceA_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_start_type"), .get = py_svcctl_CreateServiceA_in_get_start_type, .set = py_svcctl_CreateServiceA_in_set_start_type, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_StartType") }, { .name = discard_const_p(char, "in_error_control"), .get = py_svcctl_CreateServiceA_in_get_error_control, .set = py_svcctl_CreateServiceA_in_set_error_control, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ErrorControl") }, { .name = discard_const_p(char, "in_binary_path"), .get = py_svcctl_CreateServiceA_in_get_binary_path, .set = py_svcctl_CreateServiceA_in_set_binary_path, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_LoadOrderGroupKey"), .get = py_svcctl_CreateServiceA_in_get_LoadOrderGroupKey, .set = py_svcctl_CreateServiceA_in_set_LoadOrderGroupKey, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_TagId"), .get = py_svcctl_CreateServiceA_out_get_TagId, .set = py_svcctl_CreateServiceA_out_set_TagId, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_dependencies"), .get = py_svcctl_CreateServiceA_in_get_dependencies, .set = py_svcctl_CreateServiceA_in_set_dependencies, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_service_start_name"), .get = py_svcctl_CreateServiceA_in_get_service_start_name, .set = py_svcctl_CreateServiceA_in_set_service_start_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_password"), .get = py_svcctl_CreateServiceA_in_get_password, .set = py_svcctl_CreateServiceA_in_set_password, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_CreateServiceA_get_result, .set = py_svcctl_CreateServiceA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_CreateServiceA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_CreateServiceA, type); struct svcctl_CreateServiceA *_self = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_CreateServiceA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(24); } static PyObject *py_svcctl_CreateServiceA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 25) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CreateServiceA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CreateServiceA_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_svcctl_CreateServiceA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_CreateServiceA_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_svcctl_CreateServiceA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_CreateServiceA_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 svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 25) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CreateServiceA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CreateServiceA_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_svcctl_CreateServiceA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_CreateServiceA_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_svcctl_CreateServiceA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_CreateServiceA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_CreateServiceA *object = (struct svcctl_CreateServiceA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 25) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_CreateServiceA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_CreateServiceA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_CreateServiceA_ndr_print(py_obj, "svcctl_CreateServiceA_in", NDR_IN); } static PyObject *py_svcctl_CreateServiceA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_CreateServiceA_ndr_print(py_obj, "svcctl_CreateServiceA_out", NDR_OUT); } static PyMethodDef py_svcctl_CreateServiceA_methods[] = { { "opnum", (PyCFunction)py_svcctl_CreateServiceA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.CreateServiceA.opnum() -> 24 (0x18) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_CreateServiceA_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_svcctl_CreateServiceA_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_svcctl_CreateServiceA_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_svcctl_CreateServiceA_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_svcctl_CreateServiceA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_CreateServiceA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_CreateServiceA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.CreateServiceA", .tp_getset = py_svcctl_CreateServiceA_getsetters, .tp_methods = py_svcctl_CreateServiceA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_CreateServiceA_new, }; static bool pack_py_svcctl_CreateServiceA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_CreateServiceA *r) { PyObject *py_handle; PyObject *py_ServiceName; PyObject *py_DisplayName; PyObject *py_desired_access; PyObject *py_type; PyObject *py_start_type; PyObject *py_error_control; PyObject *py_binary_path; PyObject *py_LoadOrderGroupKey; PyObject *py_dependencies; PyObject *py_service_start_name; PyObject *py_password; const char *kwnames[] = { "handle", "ServiceName", "DisplayName", "desired_access", "type", "start_type", "error_control", "binary_path", "LoadOrderGroupKey", "dependencies", "service_start_name", "password", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOOOOOOO:svcctl_CreateServiceA", discard_const_p(char *, kwnames), &py_handle, &py_ServiceName, &py_DisplayName, &py_desired_access, &py_type, &py_start_type, &py_error_control, &py_binary_path, &py_LoadOrderGroupKey, &py_dependencies, &py_service_start_name, &py_password)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_ServiceName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.ServiceName"); return false; } if (py_ServiceName == Py_None) { r->in.ServiceName = NULL; } else { r->in.ServiceName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_ServiceName)) { unicode = PyUnicode_AsEncodedString(py_ServiceName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_ServiceName)) { test_str = PyBytes_AS_STRING(py_ServiceName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_ServiceName)->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.ServiceName = talloc_str; } } if (py_DisplayName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.DisplayName"); return false; } if (py_DisplayName == Py_None) { r->in.DisplayName = NULL; } else { r->in.DisplayName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_DisplayName)) { unicode = PyUnicode_AsEncodedString(py_DisplayName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_DisplayName)) { test_str = PyBytes_AS_STRING(py_DisplayName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_DisplayName)->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.DisplayName = talloc_str; } } if (py_desired_access == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.desired_access"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.desired_access)); if (PyLong_Check(py_desired_access)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_desired_access); 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.desired_access = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } 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_start_type == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.start_type"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.start_type)); if (PyLong_Check(py_start_type)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_start_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.start_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_error_control == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.error_control"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.error_control)); if (PyLong_Check(py_error_control)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_error_control); 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.error_control = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_binary_path == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.binary_path"); return false; } if (py_binary_path == Py_None) { r->in.binary_path = NULL; } else { r->in.binary_path = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_binary_path)) { unicode = PyUnicode_AsEncodedString(py_binary_path, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_binary_path)) { test_str = PyBytes_AS_STRING(py_binary_path); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_binary_path)->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.binary_path = talloc_str; } } if (py_LoadOrderGroupKey == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.LoadOrderGroupKey"); return false; } if (py_LoadOrderGroupKey == Py_None) { r->in.LoadOrderGroupKey = NULL; } else { r->in.LoadOrderGroupKey = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_LoadOrderGroupKey)) { unicode = PyUnicode_AsEncodedString(py_LoadOrderGroupKey, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_LoadOrderGroupKey)) { test_str = PyBytes_AS_STRING(py_LoadOrderGroupKey); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_LoadOrderGroupKey)->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.LoadOrderGroupKey = talloc_str; } } if (py_dependencies == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.dependencies"); return false; } if (py_dependencies == Py_None) { r->in.dependencies = NULL; } else { r->in.dependencies = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_dependencies)) { unicode = PyUnicode_AsEncodedString(py_dependencies, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_dependencies)) { test_str = PyBytes_AS_STRING(py_dependencies); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_dependencies)->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.dependencies = talloc_str; } } if (py_service_start_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_start_name"); return false; } if (py_service_start_name == Py_None) { r->in.service_start_name = NULL; } else { r->in.service_start_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_start_name)) { unicode = PyUnicode_AsEncodedString(py_service_start_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_start_name)) { test_str = PyBytes_AS_STRING(py_service_start_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_start_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.service_start_name = talloc_str; } } if (py_password == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.password"); return false; } if (py_password == Py_None) { r->in.password = NULL; } else { r->in.password = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_password)) { unicode = PyUnicode_AsEncodedString(py_password, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_password)) { test_str = PyBytes_AS_STRING(py_password); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_password)->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.password = talloc_str; } } return true; } static PyObject *unpack_py_svcctl_CreateServiceA_args_out(struct svcctl_CreateServiceA *r) { PyObject *result; PyObject *py_TagId; if (r->out.TagId == NULL) { py_TagId = Py_None; Py_INCREF(py_TagId); } else { py_TagId = PyLong_FromUnsignedLongLong((uint32_t)*r->out.TagId); } result = py_TagId; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_EnumDependentServicesA_in_get_service(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(obj); PyObject *py_service; if (object->in.service == NULL) { Py_RETURN_NONE; } py_service = pytalloc_reference_ex(policy_handle_Type, object->in.service, object->in.service); return py_service; } static int py_svcctl_EnumDependentServicesA_in_set_service(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.service)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service"); return -1; } object->in.service = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.service); if (object->in.service == 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.service = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_EnumDependentServicesA_in_get_state(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(obj); PyObject *py_state; py_state = PyLong_FromUnsignedLongLong((uint32_t)object->in.state); return py_state; } static int py_svcctl_EnumDependentServicesA_in_set_state(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.state"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.state)); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesA_out_get_service_status(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(obj); PyObject *py_service_status; if (object->out.service_status == NULL) { Py_RETURN_NONE; } if (object->out.service_status == NULL) { py_service_status = Py_None; Py_INCREF(py_service_status); } else { py_service_status = pytalloc_reference_ex(&ENUM_SERVICE_STATUSA_Type, object->out.service_status, object->out.service_status); } return py_service_status; } static int py_svcctl_EnumDependentServicesA_out_set_service_status(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.service_status)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service_status"); return -1; } if (value == Py_None) { object->out.service_status = NULL; } else { object->out.service_status = NULL; PY_CHECK_TYPE(&ENUM_SERVICE_STATUSA_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.service_status = (struct ENUM_SERVICE_STATUSA *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_svcctl_EnumDependentServicesA_in_get_offered(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_EnumDependentServicesA_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesA_out_get_needed(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_EnumDependentServicesA_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesA_out_get_services_returned(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(obj); PyObject *py_services_returned; if (object->out.services_returned == NULL) { Py_RETURN_NONE; } py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.services_returned); return py_services_returned; } static int py_svcctl_EnumDependentServicesA_out_set_services_returned(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.services_returned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services_returned"); return -1; } object->out.services_returned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.services_returned); if (object->out.services_returned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.services_returned)); 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.services_returned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumDependentServicesA_get_result(PyObject *obj, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_EnumDependentServicesA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)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_svcctl_EnumDependentServicesA_getsetters[] = { { .name = discard_const_p(char, "in_service"), .get = py_svcctl_EnumDependentServicesA_in_get_service, .set = py_svcctl_EnumDependentServicesA_in_set_service, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_state"), .get = py_svcctl_EnumDependentServicesA_in_get_state, .set = py_svcctl_EnumDependentServicesA_in_set_state, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceState") }, { .name = discard_const_p(char, "out_service_status"), .get = py_svcctl_EnumDependentServicesA_out_get_service_status, .set = py_svcctl_EnumDependentServicesA_out_set_service_status, .doc = discard_const_p(char, "PIDL-generated element of base type ENUM_SERVICE_STATUSA") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_EnumDependentServicesA_in_get_offered, .set = py_svcctl_EnumDependentServicesA_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_EnumDependentServicesA_out_get_needed, .set = py_svcctl_EnumDependentServicesA_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_services_returned"), .get = py_svcctl_EnumDependentServicesA_out_get_services_returned, .set = py_svcctl_EnumDependentServicesA_out_set_services_returned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_EnumDependentServicesA_get_result, .set = py_svcctl_EnumDependentServicesA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_EnumDependentServicesA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_EnumDependentServicesA, type); struct svcctl_EnumDependentServicesA *_self = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.service = talloc_zero(mem_ctx, struct policy_handle); _self->out.needed = talloc_zero(mem_ctx, uint32_t); _self->out.services_returned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_EnumDependentServicesA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(25); } static PyObject *py_svcctl_EnumDependentServicesA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 26) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumDependentServicesA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_EnumDependentServicesA_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 svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 26) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumDependentServicesA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumDependentServicesA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumDependentServicesA *object = (struct svcctl_EnumDependentServicesA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 26) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumDependentServicesA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumDependentServicesA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumDependentServicesA_ndr_print(py_obj, "svcctl_EnumDependentServicesA_in", NDR_IN); } static PyObject *py_svcctl_EnumDependentServicesA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumDependentServicesA_ndr_print(py_obj, "svcctl_EnumDependentServicesA_out", NDR_OUT); } static PyMethodDef py_svcctl_EnumDependentServicesA_methods[] = { { "opnum", (PyCFunction)py_svcctl_EnumDependentServicesA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.EnumDependentServicesA.opnum() -> 25 (0x19) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_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_svcctl_EnumDependentServicesA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_EnumDependentServicesA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_EnumDependentServicesA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.EnumDependentServicesA", .tp_getset = py_svcctl_EnumDependentServicesA_getsetters, .tp_methods = py_svcctl_EnumDependentServicesA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_EnumDependentServicesA_new, }; static bool pack_py_svcctl_EnumDependentServicesA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_EnumDependentServicesA *r) { PyObject *py_service; PyObject *py_state; PyObject *py_offered; const char *kwnames[] = { "service", "state", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_EnumDependentServicesA", discard_const_p(char *, kwnames), &py_service, &py_state, &py_offered)) { return false; } if (py_service == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service"); return false; } r->in.service = talloc_ptrtype(r, r->in.service); if (r->in.service == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_service, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_service)) == NULL) { PyErr_NoMemory(); return false; } r->in.service = (struct policy_handle *)pytalloc_get_ptr(py_service); if (py_state == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.state"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.state)); if (PyLong_Check(py_state)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_state); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_EnumDependentServicesA_args_out(struct svcctl_EnumDependentServicesA *r) { PyObject *result; PyObject *py_service_status; PyObject *py_needed; PyObject *py_services_returned; result = PyTuple_New(3); if (r->out.service_status == NULL) { py_service_status = Py_None; Py_INCREF(py_service_status); } else { py_service_status = pytalloc_reference_ex(&ENUM_SERVICE_STATUSA_Type, r->out.service_status, r->out.service_status); } PyTuple_SetItem(result, 0, py_service_status); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.services_returned); PyTuple_SetItem(result, 2, py_services_returned); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_EnumServicesStatusA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_EnumServicesStatusA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_EnumServicesStatusA_in_get_type(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_svcctl_EnumServicesStatusA_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)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_svcctl_EnumServicesStatusA_in_get_state(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_state; py_state = PyLong_FromUnsignedLongLong((uint32_t)object->in.state); return py_state; } static int py_svcctl_EnumServicesStatusA_in_set_state(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.state"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.state)); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusA_in_get_offered(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_EnumServicesStatusA_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusA_out_get_service(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_service; py_service = PyList_New(object->in.offered); if (py_service == NULL) { return NULL; } { int service_cntr_0; for (service_cntr_0 = 0; service_cntr_0 < (object->in.offered); service_cntr_0++) { PyObject *py_service_0; py_service_0 = PyLong_FromLong((uint16_t)object->out.service[service_cntr_0]); PyList_SetItem(py_service, service_cntr_0, py_service_0); } } return py_service; } static int py_svcctl_EnumServicesStatusA_out_set_service(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int service_cntr_0; object->out.service = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service, PyList_GET_SIZE(value)); if (!object->out.service) { return -1;; } talloc_set_name_const(object->out.service, "ARRAY: object->out.service"); for (service_cntr_0 = 0; service_cntr_0 < PyList_GET_SIZE(value); service_cntr_0++) { if (PyList_GET_ITEM(value, service_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service[service_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.service[service_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, service_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, service_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.service[service_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_EnumServicesStatusA_out_get_needed(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_EnumServicesStatusA_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusA_out_get_services_returned(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_services_returned; if (object->out.services_returned == NULL) { Py_RETURN_NONE; } py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.services_returned); return py_services_returned; } static int py_svcctl_EnumServicesStatusA_out_set_services_returned(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.services_returned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services_returned"); return -1; } object->out.services_returned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.services_returned); if (object->out.services_returned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.services_returned)); 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.services_returned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_EnumServicesStatusA_in_get_resume_handle(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->in.resume_handle == NULL) { Py_RETURN_NONE; } if (object->in.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->in.resume_handle); } return py_resume_handle; } static int py_svcctl_EnumServicesStatusA_in_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.resume_handle"); return -1; } if (value == Py_None) { object->in.resume_handle = NULL; } else { object->in.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.resume_handle); if (object->in.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_EnumServicesStatusA_out_get_resume_handle(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->out.resume_handle == NULL) { Py_RETURN_NONE; } if (object->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->out.resume_handle); } return py_resume_handle; } static int py_svcctl_EnumServicesStatusA_out_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.resume_handle"); return -1; } if (value == Py_None) { object->out.resume_handle = NULL; } else { object->out.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.resume_handle); if (object->out.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_EnumServicesStatusA_get_result(PyObject *obj, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_EnumServicesStatusA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)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_svcctl_EnumServicesStatusA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_EnumServicesStatusA_in_get_handle, .set = py_svcctl_EnumServicesStatusA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_type"), .get = py_svcctl_EnumServicesStatusA_in_get_type, .set = py_svcctl_EnumServicesStatusA_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_state"), .get = py_svcctl_EnumServicesStatusA_in_get_state, .set = py_svcctl_EnumServicesStatusA_in_set_state, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceState") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_EnumServicesStatusA_in_get_offered, .set = py_svcctl_EnumServicesStatusA_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_service"), .get = py_svcctl_EnumServicesStatusA_out_get_service, .set = py_svcctl_EnumServicesStatusA_out_set_service, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_EnumServicesStatusA_out_get_needed, .set = py_svcctl_EnumServicesStatusA_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_services_returned"), .get = py_svcctl_EnumServicesStatusA_out_get_services_returned, .set = py_svcctl_EnumServicesStatusA_out_set_services_returned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_resume_handle"), .get = py_svcctl_EnumServicesStatusA_in_get_resume_handle, .set = py_svcctl_EnumServicesStatusA_in_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_resume_handle"), .get = py_svcctl_EnumServicesStatusA_out_get_resume_handle, .set = py_svcctl_EnumServicesStatusA_out_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_EnumServicesStatusA_get_result, .set = py_svcctl_EnumServicesStatusA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_EnumServicesStatusA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_EnumServicesStatusA, type); struct svcctl_EnumServicesStatusA *_self = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.needed = talloc_zero(mem_ctx, uint32_t); _self->out.services_returned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_EnumServicesStatusA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(26); } static PyObject *py_svcctl_EnumServicesStatusA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 27) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumServicesStatusA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_EnumServicesStatusA_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 svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 27) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumServicesStatusA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_EnumServicesStatusA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_EnumServicesStatusA *object = (struct svcctl_EnumServicesStatusA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 27) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_EnumServicesStatusA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_EnumServicesStatusA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumServicesStatusA_ndr_print(py_obj, "svcctl_EnumServicesStatusA_in", NDR_IN); } static PyObject *py_svcctl_EnumServicesStatusA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_EnumServicesStatusA_ndr_print(py_obj, "svcctl_EnumServicesStatusA_out", NDR_OUT); } static PyMethodDef py_svcctl_EnumServicesStatusA_methods[] = { { "opnum", (PyCFunction)py_svcctl_EnumServicesStatusA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.EnumServicesStatusA.opnum() -> 26 (0x1a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_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_svcctl_EnumServicesStatusA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_EnumServicesStatusA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_EnumServicesStatusA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.EnumServicesStatusA", .tp_getset = py_svcctl_EnumServicesStatusA_getsetters, .tp_methods = py_svcctl_EnumServicesStatusA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_EnumServicesStatusA_new, }; static bool pack_py_svcctl_EnumServicesStatusA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_EnumServicesStatusA *r) { PyObject *py_handle; PyObject *py_type; PyObject *py_state; PyObject *py_offered; PyObject *py_resume_handle; const char *kwnames[] = { "handle", "type", "state", "offered", "resume_handle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:svcctl_EnumServicesStatusA", discard_const_p(char *, kwnames), &py_handle, &py_type, &py_state, &py_offered, &py_resume_handle)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); 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_state == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.state"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.state)); if (PyLong_Check(py_state)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_state); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_resume_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.resume_handle"); return false; } if (py_resume_handle == Py_None) { r->in.resume_handle = NULL; } else { r->in.resume_handle = talloc_ptrtype(r, r->in.resume_handle); if (r->in.resume_handle == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.resume_handle)); if (PyLong_Check(py_resume_handle)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_resume_handle); 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.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_EnumServicesStatusA_args_out(struct svcctl_EnumServicesStatusA *r) { PyObject *result; PyObject *py_service; PyObject *py_needed; PyObject *py_services_returned; PyObject *py_resume_handle; result = PyTuple_New(4); py_service = PyList_New(r->in.offered); if (py_service == NULL) { return NULL; } { int service_cntr_0; for (service_cntr_0 = 0; service_cntr_0 < (r->in.offered); service_cntr_0++) { PyObject *py_service_0; py_service_0 = PyLong_FromLong((uint16_t)r->out.service[service_cntr_0]); PyList_SetItem(py_service, service_cntr_0, py_service_0); } } PyTuple_SetItem(result, 0, py_service); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); py_services_returned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.services_returned); PyTuple_SetItem(result, 2, py_services_returned); if (r->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*r->out.resume_handle); } PyTuple_SetItem(result, 3, py_resume_handle); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_OpenSCManagerA_in_get_MachineName(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(obj); PyObject *py_MachineName; if (object->in.MachineName == NULL) { Py_RETURN_NONE; } if (object->in.MachineName == NULL) { py_MachineName = Py_None; Py_INCREF(py_MachineName); } else { if (object->in.MachineName == NULL) { py_MachineName = Py_None; Py_INCREF(py_MachineName); } else { py_MachineName = PyUnicode_Decode(object->in.MachineName, strlen(object->in.MachineName), "utf-8", "ignore"); } } return py_MachineName; } static int py_svcctl_OpenSCManagerA_in_set_MachineName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.MachineName"); return -1; } if (value == Py_None) { object->in.MachineName = NULL; } else { object->in.MachineName = 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.MachineName = talloc_str; } } return 0; } static PyObject *py_svcctl_OpenSCManagerA_in_get_DatabaseName(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(obj); PyObject *py_DatabaseName; if (object->in.DatabaseName == NULL) { Py_RETURN_NONE; } if (object->in.DatabaseName == NULL) { py_DatabaseName = Py_None; Py_INCREF(py_DatabaseName); } else { if (object->in.DatabaseName == NULL) { py_DatabaseName = Py_None; Py_INCREF(py_DatabaseName); } else { py_DatabaseName = PyUnicode_Decode(object->in.DatabaseName, strlen(object->in.DatabaseName), "utf-8", "ignore"); } } return py_DatabaseName; } static int py_svcctl_OpenSCManagerA_in_set_DatabaseName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.DatabaseName"); return -1; } if (value == Py_None) { object->in.DatabaseName = NULL; } else { object->in.DatabaseName = 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.DatabaseName = talloc_str; } } return 0; } static PyObject *py_svcctl_OpenSCManagerA_in_get_access_mask(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(obj); PyObject *py_access_mask; py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask); return py_access_mask; } static int py_svcctl_OpenSCManagerA_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask)); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_OpenSCManagerA_out_get_handle(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->out.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle); return py_handle; } static int py_svcctl_OpenSCManagerA_out_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle"); return -1; } object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle); if (object->out.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_OpenSCManagerA_get_result(PyObject *obj, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_OpenSCManagerA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)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_svcctl_OpenSCManagerA_getsetters[] = { { .name = discard_const_p(char, "in_MachineName"), .get = py_svcctl_OpenSCManagerA_in_get_MachineName, .set = py_svcctl_OpenSCManagerA_in_set_MachineName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_DatabaseName"), .get = py_svcctl_OpenSCManagerA_in_get_DatabaseName, .set = py_svcctl_OpenSCManagerA_in_set_DatabaseName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_access_mask"), .get = py_svcctl_OpenSCManagerA_in_get_access_mask, .set = py_svcctl_OpenSCManagerA_in_set_access_mask, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_handle"), .get = py_svcctl_OpenSCManagerA_out_get_handle, .set = py_svcctl_OpenSCManagerA_out_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_OpenSCManagerA_get_result, .set = py_svcctl_OpenSCManagerA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_OpenSCManagerA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_OpenSCManagerA, type); struct svcctl_OpenSCManagerA *_self = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->out.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_OpenSCManagerA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(27); } static PyObject *py_svcctl_OpenSCManagerA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 28) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenSCManagerA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_OpenSCManagerA_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 svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 28) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenSCManagerA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenSCManagerA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenSCManagerA *object = (struct svcctl_OpenSCManagerA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 28) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenSCManagerA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenSCManagerA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenSCManagerA_ndr_print(py_obj, "svcctl_OpenSCManagerA_in", NDR_IN); } static PyObject *py_svcctl_OpenSCManagerA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenSCManagerA_ndr_print(py_obj, "svcctl_OpenSCManagerA_out", NDR_OUT); } static PyMethodDef py_svcctl_OpenSCManagerA_methods[] = { { "opnum", (PyCFunction)py_svcctl_OpenSCManagerA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.OpenSCManagerA.opnum() -> 27 (0x1b) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_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_svcctl_OpenSCManagerA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_OpenSCManagerA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_OpenSCManagerA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.OpenSCManagerA", .tp_getset = py_svcctl_OpenSCManagerA_getsetters, .tp_methods = py_svcctl_OpenSCManagerA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_OpenSCManagerA_new, }; static bool pack_py_svcctl_OpenSCManagerA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_OpenSCManagerA *r) { PyObject *py_MachineName; PyObject *py_DatabaseName; PyObject *py_access_mask; const char *kwnames[] = { "MachineName", "DatabaseName", "access_mask", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_OpenSCManagerA", discard_const_p(char *, kwnames), &py_MachineName, &py_DatabaseName, &py_access_mask)) { return false; } if (py_MachineName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.MachineName"); return false; } if (py_MachineName == Py_None) { r->in.MachineName = NULL; } else { r->in.MachineName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_MachineName)) { unicode = PyUnicode_AsEncodedString(py_MachineName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_MachineName)) { test_str = PyBytes_AS_STRING(py_MachineName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_MachineName)->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.MachineName = talloc_str; } } if (py_DatabaseName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.DatabaseName"); return false; } if (py_DatabaseName == Py_None) { r->in.DatabaseName = NULL; } else { r->in.DatabaseName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_DatabaseName)) { unicode = PyUnicode_AsEncodedString(py_DatabaseName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_DatabaseName)) { test_str = PyBytes_AS_STRING(py_DatabaseName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_DatabaseName)->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.DatabaseName = talloc_str; } } if (py_access_mask == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask)); if (PyLong_Check(py_access_mask)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_access_mask); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_OpenSCManagerA_args_out(struct svcctl_OpenSCManagerA *r) { PyObject *result; PyObject *py_handle; py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle); result = py_handle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_OpenServiceA_in_get_scmanager_handle(PyObject *obj, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(obj); PyObject *py_scmanager_handle; if (object->in.scmanager_handle == NULL) { Py_RETURN_NONE; } py_scmanager_handle = pytalloc_reference_ex(policy_handle_Type, object->in.scmanager_handle, object->in.scmanager_handle); return py_scmanager_handle; } static int py_svcctl_OpenServiceA_in_set_scmanager_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.scmanager_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.scmanager_handle"); return -1; } object->in.scmanager_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.scmanager_handle); if (object->in.scmanager_handle == 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.scmanager_handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_OpenServiceA_in_get_ServiceName(PyObject *obj, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(obj); PyObject *py_ServiceName; if (object->in.ServiceName == NULL) { Py_RETURN_NONE; } if (object->in.ServiceName == NULL) { py_ServiceName = Py_None; Py_INCREF(py_ServiceName); } else { if (object->in.ServiceName == NULL) { py_ServiceName = Py_None; Py_INCREF(py_ServiceName); } else { py_ServiceName = PyUnicode_Decode(object->in.ServiceName, strlen(object->in.ServiceName), "utf-8", "ignore"); } } return py_ServiceName; } static int py_svcctl_OpenServiceA_in_set_ServiceName(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.ServiceName"); return -1; } if (value == Py_None) { object->in.ServiceName = NULL; } else { object->in.ServiceName = 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.ServiceName = talloc_str; } } return 0; } static PyObject *py_svcctl_OpenServiceA_in_get_access_mask(PyObject *obj, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(obj); PyObject *py_access_mask; py_access_mask = PyLong_FromUnsignedLongLong((uint32_t)object->in.access_mask); return py_access_mask; } static int py_svcctl_OpenServiceA_in_set_access_mask(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.access_mask"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.access_mask)); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_OpenServiceA_out_get_handle(PyObject *obj, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->out.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->out.handle, object->out.handle); return py_handle; } static int py_svcctl_OpenServiceA_out_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.handle"); return -1; } object->out.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.handle); if (object->out.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_OpenServiceA_get_result(PyObject *obj, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_OpenServiceA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)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_svcctl_OpenServiceA_getsetters[] = { { .name = discard_const_p(char, "in_scmanager_handle"), .get = py_svcctl_OpenServiceA_in_get_scmanager_handle, .set = py_svcctl_OpenServiceA_in_set_scmanager_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_ServiceName"), .get = py_svcctl_OpenServiceA_in_get_ServiceName, .set = py_svcctl_OpenServiceA_in_set_ServiceName, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_access_mask"), .get = py_svcctl_OpenServiceA_in_get_access_mask, .set = py_svcctl_OpenServiceA_in_set_access_mask, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_handle"), .get = py_svcctl_OpenServiceA_out_get_handle, .set = py_svcctl_OpenServiceA_out_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_OpenServiceA_get_result, .set = py_svcctl_OpenServiceA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_OpenServiceA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_OpenServiceA, type); struct svcctl_OpenServiceA *_self = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.scmanager_handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_OpenServiceA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(28); } static PyObject *py_svcctl_OpenServiceA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 29) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenServiceA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenServiceA_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_svcctl_OpenServiceA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_OpenServiceA_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_svcctl_OpenServiceA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_OpenServiceA_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 svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 29) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenServiceA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenServiceA_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_svcctl_OpenServiceA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenServiceA_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_svcctl_OpenServiceA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_OpenServiceA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_OpenServiceA *object = (struct svcctl_OpenServiceA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 29) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_OpenServiceA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_OpenServiceA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenServiceA_ndr_print(py_obj, "svcctl_OpenServiceA_in", NDR_IN); } static PyObject *py_svcctl_OpenServiceA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_OpenServiceA_ndr_print(py_obj, "svcctl_OpenServiceA_out", NDR_OUT); } static PyMethodDef py_svcctl_OpenServiceA_methods[] = { { "opnum", (PyCFunction)py_svcctl_OpenServiceA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.OpenServiceA.opnum() -> 28 (0x1c) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_OpenServiceA_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_svcctl_OpenServiceA_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_svcctl_OpenServiceA_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_svcctl_OpenServiceA_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_svcctl_OpenServiceA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_OpenServiceA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_OpenServiceA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.OpenServiceA", .tp_getset = py_svcctl_OpenServiceA_getsetters, .tp_methods = py_svcctl_OpenServiceA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_OpenServiceA_new, }; static bool pack_py_svcctl_OpenServiceA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_OpenServiceA *r) { PyObject *py_scmanager_handle; PyObject *py_ServiceName; PyObject *py_access_mask; const char *kwnames[] = { "scmanager_handle", "ServiceName", "access_mask", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_OpenServiceA", discard_const_p(char *, kwnames), &py_scmanager_handle, &py_ServiceName, &py_access_mask)) { return false; } if (py_scmanager_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.scmanager_handle"); return false; } r->in.scmanager_handle = talloc_ptrtype(r, r->in.scmanager_handle); if (r->in.scmanager_handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_scmanager_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_scmanager_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.scmanager_handle = (struct policy_handle *)pytalloc_get_ptr(py_scmanager_handle); if (py_ServiceName == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.ServiceName"); return false; } if (py_ServiceName == Py_None) { r->in.ServiceName = NULL; } else { r->in.ServiceName = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_ServiceName)) { unicode = PyUnicode_AsEncodedString(py_ServiceName, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_ServiceName)) { test_str = PyBytes_AS_STRING(py_ServiceName); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_ServiceName)->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.ServiceName = talloc_str; } } if (py_access_mask == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.access_mask"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.access_mask)); if (PyLong_Check(py_access_mask)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_access_mask); 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.access_mask = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_OpenServiceA_args_out(struct svcctl_OpenServiceA *r) { PyObject *result; PyObject *py_handle; py_handle = pytalloc_reference_ex(policy_handle_Type, r->out.handle, r->out.handle); result = py_handle; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_QueryServiceConfigA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceConfigA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceConfigA_out_get_query(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_query; py_query = PyList_New(object->in.offered); if (py_query == NULL) { return NULL; } { int query_cntr_0; for (query_cntr_0 = 0; query_cntr_0 < (object->in.offered); query_cntr_0++) { PyObject *py_query_0; py_query_0 = PyLong_FromLong((uint16_t)object->out.query[query_cntr_0]); PyList_SetItem(py_query, query_cntr_0, py_query_0); } } return py_query; } static int py_svcctl_QueryServiceConfigA_out_set_query(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.query"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int query_cntr_0; object->out.query = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.query, PyList_GET_SIZE(value)); if (!object->out.query) { return -1;; } talloc_set_name_const(object->out.query, "ARRAY: object->out.query"); for (query_cntr_0 = 0; query_cntr_0 < PyList_GET_SIZE(value); query_cntr_0++) { if (PyList_GET_ITEM(value, query_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.query[query_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.query[query_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, query_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, query_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.query[query_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_QueryServiceConfigA_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceConfigA_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfigA_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceConfigA_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfigA_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceConfigA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)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_svcctl_QueryServiceConfigA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceConfigA_in_get_handle, .set = py_svcctl_QueryServiceConfigA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "out_query"), .get = py_svcctl_QueryServiceConfigA_out_get_query, .set = py_svcctl_QueryServiceConfigA_out_set_query, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceConfigA_in_get_offered, .set = py_svcctl_QueryServiceConfigA_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceConfigA_out_get_needed, .set = py_svcctl_QueryServiceConfigA_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceConfigA_get_result, .set = py_svcctl_QueryServiceConfigA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceConfigA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceConfigA, type); struct svcctl_QueryServiceConfigA *_self = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceConfigA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(29); } static PyObject *py_svcctl_QueryServiceConfigA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 30) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfigA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfigA_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 svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 30) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfigA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfigA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfigA *object = (struct svcctl_QueryServiceConfigA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 30) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfigA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfigA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfigA_ndr_print(py_obj, "svcctl_QueryServiceConfigA_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceConfigA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfigA_ndr_print(py_obj, "svcctl_QueryServiceConfigA_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceConfigA_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceConfigA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceConfigA.opnum() -> 29 (0x1d) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_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_svcctl_QueryServiceConfigA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceConfigA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceConfigA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceConfigA", .tp_getset = py_svcctl_QueryServiceConfigA_getsetters, .tp_methods = py_svcctl_QueryServiceConfigA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceConfigA_new, }; static bool pack_py_svcctl_QueryServiceConfigA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceConfigA *r) { PyObject *py_handle; PyObject *py_offered; const char *kwnames[] = { "handle", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:svcctl_QueryServiceConfigA", discard_const_p(char *, kwnames), &py_handle, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceConfigA_args_out(struct svcctl_QueryServiceConfigA *r) { PyObject *result; PyObject *py_query; PyObject *py_needed; result = PyTuple_New(2); py_query = PyList_New(r->in.offered); if (py_query == NULL) { return NULL; } { int query_cntr_0; for (query_cntr_0 = 0; query_cntr_0 < (r->in.offered); query_cntr_0++) { PyObject *py_query_0; py_query_0 = PyLong_FromLong((uint16_t)r->out.query[query_cntr_0]); PyList_SetItem(py_query, query_cntr_0, py_query_0); } } PyTuple_SetItem(result, 0, py_query); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_QueryServiceLockStatusA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceLockStatusA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceLockStatusA_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceLockStatusA_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceLockStatusA_out_get_lock_status(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(obj); PyObject *py_lock_status; if (object->out.lock_status == NULL) { Py_RETURN_NONE; } py_lock_status = pytalloc_reference_ex(&SERVICE_LOCK_STATUS_Type, object->out.lock_status, object->out.lock_status); return py_lock_status; } static int py_svcctl_QueryServiceLockStatusA_out_set_lock_status(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.lock_status)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.lock_status"); return -1; } object->out.lock_status = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.lock_status); if (object->out.lock_status == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&SERVICE_LOCK_STATUS_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.lock_status = (struct SERVICE_LOCK_STATUS *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceLockStatusA_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceLockStatusA_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceLockStatusA_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceLockStatusA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)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_svcctl_QueryServiceLockStatusA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceLockStatusA_in_get_handle, .set = py_svcctl_QueryServiceLockStatusA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceLockStatusA_in_get_offered, .set = py_svcctl_QueryServiceLockStatusA_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_lock_status"), .get = py_svcctl_QueryServiceLockStatusA_out_get_lock_status, .set = py_svcctl_QueryServiceLockStatusA_out_set_lock_status, .doc = discard_const_p(char, "PIDL-generated element of base type SERVICE_LOCK_STATUS") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceLockStatusA_out_get_needed, .set = py_svcctl_QueryServiceLockStatusA_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceLockStatusA_get_result, .set = py_svcctl_QueryServiceLockStatusA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceLockStatusA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceLockStatusA, type); struct svcctl_QueryServiceLockStatusA *_self = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceLockStatusA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(30); } static PyObject *py_svcctl_QueryServiceLockStatusA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 31) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceLockStatusA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceLockStatusA_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 svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 31) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceLockStatusA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceLockStatusA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceLockStatusA *object = (struct svcctl_QueryServiceLockStatusA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 31) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceLockStatusA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceLockStatusA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceLockStatusA_ndr_print(py_obj, "svcctl_QueryServiceLockStatusA_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceLockStatusA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceLockStatusA_ndr_print(py_obj, "svcctl_QueryServiceLockStatusA_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceLockStatusA_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceLockStatusA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceLockStatusA.opnum() -> 30 (0x1e) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_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_svcctl_QueryServiceLockStatusA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceLockStatusA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceLockStatusA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceLockStatusA", .tp_getset = py_svcctl_QueryServiceLockStatusA_getsetters, .tp_methods = py_svcctl_QueryServiceLockStatusA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceLockStatusA_new, }; static bool pack_py_svcctl_QueryServiceLockStatusA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceLockStatusA *r) { PyObject *py_handle; PyObject *py_offered; const char *kwnames[] = { "handle", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:svcctl_QueryServiceLockStatusA", discard_const_p(char *, kwnames), &py_handle, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceLockStatusA_args_out(struct svcctl_QueryServiceLockStatusA *r) { PyObject *result; PyObject *py_lock_status; PyObject *py_needed; result = PyTuple_New(2); py_lock_status = pytalloc_reference_ex(&SERVICE_LOCK_STATUS_Type, r->out.lock_status, r->out.lock_status); PyTuple_SetItem(result, 0, py_lock_status); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_StartServiceA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_StartServiceA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_StartServiceA_in_get_NumArgs(PyObject *obj, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(obj); PyObject *py_NumArgs; py_NumArgs = PyLong_FromUnsignedLongLong((uint32_t)object->in.NumArgs); return py_NumArgs; } static int py_svcctl_StartServiceA_in_set_NumArgs(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.NumArgs"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.NumArgs)); 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.NumArgs = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_StartServiceA_in_get_Arguments(PyObject *obj, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(obj); PyObject *py_Arguments; if (object->in.Arguments == NULL) { Py_RETURN_NONE; } if (object->in.Arguments == NULL) { py_Arguments = Py_None; Py_INCREF(py_Arguments); } else { if (object->in.Arguments == NULL) { py_Arguments = Py_None; Py_INCREF(py_Arguments); } else { py_Arguments = PyUnicode_Decode(object->in.Arguments, strlen(object->in.Arguments), "utf-8", "ignore"); } } return py_Arguments; } static int py_svcctl_StartServiceA_in_set_Arguments(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.Arguments"); return -1; } if (value == Py_None) { object->in.Arguments = NULL; } else { object->in.Arguments = 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.Arguments = talloc_str; } } return 0; } static PyObject *py_svcctl_StartServiceA_get_result(PyObject *obj, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_StartServiceA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)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_svcctl_StartServiceA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_StartServiceA_in_get_handle, .set = py_svcctl_StartServiceA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_NumArgs"), .get = py_svcctl_StartServiceA_in_get_NumArgs, .set = py_svcctl_StartServiceA_in_set_NumArgs, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_Arguments"), .get = py_svcctl_StartServiceA_in_get_Arguments, .set = py_svcctl_StartServiceA_in_set_Arguments, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_StartServiceA_get_result, .set = py_svcctl_StartServiceA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_StartServiceA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_StartServiceA, type); struct svcctl_StartServiceA *_self = (struct svcctl_StartServiceA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_StartServiceA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(31); } static PyObject *py_svcctl_StartServiceA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 32) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_StartServiceA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_StartServiceA_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_svcctl_StartServiceA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_StartServiceA_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_svcctl_StartServiceA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_StartServiceA_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 svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 32) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_StartServiceA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_StartServiceA_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_svcctl_StartServiceA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_StartServiceA_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_svcctl_StartServiceA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_StartServiceA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_StartServiceA *object = (struct svcctl_StartServiceA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 32) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_StartServiceA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_StartServiceA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_StartServiceA_ndr_print(py_obj, "svcctl_StartServiceA_in", NDR_IN); } static PyObject *py_svcctl_StartServiceA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_StartServiceA_ndr_print(py_obj, "svcctl_StartServiceA_out", NDR_OUT); } static PyMethodDef py_svcctl_StartServiceA_methods[] = { { "opnum", (PyCFunction)py_svcctl_StartServiceA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.StartServiceA.opnum() -> 31 (0x1f) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_StartServiceA_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_svcctl_StartServiceA_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_svcctl_StartServiceA_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_svcctl_StartServiceA_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_svcctl_StartServiceA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_StartServiceA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_StartServiceA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.StartServiceA", .tp_getset = py_svcctl_StartServiceA_getsetters, .tp_methods = py_svcctl_StartServiceA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_StartServiceA_new, }; static bool pack_py_svcctl_StartServiceA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_StartServiceA *r) { PyObject *py_handle; PyObject *py_NumArgs; PyObject *py_Arguments; const char *kwnames[] = { "handle", "NumArgs", "Arguments", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_StartServiceA", discard_const_p(char *, kwnames), &py_handle, &py_NumArgs, &py_Arguments)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_NumArgs == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.NumArgs"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.NumArgs)); if (PyLong_Check(py_NumArgs)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_NumArgs); 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.NumArgs = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_Arguments == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.Arguments"); return false; } if (py_Arguments == Py_None) { r->in.Arguments = NULL; } else { r->in.Arguments = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_Arguments)) { unicode = PyUnicode_AsEncodedString(py_Arguments, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_Arguments)) { test_str = PyBytes_AS_STRING(py_Arguments); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_Arguments)->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.Arguments = talloc_str; } } return true; } static PyObject *unpack_py_svcctl_StartServiceA_args_out(struct svcctl_StartServiceA *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_svcctl_GetServiceDisplayNameA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_GetServiceDisplayNameA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_GetServiceDisplayNameA_in_get_service_name(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(obj); PyObject *py_service_name; if (object->in.service_name == NULL) { Py_RETURN_NONE; } if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { py_service_name = PyUnicode_Decode(object->in.service_name, strlen(object->in.service_name), "utf-8", "ignore"); } } return py_service_name; } static int py_svcctl_GetServiceDisplayNameA_in_set_service_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_name"); return -1; } if (value == Py_None) { object->in.service_name = NULL; } else { object->in.service_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.service_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameA_out_get_display_name(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(obj); PyObject *py_display_name; if (object->out.display_name == NULL) { Py_RETURN_NONE; } if (*object->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { if (*object->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyUnicode_Decode(*object->out.display_name, strlen(*object->out.display_name), "utf-8", "ignore"); } } return py_display_name; } static int py_svcctl_GetServiceDisplayNameA_out_set_display_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.display_name)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.display_name"); return -1; } object->out.display_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.display_name); if (object->out.display_name == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.display_name = NULL; } else { *object->out.display_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->out.display_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameA_in_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->in.display_name_length == NULL) { Py_RETURN_NONE; } if (object->in.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->in.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceDisplayNameA_in_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.display_name_length"); return -1; } if (value == Py_None) { object->in.display_name_length = NULL; } else { object->in.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.display_name_length); if (object->in.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameA_out_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->out.display_name_length == NULL) { Py_RETURN_NONE; } if (object->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->out.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceDisplayNameA_out_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.display_name_length"); return -1; } if (value == Py_None) { object->out.display_name_length = NULL; } else { object->out.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.display_name_length); if (object->out.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceDisplayNameA_get_result(PyObject *obj, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_GetServiceDisplayNameA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)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_svcctl_GetServiceDisplayNameA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_GetServiceDisplayNameA_in_get_handle, .set = py_svcctl_GetServiceDisplayNameA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_service_name"), .get = py_svcctl_GetServiceDisplayNameA_in_get_service_name, .set = py_svcctl_GetServiceDisplayNameA_in_set_service_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_display_name"), .get = py_svcctl_GetServiceDisplayNameA_out_get_display_name, .set = py_svcctl_GetServiceDisplayNameA_out_set_display_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_display_name_length"), .get = py_svcctl_GetServiceDisplayNameA_in_get_display_name_length, .set = py_svcctl_GetServiceDisplayNameA_in_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_display_name_length"), .get = py_svcctl_GetServiceDisplayNameA_out_get_display_name_length, .set = py_svcctl_GetServiceDisplayNameA_out_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_GetServiceDisplayNameA_get_result, .set = py_svcctl_GetServiceDisplayNameA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_GetServiceDisplayNameA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_GetServiceDisplayNameA, type); struct svcctl_GetServiceDisplayNameA *_self = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_GetServiceDisplayNameA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(32); } static PyObject *py_svcctl_GetServiceDisplayNameA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 33) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceDisplayNameA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_GetServiceDisplayNameA_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 svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 33) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceDisplayNameA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceDisplayNameA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceDisplayNameA *object = (struct svcctl_GetServiceDisplayNameA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 33) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceDisplayNameA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceDisplayNameA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceDisplayNameA_ndr_print(py_obj, "svcctl_GetServiceDisplayNameA_in", NDR_IN); } static PyObject *py_svcctl_GetServiceDisplayNameA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceDisplayNameA_ndr_print(py_obj, "svcctl_GetServiceDisplayNameA_out", NDR_OUT); } static PyMethodDef py_svcctl_GetServiceDisplayNameA_methods[] = { { "opnum", (PyCFunction)py_svcctl_GetServiceDisplayNameA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.GetServiceDisplayNameA.opnum() -> 32 (0x20) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_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_svcctl_GetServiceDisplayNameA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_GetServiceDisplayNameA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_GetServiceDisplayNameA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.GetServiceDisplayNameA", .tp_getset = py_svcctl_GetServiceDisplayNameA_getsetters, .tp_methods = py_svcctl_GetServiceDisplayNameA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_GetServiceDisplayNameA_new, }; static bool pack_py_svcctl_GetServiceDisplayNameA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_GetServiceDisplayNameA *r) { PyObject *py_handle; PyObject *py_service_name; PyObject *py_display_name_length; const char *kwnames[] = { "handle", "service_name", "display_name_length", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_GetServiceDisplayNameA", discard_const_p(char *, kwnames), &py_handle, &py_service_name, &py_display_name_length)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_service_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_name"); return false; } if (py_service_name == Py_None) { r->in.service_name = NULL; } else { r->in.service_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_name)) { unicode = PyUnicode_AsEncodedString(py_service_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_name)) { test_str = PyBytes_AS_STRING(py_service_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_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.service_name = talloc_str; } } if (py_display_name_length == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.display_name_length"); return false; } if (py_display_name_length == Py_None) { r->in.display_name_length = NULL; } else { r->in.display_name_length = talloc_ptrtype(r, r->in.display_name_length); if (r->in.display_name_length == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.display_name_length)); if (PyLong_Check(py_display_name_length)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_display_name_length); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_GetServiceDisplayNameA_args_out(struct svcctl_GetServiceDisplayNameA *r) { PyObject *result; PyObject *py_display_name; PyObject *py_display_name_length; result = PyTuple_New(2); if (*r->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { if (*r->out.display_name == NULL) { py_display_name = Py_None; Py_INCREF(py_display_name); } else { py_display_name = PyUnicode_Decode(*r->out.display_name, strlen(*r->out.display_name), "utf-8", "ignore"); } } PyTuple_SetItem(result, 0, py_display_name); if (r->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*r->out.display_name_length); } PyTuple_SetItem(result, 1, py_display_name_length); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_GetServiceKeyNameA_in_get_handle(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_GetServiceKeyNameA_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_GetServiceKeyNameA_in_get_service_name(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(obj); PyObject *py_service_name; if (object->in.service_name == NULL) { Py_RETURN_NONE; } if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { if (object->in.service_name == NULL) { py_service_name = Py_None; Py_INCREF(py_service_name); } else { py_service_name = PyUnicode_Decode(object->in.service_name, strlen(object->in.service_name), "utf-8", "ignore"); } } return py_service_name; } static int py_svcctl_GetServiceKeyNameA_in_set_service_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.service_name"); return -1; } if (value == Py_None) { object->in.service_name = NULL; } else { object->in.service_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.service_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameA_out_get_key_name(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(obj); PyObject *py_key_name; if (object->out.key_name == NULL) { Py_RETURN_NONE; } if (*object->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { if (*object->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { py_key_name = PyUnicode_Decode(*object->out.key_name, strlen(*object->out.key_name), "utf-8", "ignore"); } } return py_key_name; } static int py_svcctl_GetServiceKeyNameA_out_set_key_name(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.key_name)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.key_name"); return -1; } object->out.key_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.key_name); if (object->out.key_name == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.key_name = NULL; } else { *object->out.key_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->out.key_name = talloc_str; } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameA_in_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->in.display_name_length == NULL) { Py_RETURN_NONE; } if (object->in.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->in.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceKeyNameA_in_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.display_name_length"); return -1; } if (value == Py_None) { object->in.display_name_length = NULL; } else { object->in.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.display_name_length); if (object->in.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameA_out_get_display_name_length(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(obj); PyObject *py_display_name_length; if (object->out.display_name_length == NULL) { Py_RETURN_NONE; } if (object->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*object->out.display_name_length); } return py_display_name_length; } static int py_svcctl_GetServiceKeyNameA_out_set_display_name_length(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.display_name_length)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.display_name_length"); return -1; } if (value == Py_None) { object->out.display_name_length = NULL; } else { object->out.display_name_length = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.display_name_length); if (object->out.display_name_length == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.display_name_length)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_GetServiceKeyNameA_get_result(PyObject *obj, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_GetServiceKeyNameA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)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_svcctl_GetServiceKeyNameA_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_GetServiceKeyNameA_in_get_handle, .set = py_svcctl_GetServiceKeyNameA_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_service_name"), .get = py_svcctl_GetServiceKeyNameA_in_get_service_name, .set = py_svcctl_GetServiceKeyNameA_in_set_service_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "out_key_name"), .get = py_svcctl_GetServiceKeyNameA_out_get_key_name, .set = py_svcctl_GetServiceKeyNameA_out_set_key_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "in_display_name_length"), .get = py_svcctl_GetServiceKeyNameA_in_get_display_name_length, .set = py_svcctl_GetServiceKeyNameA_in_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_display_name_length"), .get = py_svcctl_GetServiceKeyNameA_out_get_display_name_length, .set = py_svcctl_GetServiceKeyNameA_out_set_display_name_length, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_GetServiceKeyNameA_get_result, .set = py_svcctl_GetServiceKeyNameA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_GetServiceKeyNameA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_GetServiceKeyNameA, type); struct svcctl_GetServiceKeyNameA *_self = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_GetServiceKeyNameA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(33); } static PyObject *py_svcctl_GetServiceKeyNameA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 34) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceKeyNameA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_GetServiceKeyNameA_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 svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 34) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceKeyNameA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_GetServiceKeyNameA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_GetServiceKeyNameA *object = (struct svcctl_GetServiceKeyNameA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 34) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_GetServiceKeyNameA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_GetServiceKeyNameA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceKeyNameA_ndr_print(py_obj, "svcctl_GetServiceKeyNameA_in", NDR_IN); } static PyObject *py_svcctl_GetServiceKeyNameA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_GetServiceKeyNameA_ndr_print(py_obj, "svcctl_GetServiceKeyNameA_out", NDR_OUT); } static PyMethodDef py_svcctl_GetServiceKeyNameA_methods[] = { { "opnum", (PyCFunction)py_svcctl_GetServiceKeyNameA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.GetServiceKeyNameA.opnum() -> 33 (0x21) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_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_svcctl_GetServiceKeyNameA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_GetServiceKeyNameA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_GetServiceKeyNameA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.GetServiceKeyNameA", .tp_getset = py_svcctl_GetServiceKeyNameA_getsetters, .tp_methods = py_svcctl_GetServiceKeyNameA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_GetServiceKeyNameA_new, }; static bool pack_py_svcctl_GetServiceKeyNameA_args_in(PyObject *args, PyObject *kwargs, struct svcctl_GetServiceKeyNameA *r) { PyObject *py_handle; PyObject *py_service_name; PyObject *py_display_name_length; const char *kwnames[] = { "handle", "service_name", "display_name_length", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_GetServiceKeyNameA", discard_const_p(char *, kwnames), &py_handle, &py_service_name, &py_display_name_length)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_service_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.service_name"); return false; } if (py_service_name == Py_None) { r->in.service_name = NULL; } else { r->in.service_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_service_name)) { unicode = PyUnicode_AsEncodedString(py_service_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_service_name)) { test_str = PyBytes_AS_STRING(py_service_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_service_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.service_name = talloc_str; } } if (py_display_name_length == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.display_name_length"); return false; } if (py_display_name_length == Py_None) { r->in.display_name_length = NULL; } else { r->in.display_name_length = talloc_ptrtype(r, r->in.display_name_length); if (r->in.display_name_length == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.display_name_length)); if (PyLong_Check(py_display_name_length)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_display_name_length); if (PyErr_Occurred() != NULL) { return false; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return false; } *r->in.display_name_length = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_GetServiceKeyNameA_args_out(struct svcctl_GetServiceKeyNameA *r) { PyObject *result; PyObject *py_key_name; PyObject *py_display_name_length; result = PyTuple_New(2); if (*r->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { if (*r->out.key_name == NULL) { py_key_name = Py_None; Py_INCREF(py_key_name); } else { py_key_name = PyUnicode_Decode(*r->out.key_name, strlen(*r->out.key_name), "utf-8", "ignore"); } } PyTuple_SetItem(result, 0, py_key_name); if (r->out.display_name_length == NULL) { py_display_name_length = Py_None; Py_INCREF(py_display_name_length); } else { py_display_name_length = PyLong_FromUnsignedLongLong((uint32_t)*r->out.display_name_length); } PyTuple_SetItem(result, 1, py_display_name_length); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_ChangeServiceConfig2A_in_get_handle(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_ChangeServiceConfig2A_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_ChangeServiceConfig2A_in_get_info_level(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_info_level; py_info_level = PyLong_FromUnsignedLongLong((uint32_t)object->in.info_level); return py_info_level; } static int py_svcctl_ChangeServiceConfig2A_in_set_info_level(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info_level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfig2A_in_get_info(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_info; if (object->in.info == NULL) { Py_RETURN_NONE; } if (object->in.info == NULL) { py_info = Py_None; Py_INCREF(py_info); } else { py_info = PyLong_FromLong((uint16_t)*object->in.info); } return py_info; } static int py_svcctl_ChangeServiceConfig2A_in_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.info)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info"); return -1; } if (value == Py_None) { object->in.info = NULL; } else { object->in.info = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.info); if (object->in.info == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.info)); 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.info = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_ChangeServiceConfig2A_get_result(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_ChangeServiceConfig2A_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)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_svcctl_ChangeServiceConfig2A_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_ChangeServiceConfig2A_in_get_handle, .set = py_svcctl_ChangeServiceConfig2A_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_info_level"), .get = py_svcctl_ChangeServiceConfig2A_in_get_info_level, .set = py_svcctl_ChangeServiceConfig2A_in_set_info_level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_info"), .get = py_svcctl_ChangeServiceConfig2A_in_get_info, .set = py_svcctl_ChangeServiceConfig2A_in_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_ChangeServiceConfig2A_get_result, .set = py_svcctl_ChangeServiceConfig2A_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_ChangeServiceConfig2A_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_ChangeServiceConfig2A, type); struct svcctl_ChangeServiceConfig2A *_self = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_ChangeServiceConfig2A_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(36); } static PyObject *py_svcctl_ChangeServiceConfig2A_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 37) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfig2A_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfig2A_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 svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 37) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfig2A_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfig2A_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfig2A *object = (struct svcctl_ChangeServiceConfig2A *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 37) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfig2A_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfig2A_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfig2A_ndr_print(py_obj, "svcctl_ChangeServiceConfig2A_in", NDR_IN); } static PyObject *py_svcctl_ChangeServiceConfig2A_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfig2A_ndr_print(py_obj, "svcctl_ChangeServiceConfig2A_out", NDR_OUT); } static PyMethodDef py_svcctl_ChangeServiceConfig2A_methods[] = { { "opnum", (PyCFunction)py_svcctl_ChangeServiceConfig2A_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.ChangeServiceConfig2A.opnum() -> 36 (0x24) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_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_svcctl_ChangeServiceConfig2A_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_ChangeServiceConfig2A_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_ChangeServiceConfig2A_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ChangeServiceConfig2A", .tp_getset = py_svcctl_ChangeServiceConfig2A_getsetters, .tp_methods = py_svcctl_ChangeServiceConfig2A_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_ChangeServiceConfig2A_new, }; static bool pack_py_svcctl_ChangeServiceConfig2A_args_in(PyObject *args, PyObject *kwargs, struct svcctl_ChangeServiceConfig2A *r) { PyObject *py_handle; PyObject *py_info_level; PyObject *py_info; const char *kwnames[] = { "handle", "info_level", "info", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_ChangeServiceConfig2A", discard_const_p(char *, kwnames), &py_handle, &py_info_level, &py_info)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_info_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info_level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.info_level)); if (PyLong_Check(py_info_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_info == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info"); return false; } if (py_info == Py_None) { r->in.info = NULL; } else { r->in.info = talloc_ptrtype(r, r->in.info); if (r->in.info == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.info)); if (PyLong_Check(py_info)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info); 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.info = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_ChangeServiceConfig2A_args_out(struct svcctl_ChangeServiceConfig2A *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_svcctl_ChangeServiceConfig2W_in_get_handle(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_ChangeServiceConfig2W_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_ChangeServiceConfig2W_in_get_info_level(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_info_level; py_info_level = PyLong_FromUnsignedLongLong((uint32_t)object->in.info_level); return py_info_level; } static int py_svcctl_ChangeServiceConfig2W_in_set_info_level(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info_level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_ChangeServiceConfig2W_in_get_info(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_info; if (object->in.info == NULL) { Py_RETURN_NONE; } if (object->in.info == NULL) { py_info = Py_None; Py_INCREF(py_info); } else { py_info = PyLong_FromLong((uint16_t)*object->in.info); } return py_info; } static int py_svcctl_ChangeServiceConfig2W_in_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.info)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info"); return -1; } if (value == Py_None) { object->in.info = NULL; } else { object->in.info = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.info); if (object->in.info == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.info)); 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.info = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_svcctl_ChangeServiceConfig2W_get_result(PyObject *obj, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_ChangeServiceConfig2W_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)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_svcctl_ChangeServiceConfig2W_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_ChangeServiceConfig2W_in_get_handle, .set = py_svcctl_ChangeServiceConfig2W_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_info_level"), .get = py_svcctl_ChangeServiceConfig2W_in_get_info_level, .set = py_svcctl_ChangeServiceConfig2W_in_set_info_level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_info"), .get = py_svcctl_ChangeServiceConfig2W_in_get_info, .set = py_svcctl_ChangeServiceConfig2W_in_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_ChangeServiceConfig2W_get_result, .set = py_svcctl_ChangeServiceConfig2W_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_ChangeServiceConfig2W_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_ChangeServiceConfig2W, type); struct svcctl_ChangeServiceConfig2W *_self = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); return self; } static PyObject *py_svcctl_ChangeServiceConfig2W_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(37); } static PyObject *py_svcctl_ChangeServiceConfig2W_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 38) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfig2W_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_ChangeServiceConfig2W_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 svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 38) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfig2W_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_ChangeServiceConfig2W_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_ChangeServiceConfig2W *object = (struct svcctl_ChangeServiceConfig2W *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 38) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_ChangeServiceConfig2W_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_ChangeServiceConfig2W_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfig2W_ndr_print(py_obj, "svcctl_ChangeServiceConfig2W_in", NDR_IN); } static PyObject *py_svcctl_ChangeServiceConfig2W_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_ChangeServiceConfig2W_ndr_print(py_obj, "svcctl_ChangeServiceConfig2W_out", NDR_OUT); } static PyMethodDef py_svcctl_ChangeServiceConfig2W_methods[] = { { "opnum", (PyCFunction)py_svcctl_ChangeServiceConfig2W_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.ChangeServiceConfig2W.opnum() -> 37 (0x25) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_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_svcctl_ChangeServiceConfig2W_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_ChangeServiceConfig2W_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_ChangeServiceConfig2W_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.ChangeServiceConfig2W", .tp_getset = py_svcctl_ChangeServiceConfig2W_getsetters, .tp_methods = py_svcctl_ChangeServiceConfig2W_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_ChangeServiceConfig2W_new, }; static bool pack_py_svcctl_ChangeServiceConfig2W_args_in(PyObject *args, PyObject *kwargs, struct svcctl_ChangeServiceConfig2W *r) { PyObject *py_handle; PyObject *py_info_level; PyObject *py_info; const char *kwnames[] = { "handle", "info_level", "info", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_ChangeServiceConfig2W", discard_const_p(char *, kwnames), &py_handle, &py_info_level, &py_info)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_info_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info_level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.info_level)); if (PyLong_Check(py_info_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_info == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info"); return false; } if (py_info == Py_None) { r->in.info = NULL; } else { r->in.info = talloc_ptrtype(r, r->in.info); if (r->in.info == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.info)); if (PyLong_Check(py_info)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info); 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.info = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_svcctl_ChangeServiceConfig2W_args_out(struct svcctl_ChangeServiceConfig2W *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_svcctl_QueryServiceConfig2A_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceConfig2A_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceConfig2A_in_get_info_level(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_info_level; py_info_level = PyLong_FromUnsignedLongLong((uint32_t)object->in.info_level); return py_info_level; } static int py_svcctl_QueryServiceConfig2A_in_set_info_level(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info_level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2A_out_get_buffer(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_buffer; py_buffer = PyList_New(object->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_0; for (buffer_cntr_0 = 0; buffer_cntr_0 < (object->in.offered); buffer_cntr_0++) { PyObject *py_buffer_0; py_buffer_0 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_0]); PyList_SetItem(py_buffer, buffer_cntr_0, py_buffer_0); } } return py_buffer; } static int py_svcctl_QueryServiceConfig2A_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int buffer_cntr_0; object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value)); if (!object->out.buffer) { return -1;; } talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer"); for (buffer_cntr_0 = 0; buffer_cntr_0 < PyList_GET_SIZE(value); buffer_cntr_0++) { if (PyList_GET_ITEM(value, buffer_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.buffer[buffer_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2A_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceConfig2A_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2A_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceConfig2A_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2A_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceConfig2A_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)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_svcctl_QueryServiceConfig2A_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceConfig2A_in_get_handle, .set = py_svcctl_QueryServiceConfig2A_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_info_level"), .get = py_svcctl_QueryServiceConfig2A_in_get_info_level, .set = py_svcctl_QueryServiceConfig2A_in_set_info_level, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ConfigLevel") }, { .name = discard_const_p(char, "out_buffer"), .get = py_svcctl_QueryServiceConfig2A_out_get_buffer, .set = py_svcctl_QueryServiceConfig2A_out_set_buffer, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceConfig2A_in_get_offered, .set = py_svcctl_QueryServiceConfig2A_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceConfig2A_out_get_needed, .set = py_svcctl_QueryServiceConfig2A_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceConfig2A_get_result, .set = py_svcctl_QueryServiceConfig2A_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceConfig2A_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceConfig2A, type); struct svcctl_QueryServiceConfig2A *_self = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceConfig2A_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(38); } static PyObject *py_svcctl_QueryServiceConfig2A_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 39) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfig2A_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfig2A_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 svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 39) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfig2A_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfig2A_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfig2A *object = (struct svcctl_QueryServiceConfig2A *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 39) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfig2A_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfig2A_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfig2A_ndr_print(py_obj, "svcctl_QueryServiceConfig2A_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceConfig2A_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfig2A_ndr_print(py_obj, "svcctl_QueryServiceConfig2A_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceConfig2A_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceConfig2A_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceConfig2A.opnum() -> 38 (0x26) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_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_svcctl_QueryServiceConfig2A_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceConfig2A_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceConfig2A_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceConfig2A", .tp_getset = py_svcctl_QueryServiceConfig2A_getsetters, .tp_methods = py_svcctl_QueryServiceConfig2A_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceConfig2A_new, }; static bool pack_py_svcctl_QueryServiceConfig2A_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceConfig2A *r) { PyObject *py_handle; PyObject *py_info_level; PyObject *py_offered; const char *kwnames[] = { "handle", "info_level", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_QueryServiceConfig2A", discard_const_p(char *, kwnames), &py_handle, &py_info_level, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_info_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info_level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.info_level)); if (PyLong_Check(py_info_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceConfig2A_args_out(struct svcctl_QueryServiceConfig2A *r) { PyObject *result; PyObject *py_buffer; PyObject *py_needed; result = PyTuple_New(2); py_buffer = PyList_New(r->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_0; for (buffer_cntr_0 = 0; buffer_cntr_0 < (r->in.offered); buffer_cntr_0++) { PyObject *py_buffer_0; py_buffer_0 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_0]); PyList_SetItem(py_buffer, buffer_cntr_0, py_buffer_0); } } PyTuple_SetItem(result, 0, py_buffer); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_QueryServiceConfig2W_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceConfig2W_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceConfig2W_in_get_info_level(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_info_level; py_info_level = PyLong_FromUnsignedLongLong((uint32_t)object->in.info_level); return py_info_level; } static int py_svcctl_QueryServiceConfig2W_in_set_info_level(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info_level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2W_out_get_buffer(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_buffer; if (object->out.buffer == NULL) { Py_RETURN_NONE; } py_buffer = PyList_New(object->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (object->in.offered); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } return py_buffer; } static int py_svcctl_QueryServiceConfig2W_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer"); return -1; } object->out.buffer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer); if (object->out.buffer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int buffer_cntr_1; object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value)); if (!object->out.buffer) { return -1;; } talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer"); for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) { if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.buffer[buffer_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2W_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceConfig2W_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2W_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceConfig2W_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceConfig2W_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceConfig2W_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)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_svcctl_QueryServiceConfig2W_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceConfig2W_in_get_handle, .set = py_svcctl_QueryServiceConfig2W_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_info_level"), .get = py_svcctl_QueryServiceConfig2W_in_get_info_level, .set = py_svcctl_QueryServiceConfig2W_in_set_info_level, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ConfigLevel") }, { .name = discard_const_p(char, "out_buffer"), .get = py_svcctl_QueryServiceConfig2W_out_get_buffer, .set = py_svcctl_QueryServiceConfig2W_out_set_buffer, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceConfig2W_in_get_offered, .set = py_svcctl_QueryServiceConfig2W_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceConfig2W_out_get_needed, .set = py_svcctl_QueryServiceConfig2W_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceConfig2W_get_result, .set = py_svcctl_QueryServiceConfig2W_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceConfig2W_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceConfig2W, type); struct svcctl_QueryServiceConfig2W *_self = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.buffer = talloc_zero(mem_ctx, uint8_t); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceConfig2W_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(39); } static PyObject *py_svcctl_QueryServiceConfig2W_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 40) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfig2W_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceConfig2W_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 svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 40) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfig2W_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceConfig2W_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceConfig2W *object = (struct svcctl_QueryServiceConfig2W *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 40) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceConfig2W_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceConfig2W_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfig2W_ndr_print(py_obj, "svcctl_QueryServiceConfig2W_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceConfig2W_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceConfig2W_ndr_print(py_obj, "svcctl_QueryServiceConfig2W_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceConfig2W_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceConfig2W_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceConfig2W.opnum() -> 39 (0x27) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_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_svcctl_QueryServiceConfig2W_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceConfig2W_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceConfig2W_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceConfig2W", .tp_getset = py_svcctl_QueryServiceConfig2W_getsetters, .tp_methods = py_svcctl_QueryServiceConfig2W_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceConfig2W_new, }; static bool pack_py_svcctl_QueryServiceConfig2W_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceConfig2W *r) { PyObject *py_handle; PyObject *py_info_level; PyObject *py_offered; const char *kwnames[] = { "handle", "info_level", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_QueryServiceConfig2W", discard_const_p(char *, kwnames), &py_handle, &py_info_level, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_info_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info_level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.info_level)); if (PyLong_Check(py_info_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceConfig2W_args_out(struct svcctl_QueryServiceConfig2W *r) { PyObject *result; PyObject *py_buffer; PyObject *py_needed; result = PyTuple_New(2); py_buffer = PyList_New(r->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (r->in.offered); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } PyTuple_SetItem(result, 0, py_buffer); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_svcctl_QueryServiceStatusEx_in_get_handle(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(obj); PyObject *py_handle; if (object->in.handle == NULL) { Py_RETURN_NONE; } py_handle = pytalloc_reference_ex(policy_handle_Type, object->in.handle, object->in.handle); return py_handle; } static int py_svcctl_QueryServiceStatusEx_in_set_handle(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.handle"); return -1; } object->in.handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.handle); if (object->in.handle == 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.handle = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_svcctl_QueryServiceStatusEx_in_get_info_level(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(obj); PyObject *py_info_level; py_info_level = PyLong_FromUnsignedLongLong((uint32_t)object->in.info_level); return py_info_level; } static int py_svcctl_QueryServiceStatusEx_in_set_info_level(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info_level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceStatusEx_out_get_buffer(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(obj); PyObject *py_buffer; if (object->out.buffer == NULL) { Py_RETURN_NONE; } py_buffer = PyList_New(object->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (object->in.offered); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)object->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } return py_buffer; } static int py_svcctl_QueryServiceStatusEx_out_set_buffer(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.buffer)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer"); return -1; } object->out.buffer = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer); if (object->out.buffer == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int buffer_cntr_1; object->out.buffer = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.buffer, PyList_GET_SIZE(value)); if (!object->out.buffer) { return -1;; } talloc_set_name_const(object->out.buffer, "ARRAY: object->out.buffer"); for (buffer_cntr_1 = 0; buffer_cntr_1 < PyList_GET_SIZE(value); buffer_cntr_1++) { if (PyList_GET_ITEM(value, buffer_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.buffer[buffer_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.buffer[buffer_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, buffer_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, buffer_cntr_1)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.buffer[buffer_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_svcctl_QueryServiceStatusEx_in_get_offered(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_svcctl_QueryServiceStatusEx_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceStatusEx_out_get_needed(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_svcctl_QueryServiceStatusEx_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_svcctl_QueryServiceStatusEx_get_result(PyObject *obj, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_svcctl_QueryServiceStatusEx_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)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_svcctl_QueryServiceStatusEx_getsetters[] = { { .name = discard_const_p(char, "in_handle"), .get = py_svcctl_QueryServiceStatusEx_in_get_handle, .set = py_svcctl_QueryServiceStatusEx_in_set_handle, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_info_level"), .get = py_svcctl_QueryServiceStatusEx_in_get_info_level, .set = py_svcctl_QueryServiceStatusEx_in_set_info_level, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_StatusLevel") }, { .name = discard_const_p(char, "out_buffer"), .get = py_svcctl_QueryServiceStatusEx_out_get_buffer, .set = py_svcctl_QueryServiceStatusEx_out_set_buffer, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_svcctl_QueryServiceStatusEx_in_get_offered, .set = py_svcctl_QueryServiceStatusEx_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_svcctl_QueryServiceStatusEx_out_get_needed, .set = py_svcctl_QueryServiceStatusEx_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "result"), .get = py_svcctl_QueryServiceStatusEx_get_result, .set = py_svcctl_QueryServiceStatusEx_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_svcctl_QueryServiceStatusEx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct svcctl_QueryServiceStatusEx, type); struct svcctl_QueryServiceStatusEx *_self = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.handle = talloc_zero(mem_ctx, struct policy_handle); _self->out.buffer = talloc_zero(mem_ctx, uint8_t); _self->out.needed = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_svcctl_QueryServiceStatusEx_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(40); } static PyObject *py_svcctl_QueryServiceStatusEx_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceStatusEx_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_svcctl_QueryServiceStatusEx_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 svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceStatusEx_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_svcctl_QueryServiceStatusEx_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct svcctl_QueryServiceStatusEx *object = (struct svcctl_QueryServiceStatusEx *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 41) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_svcctl_QueryServiceStatusEx_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_svcctl_QueryServiceStatusEx_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceStatusEx_ndr_print(py_obj, "svcctl_QueryServiceStatusEx_in", NDR_IN); } static PyObject *py_svcctl_QueryServiceStatusEx_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_svcctl_QueryServiceStatusEx_ndr_print(py_obj, "svcctl_QueryServiceStatusEx_out", NDR_OUT); } static PyMethodDef py_svcctl_QueryServiceStatusEx_methods[] = { { "opnum", (PyCFunction)py_svcctl_QueryServiceStatusEx_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.QueryServiceStatusEx.opnum() -> 40 (0x28) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_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_svcctl_QueryServiceStatusEx_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_svcctl_QueryServiceStatusEx_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject svcctl_QueryServiceStatusEx_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.QueryServiceStatusEx", .tp_getset = py_svcctl_QueryServiceStatusEx_getsetters, .tp_methods = py_svcctl_QueryServiceStatusEx_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_svcctl_QueryServiceStatusEx_new, }; static bool pack_py_svcctl_QueryServiceStatusEx_args_in(PyObject *args, PyObject *kwargs, struct svcctl_QueryServiceStatusEx *r) { PyObject *py_handle; PyObject *py_info_level; PyObject *py_offered; const char *kwnames[] = { "handle", "info_level", "offered", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:svcctl_QueryServiceStatusEx", discard_const_p(char *, kwnames), &py_handle, &py_info_level, &py_offered)) { return false; } if (py_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.handle"); return false; } r->in.handle = talloc_ptrtype(r, r->in.handle); if (r->in.handle == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_handle, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_handle)) == NULL) { PyErr_NoMemory(); return false; } r->in.handle = (struct policy_handle *)pytalloc_get_ptr(py_handle); if (py_info_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info_level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.info_level)); if (PyLong_Check(py_info_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_svcctl_QueryServiceStatusEx_args_out(struct svcctl_QueryServiceStatusEx *r) { PyObject *result; PyObject *py_buffer; PyObject *py_needed; result = PyTuple_New(2); py_buffer = PyList_New(r->in.offered); if (py_buffer == NULL) { return NULL; } { int buffer_cntr_1; for (buffer_cntr_1 = 0; buffer_cntr_1 < (r->in.offered); buffer_cntr_1++) { PyObject *py_buffer_1; py_buffer_1 = PyLong_FromLong((uint16_t)r->out.buffer[buffer_cntr_1]); PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1); } } PyTuple_SetItem(result, 0, py_buffer); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_EnumServicesStatusExA_in_get_scmanager(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_scmanager; if (object->in.scmanager == NULL) { Py_RETURN_NONE; } py_scmanager = pytalloc_reference_ex(policy_handle_Type, object->in.scmanager, object->in.scmanager); return py_scmanager; } static int py_EnumServicesStatusExA_in_set_scmanager(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.scmanager)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.scmanager"); return -1; } object->in.scmanager = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.scmanager); if (object->in.scmanager == 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.scmanager = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_EnumServicesStatusExA_in_get_info_level(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_info_level; py_info_level = PyLong_FromUnsignedLongLong((uint32_t)object->in.info_level); return py_info_level; } static int py_EnumServicesStatusExA_in_set_info_level(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info_level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExA_in_get_type(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_EnumServicesStatusExA_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)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_EnumServicesStatusExA_in_get_state(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_state; py_state = PyLong_FromUnsignedLongLong((uint32_t)object->in.state); return py_state; } static int py_EnumServicesStatusExA_in_set_state(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.state"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.state)); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExA_out_get_services(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_services; py_services = PyList_New(object->in.offered); if (py_services == NULL) { return NULL; } { int services_cntr_0; for (services_cntr_0 = 0; services_cntr_0 < (object->in.offered); services_cntr_0++) { PyObject *py_services_0; py_services_0 = PyLong_FromLong((uint16_t)object->out.services[services_cntr_0]); PyList_SetItem(py_services, services_cntr_0, py_services_0); } } return py_services; } static int py_EnumServicesStatusExA_out_set_services(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int services_cntr_0; object->out.services = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.services, PyList_GET_SIZE(value)); if (!object->out.services) { return -1;; } talloc_set_name_const(object->out.services, "ARRAY: object->out.services"); for (services_cntr_0 = 0; services_cntr_0 < PyList_GET_SIZE(value); services_cntr_0++) { if (PyList_GET_ITEM(value, services_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services[services_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.services[services_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, services_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, services_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->out.services[services_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_EnumServicesStatusExA_in_get_offered(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_EnumServicesStatusExA_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExA_out_get_needed(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_EnumServicesStatusExA_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExA_out_get_service_returned(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_service_returned; if (object->out.service_returned == NULL) { Py_RETURN_NONE; } py_service_returned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.service_returned); return py_service_returned; } static int py_EnumServicesStatusExA_out_set_service_returned(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.service_returned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service_returned"); return -1; } object->out.service_returned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service_returned); if (object->out.service_returned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.service_returned)); 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.service_returned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExA_in_get_resume_handle(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->in.resume_handle == NULL) { Py_RETURN_NONE; } if (object->in.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->in.resume_handle); } return py_resume_handle; } static int py_EnumServicesStatusExA_in_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.resume_handle"); return -1; } if (value == Py_None) { object->in.resume_handle = NULL; } else { object->in.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.resume_handle); if (object->in.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_EnumServicesStatusExA_out_get_resume_handle(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->out.resume_handle == NULL) { Py_RETURN_NONE; } if (object->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->out.resume_handle); } return py_resume_handle; } static int py_EnumServicesStatusExA_out_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.resume_handle"); return -1; } if (value == Py_None) { object->out.resume_handle = NULL; } else { object->out.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.resume_handle); if (object->out.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_EnumServicesStatusExA_out_get_group_name(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_group_name; if (object->out.group_name == NULL) { Py_RETURN_NONE; } if (*object->out.group_name == NULL) { py_group_name = Py_None; Py_INCREF(py_group_name); } else { if (*object->out.group_name == NULL) { py_group_name = Py_None; Py_INCREF(py_group_name); } else { py_group_name = PyUnicode_Decode(*object->out.group_name, strlen(*object->out.group_name), "utf-8", "ignore"); } } return py_group_name; } static int py_EnumServicesStatusExA_out_set_group_name(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.group_name)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.group_name"); return -1; } object->out.group_name = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.group_name); if (object->out.group_name == NULL) { PyErr_NoMemory(); return -1; } if (value == Py_None) { *object->out.group_name = NULL; } else { *object->out.group_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->out.group_name = talloc_str; } } return 0; } static PyObject *py_EnumServicesStatusExA_get_result(PyObject *obj, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_EnumServicesStatusExA_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)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_EnumServicesStatusExA_getsetters[] = { { .name = discard_const_p(char, "in_scmanager"), .get = py_EnumServicesStatusExA_in_get_scmanager, .set = py_EnumServicesStatusExA_in_set_scmanager, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_info_level"), .get = py_EnumServicesStatusExA_in_get_info_level, .set = py_EnumServicesStatusExA_in_set_info_level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_type"), .get = py_EnumServicesStatusExA_in_get_type, .set = py_EnumServicesStatusExA_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_state"), .get = py_EnumServicesStatusExA_in_get_state, .set = py_EnumServicesStatusExA_in_set_state, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceState") }, { .name = discard_const_p(char, "out_services"), .get = py_EnumServicesStatusExA_out_get_services, .set = py_EnumServicesStatusExA_out_set_services, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_EnumServicesStatusExA_in_get_offered, .set = py_EnumServicesStatusExA_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_EnumServicesStatusExA_out_get_needed, .set = py_EnumServicesStatusExA_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_service_returned"), .get = py_EnumServicesStatusExA_out_get_service_returned, .set = py_EnumServicesStatusExA_out_set_service_returned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_resume_handle"), .get = py_EnumServicesStatusExA_in_get_resume_handle, .set = py_EnumServicesStatusExA_in_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_resume_handle"), .get = py_EnumServicesStatusExA_out_get_resume_handle, .set = py_EnumServicesStatusExA_out_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_group_name"), .get = py_EnumServicesStatusExA_out_get_group_name, .set = py_EnumServicesStatusExA_out_set_group_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_EnumServicesStatusExA_get_result, .set = py_EnumServicesStatusExA_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_EnumServicesStatusExA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct EnumServicesStatusExA, type); struct EnumServicesStatusExA *_self = (struct EnumServicesStatusExA *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.scmanager = talloc_zero(mem_ctx, struct policy_handle); _self->out.needed = talloc_zero(mem_ctx, uint32_t); _self->out.service_returned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_EnumServicesStatusExA_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(41); } static PyObject *py_EnumServicesStatusExA_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_EnumServicesStatusExA_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_EnumServicesStatusExA_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_EnumServicesStatusExA_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_EnumServicesStatusExA_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_EnumServicesStatusExA_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_EnumServicesStatusExA_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 EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_EnumServicesStatusExA_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_EnumServicesStatusExA_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_EnumServicesStatusExA_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_EnumServicesStatusExA_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_EnumServicesStatusExA_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_EnumServicesStatusExA_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct EnumServicesStatusExA *object = (struct EnumServicesStatusExA *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 42) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_EnumServicesStatusExA_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_EnumServicesStatusExA_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_EnumServicesStatusExA_ndr_print(py_obj, "EnumServicesStatusExA_in", NDR_IN); } static PyObject *py_EnumServicesStatusExA_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_EnumServicesStatusExA_ndr_print(py_obj, "EnumServicesStatusExA_out", NDR_OUT); } static PyMethodDef py_EnumServicesStatusExA_methods[] = { { "opnum", (PyCFunction)py_EnumServicesStatusExA_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.EnumServicesStatusExA.opnum() -> 41 (0x29) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_EnumServicesStatusExA_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_EnumServicesStatusExA_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_EnumServicesStatusExA_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_EnumServicesStatusExA_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_EnumServicesStatusExA_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_EnumServicesStatusExA_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject EnumServicesStatusExA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.EnumServicesStatusExA", .tp_getset = py_EnumServicesStatusExA_getsetters, .tp_methods = py_EnumServicesStatusExA_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_EnumServicesStatusExA_new, }; static bool pack_py_EnumServicesStatusExA_args_in(PyObject *args, PyObject *kwargs, struct EnumServicesStatusExA *r) { PyObject *py_scmanager; PyObject *py_info_level; PyObject *py_type; PyObject *py_state; PyObject *py_offered; PyObject *py_resume_handle; const char *kwnames[] = { "scmanager", "info_level", "type", "state", "offered", "resume_handle", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOO:EnumServicesStatusExA", discard_const_p(char *, kwnames), &py_scmanager, &py_info_level, &py_type, &py_state, &py_offered, &py_resume_handle)) { return false; } if (py_scmanager == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.scmanager"); return false; } r->in.scmanager = talloc_ptrtype(r, r->in.scmanager); if (r->in.scmanager == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_scmanager, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_scmanager)) == NULL) { PyErr_NoMemory(); return false; } r->in.scmanager = (struct policy_handle *)pytalloc_get_ptr(py_scmanager); if (py_info_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info_level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.info_level)); if (PyLong_Check(py_info_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } 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_state == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.state"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.state)); if (PyLong_Check(py_state)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_state); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_resume_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.resume_handle"); return false; } if (py_resume_handle == Py_None) { r->in.resume_handle = NULL; } else { r->in.resume_handle = talloc_ptrtype(r, r->in.resume_handle); if (r->in.resume_handle == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.resume_handle)); if (PyLong_Check(py_resume_handle)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_resume_handle); 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.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } return true; } static PyObject *unpack_py_EnumServicesStatusExA_args_out(struct EnumServicesStatusExA *r) { PyObject *result; PyObject *py_services; PyObject *py_needed; PyObject *py_service_returned; PyObject *py_resume_handle; PyObject *py_group_name; result = PyTuple_New(5); py_services = PyList_New(r->in.offered); if (py_services == NULL) { return NULL; } { int services_cntr_0; for (services_cntr_0 = 0; services_cntr_0 < (r->in.offered); services_cntr_0++) { PyObject *py_services_0; py_services_0 = PyLong_FromLong((uint16_t)r->out.services[services_cntr_0]); PyList_SetItem(py_services, services_cntr_0, py_services_0); } } PyTuple_SetItem(result, 0, py_services); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); py_service_returned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.service_returned); PyTuple_SetItem(result, 2, py_service_returned); if (r->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*r->out.resume_handle); } PyTuple_SetItem(result, 3, py_resume_handle); if (*r->out.group_name == NULL) { py_group_name = Py_None; Py_INCREF(py_group_name); } else { if (*r->out.group_name == NULL) { py_group_name = Py_None; Py_INCREF(py_group_name); } else { py_group_name = PyUnicode_Decode(*r->out.group_name, strlen(*r->out.group_name), "utf-8", "ignore"); } } PyTuple_SetItem(result, 4, py_group_name); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } static PyObject *py_EnumServicesStatusExW_in_get_scmanager(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_scmanager; if (object->in.scmanager == NULL) { Py_RETURN_NONE; } py_scmanager = pytalloc_reference_ex(policy_handle_Type, object->in.scmanager, object->in.scmanager); return py_scmanager; } static int py_EnumServicesStatusExW_in_set_scmanager(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.scmanager)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.scmanager"); return -1; } object->in.scmanager = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.scmanager); if (object->in.scmanager == 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.scmanager = (struct policy_handle *)pytalloc_get_ptr(value); return 0; } static PyObject *py_EnumServicesStatusExW_in_get_info_level(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_info_level; py_info_level = PyLong_FromUnsignedLongLong((uint32_t)object->in.info_level); return py_info_level; } static int py_EnumServicesStatusExW_in_set_info_level(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.info_level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExW_in_get_type(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_type; py_type = PyLong_FromUnsignedLongLong((uint32_t)object->in.type); return py_type; } static int py_EnumServicesStatusExW_in_set_type(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)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_EnumServicesStatusExW_in_get_state(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_state; py_state = PyLong_FromUnsignedLongLong((uint32_t)object->in.state); return py_state; } static int py_EnumServicesStatusExW_in_set_state(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.state"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.state)); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExW_out_get_services(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_services; if (object->out.services == NULL) { Py_RETURN_NONE; } py_services = PyList_New(object->in.offered); if (py_services == NULL) { return NULL; } { int services_cntr_1; for (services_cntr_1 = 0; services_cntr_1 < (object->in.offered); services_cntr_1++) { PyObject *py_services_1; py_services_1 = PyLong_FromLong((uint16_t)object->out.services[services_cntr_1]); PyList_SetItem(py_services, services_cntr_1, py_services_1); } } return py_services; } static int py_EnumServicesStatusExW_out_set_services(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.services)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services"); return -1; } object->out.services = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.services); if (object->out.services == NULL) { PyErr_NoMemory(); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int services_cntr_1; object->out.services = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.services, PyList_GET_SIZE(value)); if (!object->out.services) { return -1;; } talloc_set_name_const(object->out.services, "ARRAY: object->out.services"); for (services_cntr_1 = 0; services_cntr_1 < PyList_GET_SIZE(value); services_cntr_1++) { if (PyList_GET_ITEM(value, services_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.services[services_cntr_1]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->out.services[services_cntr_1])); if (PyLong_Check(PyList_GET_ITEM(value, services_cntr_1))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, services_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.services[services_cntr_1] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_EnumServicesStatusExW_in_get_offered(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_offered; py_offered = PyLong_FromUnsignedLongLong((uint32_t)object->in.offered); return py_offered; } static int py_EnumServicesStatusExW_in_set_offered(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.offered"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.offered)); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExW_out_get_needed(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_needed; if (object->out.needed == NULL) { Py_RETURN_NONE; } py_needed = PyLong_FromUnsignedLongLong((uint32_t)*object->out.needed); return py_needed; } static int py_EnumServicesStatusExW_out_set_needed(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.needed)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.needed"); return -1; } object->out.needed = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.needed); if (object->out.needed == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.needed)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.needed = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExW_out_get_service_returned(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_service_returned; if (object->out.service_returned == NULL) { Py_RETURN_NONE; } py_service_returned = PyLong_FromUnsignedLongLong((uint32_t)*object->out.service_returned); return py_service_returned; } static int py_EnumServicesStatusExW_out_set_service_returned(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.service_returned)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.service_returned"); return -1; } object->out.service_returned = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.service_returned); if (object->out.service_returned == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.service_returned)); 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.service_returned = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_EnumServicesStatusExW_in_get_resume_handle(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->in.resume_handle == NULL) { Py_RETURN_NONE; } if (object->in.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->in.resume_handle); } return py_resume_handle; } static int py_EnumServicesStatusExW_in_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.resume_handle"); return -1; } if (value == Py_None) { object->in.resume_handle = NULL; } else { object->in.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.resume_handle); if (object->in.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->in.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_EnumServicesStatusExW_out_get_resume_handle(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_resume_handle; if (object->out.resume_handle == NULL) { Py_RETURN_NONE; } if (object->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*object->out.resume_handle); } return py_resume_handle; } static int py_EnumServicesStatusExW_out_set_resume_handle(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.resume_handle)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.resume_handle"); return -1; } if (value == Py_None) { object->out.resume_handle = NULL; } else { object->out.resume_handle = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.resume_handle); if (object->out.resume_handle == NULL) { PyErr_NoMemory(); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.resume_handle)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } *object->out.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } return 0; } static PyObject *py_EnumServicesStatusExW_in_get_group_name(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_group_name; if (object->in.group_name == NULL) { Py_RETURN_NONE; } if (object->in.group_name == NULL) { py_group_name = Py_None; Py_INCREF(py_group_name); } else { if (object->in.group_name == NULL) { py_group_name = Py_None; Py_INCREF(py_group_name); } else { py_group_name = PyUnicode_Decode(object->in.group_name, strlen(object->in.group_name), "utf-8", "ignore"); } } return py_group_name; } static int py_EnumServicesStatusExW_in_set_group_name(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.group_name"); return -1; } if (value == Py_None) { object->in.group_name = NULL; } else { object->in.group_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.group_name = talloc_str; } } return 0; } static PyObject *py_EnumServicesStatusExW_get_result(PyObject *obj, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_EnumServicesStatusExW_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)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_EnumServicesStatusExW_getsetters[] = { { .name = discard_const_p(char, "in_scmanager"), .get = py_EnumServicesStatusExW_in_get_scmanager, .set = py_EnumServicesStatusExW_in_set_scmanager, .doc = discard_const_p(char, "PIDL-generated element of base type policy_handle") }, { .name = discard_const_p(char, "in_info_level"), .get = py_EnumServicesStatusExW_in_get_info_level, .set = py_EnumServicesStatusExW_in_set_info_level, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_type"), .get = py_EnumServicesStatusExW_in_get_type, .set = py_EnumServicesStatusExW_in_set_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_state"), .get = py_EnumServicesStatusExW_in_get_state, .set = py_EnumServicesStatusExW_in_set_state, .doc = discard_const_p(char, "PIDL-generated element of base type svcctl_ServiceState") }, { .name = discard_const_p(char, "out_services"), .get = py_EnumServicesStatusExW_out_get_services, .set = py_EnumServicesStatusExW_out_set_services, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "in_offered"), .get = py_EnumServicesStatusExW_in_get_offered, .set = py_EnumServicesStatusExW_in_set_offered, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_needed"), .get = py_EnumServicesStatusExW_out_get_needed, .set = py_EnumServicesStatusExW_out_set_needed, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_service_returned"), .get = py_EnumServicesStatusExW_out_get_service_returned, .set = py_EnumServicesStatusExW_out_set_service_returned, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_resume_handle"), .get = py_EnumServicesStatusExW_in_get_resume_handle, .set = py_EnumServicesStatusExW_in_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "out_resume_handle"), .get = py_EnumServicesStatusExW_out_get_resume_handle, .set = py_EnumServicesStatusExW_out_set_resume_handle, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "in_group_name"), .get = py_EnumServicesStatusExW_in_get_group_name, .set = py_EnumServicesStatusExW_in_set_group_name, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "result"), .get = py_EnumServicesStatusExW_get_result, .set = py_EnumServicesStatusExW_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_EnumServicesStatusExW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct EnumServicesStatusExW, type); struct EnumServicesStatusExW *_self = (struct EnumServicesStatusExW *)pytalloc_get_ptr(self); TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self); _self->in.scmanager = talloc_zero(mem_ctx, struct policy_handle); _self->out.services = talloc_zero(mem_ctx, uint8_t); _self->out.needed = talloc_zero(mem_ctx, uint32_t); _self->out.service_returned = talloc_zero(mem_ctx, uint32_t); return self; } static PyObject *py_EnumServicesStatusExW_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(42); } static PyObject *py_EnumServicesStatusExW_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 43) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_EnumServicesStatusExW_ndr_pack"); return NULL; } call = &ndr_table_svcctl.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_EnumServicesStatusExW_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_EnumServicesStatusExW_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_EnumServicesStatusExW_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_EnumServicesStatusExW_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_EnumServicesStatusExW_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 EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_svcctl.num_calls < 43) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_EnumServicesStatusExW_ndr_unpack"); return NULL; } call = &ndr_table_svcctl.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_EnumServicesStatusExW_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_EnumServicesStatusExW_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_EnumServicesStatusExW_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_EnumServicesStatusExW_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_EnumServicesStatusExW_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct EnumServicesStatusExW *object = (struct EnumServicesStatusExW *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_svcctl.num_calls < 43) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_EnumServicesStatusExW_ndr_print"); return NULL; } call = &ndr_table_svcctl.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_EnumServicesStatusExW_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_EnumServicesStatusExW_ndr_print(py_obj, "EnumServicesStatusExW_in", NDR_IN); } static PyObject *py_EnumServicesStatusExW_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_EnumServicesStatusExW_ndr_print(py_obj, "EnumServicesStatusExW_out", NDR_OUT); } static PyMethodDef py_EnumServicesStatusExW_methods[] = { { "opnum", (PyCFunction)py_EnumServicesStatusExW_ndr_opnum, METH_NOARGS|METH_CLASS, "svcctl.EnumServicesStatusExW.opnum() -> 42 (0x2a) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_EnumServicesStatusExW_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_EnumServicesStatusExW_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_EnumServicesStatusExW_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_EnumServicesStatusExW_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_EnumServicesStatusExW_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_EnumServicesStatusExW_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject EnumServicesStatusExW_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.EnumServicesStatusExW", .tp_getset = py_EnumServicesStatusExW_getsetters, .tp_methods = py_EnumServicesStatusExW_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_EnumServicesStatusExW_new, }; static bool pack_py_EnumServicesStatusExW_args_in(PyObject *args, PyObject *kwargs, struct EnumServicesStatusExW *r) { PyObject *py_scmanager; PyObject *py_info_level; PyObject *py_type; PyObject *py_state; PyObject *py_offered; PyObject *py_resume_handle; PyObject *py_group_name; const char *kwnames[] = { "scmanager", "info_level", "type", "state", "offered", "resume_handle", "group_name", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOO:EnumServicesStatusExW", discard_const_p(char *, kwnames), &py_scmanager, &py_info_level, &py_type, &py_state, &py_offered, &py_resume_handle, &py_group_name)) { return false; } if (py_scmanager == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.scmanager"); return false; } r->in.scmanager = talloc_ptrtype(r, r->in.scmanager); if (r->in.scmanager == NULL) { PyErr_NoMemory(); return false; } PY_CHECK_TYPE(policy_handle_Type, py_scmanager, return false;); if (talloc_reference(r, pytalloc_get_mem_ctx(py_scmanager)) == NULL) { PyErr_NoMemory(); return false; } r->in.scmanager = (struct policy_handle *)pytalloc_get_ptr(py_scmanager); if (py_info_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.info_level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.info_level)); if (PyLong_Check(py_info_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_info_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.info_level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } 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_state == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.state"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.state)); if (PyLong_Check(py_state)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_state); 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.state = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_offered == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.offered"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.offered)); if (PyLong_Check(py_offered)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_offered); 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.offered = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } if (py_resume_handle == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.resume_handle"); return false; } if (py_resume_handle == Py_None) { r->in.resume_handle = NULL; } else { r->in.resume_handle = talloc_ptrtype(r, r->in.resume_handle); if (r->in.resume_handle == NULL) { PyErr_NoMemory(); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*r->in.resume_handle)); if (PyLong_Check(py_resume_handle)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_resume_handle); 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.resume_handle = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } } if (py_group_name == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.group_name"); return false; } if (py_group_name == Py_None) { r->in.group_name = NULL; } else { r->in.group_name = NULL; { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(py_group_name)) { unicode = PyUnicode_AsEncodedString(py_group_name, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return false; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(py_group_name)) { test_str = PyBytes_AS_STRING(py_group_name); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_group_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.group_name = talloc_str; } } return true; } static PyObject *unpack_py_EnumServicesStatusExW_args_out(struct EnumServicesStatusExW *r) { PyObject *result; PyObject *py_services; PyObject *py_needed; PyObject *py_service_returned; PyObject *py_resume_handle; result = PyTuple_New(4); py_services = PyList_New(r->in.offered); if (py_services == NULL) { return NULL; } { int services_cntr_1; for (services_cntr_1 = 0; services_cntr_1 < (r->in.offered); services_cntr_1++) { PyObject *py_services_1; py_services_1 = PyLong_FromLong((uint16_t)r->out.services[services_cntr_1]); PyList_SetItem(py_services, services_cntr_1, py_services_1); } } PyTuple_SetItem(result, 0, py_services); py_needed = PyLong_FromUnsignedLongLong((uint32_t)*r->out.needed); PyTuple_SetItem(result, 1, py_needed); py_service_returned = PyLong_FromUnsignedLongLong((uint32_t)*r->out.service_returned); PyTuple_SetItem(result, 2, py_service_returned); if (r->out.resume_handle == NULL) { py_resume_handle = Py_None; Py_INCREF(py_resume_handle); } else { py_resume_handle = PyLong_FromUnsignedLongLong((uint32_t)*r->out.resume_handle); } PyTuple_SetItem(result, 3, py_resume_handle); if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } const struct PyNdrRpcMethodDef py_ndr_svcctl_methods[] = { { "CloseServiceHandle", "S.CloseServiceHandle(handle) -> handle", (py_dcerpc_call_fn)dcerpc_svcctl_CloseServiceHandle_r, (py_data_pack_fn)pack_py_svcctl_CloseServiceHandle_args_in, (py_data_unpack_fn)unpack_py_svcctl_CloseServiceHandle_args_out, 0, &ndr_table_svcctl }, { "ControlService", "S.ControlService(handle, control) -> service_status", (py_dcerpc_call_fn)dcerpc_svcctl_ControlService_r, (py_data_pack_fn)pack_py_svcctl_ControlService_args_in, (py_data_unpack_fn)unpack_py_svcctl_ControlService_args_out, 1, &ndr_table_svcctl }, { "DeleteService", "S.DeleteService(handle) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_DeleteService_r, (py_data_pack_fn)pack_py_svcctl_DeleteService_args_in, (py_data_unpack_fn)unpack_py_svcctl_DeleteService_args_out, 2, &ndr_table_svcctl }, { "LockServiceDatabase", "S.LockServiceDatabase(handle) -> lock", (py_dcerpc_call_fn)dcerpc_svcctl_LockServiceDatabase_r, (py_data_pack_fn)pack_py_svcctl_LockServiceDatabase_args_in, (py_data_unpack_fn)unpack_py_svcctl_LockServiceDatabase_args_out, 3, &ndr_table_svcctl }, { "QueryServiceObjectSecurity", "S.QueryServiceObjectSecurity(handle, security_flags, offered) -> (buffer, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceObjectSecurity_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceObjectSecurity_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceObjectSecurity_args_out, 4, &ndr_table_svcctl }, { "SetServiceObjectSecurity", "S.SetServiceObjectSecurity(handle, security_flags, buffer) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_SetServiceObjectSecurity_r, (py_data_pack_fn)pack_py_svcctl_SetServiceObjectSecurity_args_in, (py_data_unpack_fn)unpack_py_svcctl_SetServiceObjectSecurity_args_out, 5, &ndr_table_svcctl }, { "QueryServiceStatus", "S.QueryServiceStatus(handle) -> service_status", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceStatus_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceStatus_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceStatus_args_out, 6, &ndr_table_svcctl }, { "UnlockServiceDatabase", "S.UnlockServiceDatabase(lock) -> lock", (py_dcerpc_call_fn)dcerpc_svcctl_UnlockServiceDatabase_r, (py_data_pack_fn)pack_py_svcctl_UnlockServiceDatabase_args_in, (py_data_unpack_fn)unpack_py_svcctl_UnlockServiceDatabase_args_out, 8, &ndr_table_svcctl }, { "SCSetServiceBitsW", "S.SCSetServiceBitsW(handle, bits, bitson, immediate) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_SCSetServiceBitsW_r, (py_data_pack_fn)pack_py_svcctl_SCSetServiceBitsW_args_in, (py_data_unpack_fn)unpack_py_svcctl_SCSetServiceBitsW_args_out, 10, &ndr_table_svcctl }, { "ChangeServiceConfigW", "S.ChangeServiceConfigW(handle, type, start_type, error_control, binary_path, load_order_group, tag_id, dependencies, service_start_name, password, display_name) -> tag_id", (py_dcerpc_call_fn)dcerpc_svcctl_ChangeServiceConfigW_r, (py_data_pack_fn)pack_py_svcctl_ChangeServiceConfigW_args_in, (py_data_unpack_fn)unpack_py_svcctl_ChangeServiceConfigW_args_out, 11, &ndr_table_svcctl }, { "CreateServiceW", "S.CreateServiceW(scmanager_handle, ServiceName, DisplayName, desired_access, type, start_type, error_control, binary_path, LoadOrderGroupKey, TagId, dependencies, service_start_name, password) -> (TagId, handle)", (py_dcerpc_call_fn)dcerpc_svcctl_CreateServiceW_r, (py_data_pack_fn)pack_py_svcctl_CreateServiceW_args_in, (py_data_unpack_fn)unpack_py_svcctl_CreateServiceW_args_out, 12, &ndr_table_svcctl }, { "EnumDependentServicesW", "S.EnumDependentServicesW(service, state, offered) -> (service_status, needed, services_returned)", (py_dcerpc_call_fn)dcerpc_svcctl_EnumDependentServicesW_r, (py_data_pack_fn)pack_py_svcctl_EnumDependentServicesW_args_in, (py_data_unpack_fn)unpack_py_svcctl_EnumDependentServicesW_args_out, 13, &ndr_table_svcctl }, { "EnumServicesStatusW", "S.EnumServicesStatusW(handle, type, state, offered, resume_handle) -> (service, needed, services_returned, resume_handle)", (py_dcerpc_call_fn)dcerpc_svcctl_EnumServicesStatusW_r, (py_data_pack_fn)pack_py_svcctl_EnumServicesStatusW_args_in, (py_data_unpack_fn)unpack_py_svcctl_EnumServicesStatusW_args_out, 14, &ndr_table_svcctl }, { "OpenSCManagerW", "S.OpenSCManagerW(MachineName, DatabaseName, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_svcctl_OpenSCManagerW_r, (py_data_pack_fn)pack_py_svcctl_OpenSCManagerW_args_in, (py_data_unpack_fn)unpack_py_svcctl_OpenSCManagerW_args_out, 15, &ndr_table_svcctl }, { "OpenServiceW", "S.OpenServiceW(scmanager_handle, ServiceName, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_svcctl_OpenServiceW_r, (py_data_pack_fn)pack_py_svcctl_OpenServiceW_args_in, (py_data_unpack_fn)unpack_py_svcctl_OpenServiceW_args_out, 16, &ndr_table_svcctl }, { "QueryServiceConfigW", "S.QueryServiceConfigW(handle, offered) -> (query, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceConfigW_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceConfigW_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceConfigW_args_out, 17, &ndr_table_svcctl }, { "QueryServiceLockStatusW", "S.QueryServiceLockStatusW(handle, offered) -> (lock_status, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceLockStatusW_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceLockStatusW_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceLockStatusW_args_out, 18, &ndr_table_svcctl }, { "StartServiceW", "S.StartServiceW(handle, Arguments) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_StartServiceW_r, (py_data_pack_fn)pack_py_svcctl_StartServiceW_args_in, (py_data_unpack_fn)unpack_py_svcctl_StartServiceW_args_out, 19, &ndr_table_svcctl }, { "GetServiceDisplayNameW", "S.GetServiceDisplayNameW(handle, service_name, display_name_length) -> (display_name, display_name_length)", (py_dcerpc_call_fn)dcerpc_svcctl_GetServiceDisplayNameW_r, (py_data_pack_fn)pack_py_svcctl_GetServiceDisplayNameW_args_in, (py_data_unpack_fn)unpack_py_svcctl_GetServiceDisplayNameW_args_out, 20, &ndr_table_svcctl }, { "GetServiceKeyNameW", "S.GetServiceKeyNameW(handle, service_name, display_name_length) -> (key_name, display_name_length)", (py_dcerpc_call_fn)dcerpc_svcctl_GetServiceKeyNameW_r, (py_data_pack_fn)pack_py_svcctl_GetServiceKeyNameW_args_in, (py_data_unpack_fn)unpack_py_svcctl_GetServiceKeyNameW_args_out, 21, &ndr_table_svcctl }, { "SCSetServiceBitsA", "S.SCSetServiceBitsA(handle, bits, bitson, immediate) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_SCSetServiceBitsA_r, (py_data_pack_fn)pack_py_svcctl_SCSetServiceBitsA_args_in, (py_data_unpack_fn)unpack_py_svcctl_SCSetServiceBitsA_args_out, 22, &ndr_table_svcctl }, { "ChangeServiceConfigA", "S.ChangeServiceConfigA(handle, type, start_type, error_control, binary_path, load_order_group, dependencies, service_start_name, password, display_name) -> tag_id", (py_dcerpc_call_fn)dcerpc_svcctl_ChangeServiceConfigA_r, (py_data_pack_fn)pack_py_svcctl_ChangeServiceConfigA_args_in, (py_data_unpack_fn)unpack_py_svcctl_ChangeServiceConfigA_args_out, 23, &ndr_table_svcctl }, { "CreateServiceA", "S.CreateServiceA(handle, ServiceName, DisplayName, desired_access, type, start_type, error_control, binary_path, LoadOrderGroupKey, dependencies, service_start_name, password) -> TagId", (py_dcerpc_call_fn)dcerpc_svcctl_CreateServiceA_r, (py_data_pack_fn)pack_py_svcctl_CreateServiceA_args_in, (py_data_unpack_fn)unpack_py_svcctl_CreateServiceA_args_out, 24, &ndr_table_svcctl }, { "EnumDependentServicesA", "S.EnumDependentServicesA(service, state, offered) -> (service_status, needed, services_returned)", (py_dcerpc_call_fn)dcerpc_svcctl_EnumDependentServicesA_r, (py_data_pack_fn)pack_py_svcctl_EnumDependentServicesA_args_in, (py_data_unpack_fn)unpack_py_svcctl_EnumDependentServicesA_args_out, 25, &ndr_table_svcctl }, { "EnumServicesStatusA", "S.EnumServicesStatusA(handle, type, state, offered, resume_handle) -> (service, needed, services_returned, resume_handle)", (py_dcerpc_call_fn)dcerpc_svcctl_EnumServicesStatusA_r, (py_data_pack_fn)pack_py_svcctl_EnumServicesStatusA_args_in, (py_data_unpack_fn)unpack_py_svcctl_EnumServicesStatusA_args_out, 26, &ndr_table_svcctl }, { "OpenSCManagerA", "S.OpenSCManagerA(MachineName, DatabaseName, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_svcctl_OpenSCManagerA_r, (py_data_pack_fn)pack_py_svcctl_OpenSCManagerA_args_in, (py_data_unpack_fn)unpack_py_svcctl_OpenSCManagerA_args_out, 27, &ndr_table_svcctl }, { "OpenServiceA", "S.OpenServiceA(scmanager_handle, ServiceName, access_mask) -> handle", (py_dcerpc_call_fn)dcerpc_svcctl_OpenServiceA_r, (py_data_pack_fn)pack_py_svcctl_OpenServiceA_args_in, (py_data_unpack_fn)unpack_py_svcctl_OpenServiceA_args_out, 28, &ndr_table_svcctl }, { "QueryServiceConfigA", "S.QueryServiceConfigA(handle, offered) -> (query, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceConfigA_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceConfigA_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceConfigA_args_out, 29, &ndr_table_svcctl }, { "QueryServiceLockStatusA", "S.QueryServiceLockStatusA(handle, offered) -> (lock_status, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceLockStatusA_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceLockStatusA_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceLockStatusA_args_out, 30, &ndr_table_svcctl }, { "StartServiceA", "S.StartServiceA(handle, NumArgs, Arguments) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_StartServiceA_r, (py_data_pack_fn)pack_py_svcctl_StartServiceA_args_in, (py_data_unpack_fn)unpack_py_svcctl_StartServiceA_args_out, 31, &ndr_table_svcctl }, { "GetServiceDisplayNameA", "S.GetServiceDisplayNameA(handle, service_name, display_name_length) -> (display_name, display_name_length)", (py_dcerpc_call_fn)dcerpc_svcctl_GetServiceDisplayNameA_r, (py_data_pack_fn)pack_py_svcctl_GetServiceDisplayNameA_args_in, (py_data_unpack_fn)unpack_py_svcctl_GetServiceDisplayNameA_args_out, 32, &ndr_table_svcctl }, { "GetServiceKeyNameA", "S.GetServiceKeyNameA(handle, service_name, display_name_length) -> (key_name, display_name_length)", (py_dcerpc_call_fn)dcerpc_svcctl_GetServiceKeyNameA_r, (py_data_pack_fn)pack_py_svcctl_GetServiceKeyNameA_args_in, (py_data_unpack_fn)unpack_py_svcctl_GetServiceKeyNameA_args_out, 33, &ndr_table_svcctl }, { "ChangeServiceConfig2A", "S.ChangeServiceConfig2A(handle, info_level, info) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_ChangeServiceConfig2A_r, (py_data_pack_fn)pack_py_svcctl_ChangeServiceConfig2A_args_in, (py_data_unpack_fn)unpack_py_svcctl_ChangeServiceConfig2A_args_out, 36, &ndr_table_svcctl }, { "ChangeServiceConfig2W", "S.ChangeServiceConfig2W(handle, info_level, info) -> None", (py_dcerpc_call_fn)dcerpc_svcctl_ChangeServiceConfig2W_r, (py_data_pack_fn)pack_py_svcctl_ChangeServiceConfig2W_args_in, (py_data_unpack_fn)unpack_py_svcctl_ChangeServiceConfig2W_args_out, 37, &ndr_table_svcctl }, { "QueryServiceConfig2A", "S.QueryServiceConfig2A(handle, info_level, offered) -> (buffer, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceConfig2A_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceConfig2A_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceConfig2A_args_out, 38, &ndr_table_svcctl }, { "QueryServiceConfig2W", "S.QueryServiceConfig2W(handle, info_level, offered) -> (buffer, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceConfig2W_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceConfig2W_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceConfig2W_args_out, 39, &ndr_table_svcctl }, { "QueryServiceStatusEx", "S.QueryServiceStatusEx(handle, info_level, offered) -> (buffer, needed)", (py_dcerpc_call_fn)dcerpc_svcctl_QueryServiceStatusEx_r, (py_data_pack_fn)pack_py_svcctl_QueryServiceStatusEx_args_in, (py_data_unpack_fn)unpack_py_svcctl_QueryServiceStatusEx_args_out, 40, &ndr_table_svcctl }, { "EnumServicesStatusExA", "S.EnumServicesStatusExA(scmanager, info_level, type, state, offered, resume_handle) -> (services, needed, service_returned, resume_handle, group_name)", (py_dcerpc_call_fn)dcerpc_EnumServicesStatusExA_r, (py_data_pack_fn)pack_py_EnumServicesStatusExA_args_in, (py_data_unpack_fn)unpack_py_EnumServicesStatusExA_args_out, 41, &ndr_table_svcctl }, { "EnumServicesStatusExW", "S.EnumServicesStatusExW(scmanager, info_level, type, state, offered, resume_handle, group_name) -> (services, needed, service_returned, resume_handle)", (py_dcerpc_call_fn)dcerpc_EnumServicesStatusExW_r, (py_data_pack_fn)pack_py_EnumServicesStatusExW_args_in, (py_data_unpack_fn)unpack_py_EnumServicesStatusExW_args_out, 42, &ndr_table_svcctl }, {0} }; static PyObject *interface_svcctl_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_svcctl); } #define PY_DOC_SVCCTL "Service Control" static PyTypeObject svcctl_InterfaceType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.svcctl", .tp_basicsize = sizeof(dcerpc_InterfaceObject), .tp_doc = "svcctl(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_SVCCTL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = interface_svcctl_new, }; static PyObject *syntax_svcctl_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_svcctl.syntax_id); } #define PY_DOC_SVCCTL_SYNTAX "Service Control" static PyTypeObject svcctl_SyntaxType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "svcctl.svcctl_abstract_syntax", .tp_doc = "svcctl_abstract_syntax()\n"PY_DOC_SVCCTL_SYNTAX, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = syntax_svcctl_new, }; static PyMethodDef svcctl_methods[] = { { NULL, NULL, 0, NULL } }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "svcctl", .m_doc = "svcctl DCE/RPC", .m_size = -1, .m_methods = svcctl_methods, }; MODULE_INIT_FUNC(svcctl) { PyObject *m = NULL; PyObject *dep_samba_dcerpc_misc = NULL; PyObject *dep_samba_dcerpc_security = 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_talloc = PyImport_ImportModule("talloc"); if (dep_talloc == NULL) goto out; dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base"); if (dep_samba_dcerpc_base == NULL) goto out; BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject"); if (BaseObject_Type == NULL) goto out; policy_handle_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "policy_handle"); if (policy_handle_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; SERVICE_LOCK_STATUS_Type.tp_base = BaseObject_Type; SERVICE_LOCK_STATUS_Type.tp_basicsize = pytalloc_BaseObject_size(); SERVICE_STATUS_Type.tp_base = BaseObject_Type; SERVICE_STATUS_Type.tp_basicsize = pytalloc_BaseObject_size(); SERVICE_STATUS_PROCESS_Type.tp_base = BaseObject_Type; SERVICE_STATUS_PROCESS_Type.tp_basicsize = pytalloc_BaseObject_size(); ENUM_SERVICE_STATUSW_Type.tp_base = BaseObject_Type; ENUM_SERVICE_STATUSW_Type.tp_basicsize = pytalloc_BaseObject_size(); ENUM_SERVICE_STATUSA_Type.tp_base = BaseObject_Type; ENUM_SERVICE_STATUSA_Type.tp_basicsize = pytalloc_BaseObject_size(); QUERY_SERVICE_CONFIG_Type.tp_base = BaseObject_Type; QUERY_SERVICE_CONFIG_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_ArgumentString_Type.tp_base = BaseObject_Type; svcctl_ArgumentString_Type.tp_basicsize = pytalloc_BaseObject_size(); SERVICE_DESCRIPTION_Type.tp_base = BaseObject_Type; SERVICE_DESCRIPTION_Type.tp_basicsize = pytalloc_BaseObject_size(); SC_ACTION_Type.tp_base = BaseObject_Type; SC_ACTION_Type.tp_basicsize = pytalloc_BaseObject_size(); SERVICE_FAILURE_ACTIONS_Type.tp_base = BaseObject_Type; SERVICE_FAILURE_ACTIONS_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_CloseServiceHandle_Type.tp_base = BaseObject_Type; svcctl_CloseServiceHandle_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_ControlService_Type.tp_base = BaseObject_Type; svcctl_ControlService_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_DeleteService_Type.tp_base = BaseObject_Type; svcctl_DeleteService_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_LockServiceDatabase_Type.tp_base = BaseObject_Type; svcctl_LockServiceDatabase_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceObjectSecurity_Type.tp_base = BaseObject_Type; svcctl_QueryServiceObjectSecurity_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_SetServiceObjectSecurity_Type.tp_base = BaseObject_Type; svcctl_SetServiceObjectSecurity_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceStatus_Type.tp_base = BaseObject_Type; svcctl_QueryServiceStatus_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_UnlockServiceDatabase_Type.tp_base = BaseObject_Type; svcctl_UnlockServiceDatabase_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_SCSetServiceBitsW_Type.tp_base = BaseObject_Type; svcctl_SCSetServiceBitsW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_ChangeServiceConfigW_Type.tp_base = BaseObject_Type; svcctl_ChangeServiceConfigW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_CreateServiceW_Type.tp_base = BaseObject_Type; svcctl_CreateServiceW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_EnumDependentServicesW_Type.tp_base = BaseObject_Type; svcctl_EnumDependentServicesW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_EnumServicesStatusW_Type.tp_base = BaseObject_Type; svcctl_EnumServicesStatusW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_OpenSCManagerW_Type.tp_base = BaseObject_Type; svcctl_OpenSCManagerW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_OpenServiceW_Type.tp_base = BaseObject_Type; svcctl_OpenServiceW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceConfigW_Type.tp_base = BaseObject_Type; svcctl_QueryServiceConfigW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceLockStatusW_Type.tp_base = BaseObject_Type; svcctl_QueryServiceLockStatusW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_StartServiceW_Type.tp_base = BaseObject_Type; svcctl_StartServiceW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_GetServiceDisplayNameW_Type.tp_base = BaseObject_Type; svcctl_GetServiceDisplayNameW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_GetServiceKeyNameW_Type.tp_base = BaseObject_Type; svcctl_GetServiceKeyNameW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_SCSetServiceBitsA_Type.tp_base = BaseObject_Type; svcctl_SCSetServiceBitsA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_ChangeServiceConfigA_Type.tp_base = BaseObject_Type; svcctl_ChangeServiceConfigA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_CreateServiceA_Type.tp_base = BaseObject_Type; svcctl_CreateServiceA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_EnumDependentServicesA_Type.tp_base = BaseObject_Type; svcctl_EnumDependentServicesA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_EnumServicesStatusA_Type.tp_base = BaseObject_Type; svcctl_EnumServicesStatusA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_OpenSCManagerA_Type.tp_base = BaseObject_Type; svcctl_OpenSCManagerA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_OpenServiceA_Type.tp_base = BaseObject_Type; svcctl_OpenServiceA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceConfigA_Type.tp_base = BaseObject_Type; svcctl_QueryServiceConfigA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceLockStatusA_Type.tp_base = BaseObject_Type; svcctl_QueryServiceLockStatusA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_StartServiceA_Type.tp_base = BaseObject_Type; svcctl_StartServiceA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_GetServiceDisplayNameA_Type.tp_base = BaseObject_Type; svcctl_GetServiceDisplayNameA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_GetServiceKeyNameA_Type.tp_base = BaseObject_Type; svcctl_GetServiceKeyNameA_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_ChangeServiceConfig2A_Type.tp_base = BaseObject_Type; svcctl_ChangeServiceConfig2A_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_ChangeServiceConfig2W_Type.tp_base = BaseObject_Type; svcctl_ChangeServiceConfig2W_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceConfig2A_Type.tp_base = BaseObject_Type; svcctl_QueryServiceConfig2A_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceConfig2W_Type.tp_base = BaseObject_Type; svcctl_QueryServiceConfig2W_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_QueryServiceStatusEx_Type.tp_base = BaseObject_Type; svcctl_QueryServiceStatusEx_Type.tp_basicsize = pytalloc_BaseObject_size(); EnumServicesStatusExA_Type.tp_base = BaseObject_Type; EnumServicesStatusExA_Type.tp_basicsize = pytalloc_BaseObject_size(); EnumServicesStatusExW_Type.tp_base = BaseObject_Type; EnumServicesStatusExW_Type.tp_basicsize = pytalloc_BaseObject_size(); svcctl_InterfaceType.tp_base = ClientConnection_Type; svcctl_SyntaxType.tp_base = ndr_syntax_id_Type; svcctl_SyntaxType.tp_basicsize = pytalloc_BaseObject_size(); if (PyType_Ready(&SERVICE_LOCK_STATUS_Type) < 0) goto out; if (PyType_Ready(&SERVICE_STATUS_Type) < 0) goto out; if (PyType_Ready(&SERVICE_STATUS_PROCESS_Type) < 0) goto out; if (PyType_Ready(&ENUM_SERVICE_STATUSW_Type) < 0) goto out; if (PyType_Ready(&ENUM_SERVICE_STATUSA_Type) < 0) goto out; if (PyType_Ready(&QUERY_SERVICE_CONFIG_Type) < 0) goto out; if (PyType_Ready(&svcctl_ArgumentString_Type) < 0) goto out; if (PyType_Ready(&SERVICE_DESCRIPTION_Type) < 0) goto out; if (PyType_Ready(&SC_ACTION_Type) < 0) goto out; if (PyType_Ready(&SERVICE_FAILURE_ACTIONS_Type) < 0) goto out; if (PyType_Ready(&svcctl_CloseServiceHandle_Type) < 0) goto out; if (PyType_Ready(&svcctl_ControlService_Type) < 0) goto out; if (PyType_Ready(&svcctl_DeleteService_Type) < 0) goto out; if (PyType_Ready(&svcctl_LockServiceDatabase_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceObjectSecurity_Type) < 0) goto out; if (PyType_Ready(&svcctl_SetServiceObjectSecurity_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceStatus_Type) < 0) goto out; if (PyType_Ready(&svcctl_UnlockServiceDatabase_Type) < 0) goto out; if (PyType_Ready(&svcctl_SCSetServiceBitsW_Type) < 0) goto out; if (PyType_Ready(&svcctl_ChangeServiceConfigW_Type) < 0) goto out; if (PyType_Ready(&svcctl_CreateServiceW_Type) < 0) goto out; if (PyType_Ready(&svcctl_EnumDependentServicesW_Type) < 0) goto out; if (PyType_Ready(&svcctl_EnumServicesStatusW_Type) < 0) goto out; if (PyType_Ready(&svcctl_OpenSCManagerW_Type) < 0) goto out; if (PyType_Ready(&svcctl_OpenServiceW_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceConfigW_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceLockStatusW_Type) < 0) goto out; if (PyType_Ready(&svcctl_StartServiceW_Type) < 0) goto out; if (PyType_Ready(&svcctl_GetServiceDisplayNameW_Type) < 0) goto out; if (PyType_Ready(&svcctl_GetServiceKeyNameW_Type) < 0) goto out; if (PyType_Ready(&svcctl_SCSetServiceBitsA_Type) < 0) goto out; if (PyType_Ready(&svcctl_ChangeServiceConfigA_Type) < 0) goto out; if (PyType_Ready(&svcctl_CreateServiceA_Type) < 0) goto out; if (PyType_Ready(&svcctl_EnumDependentServicesA_Type) < 0) goto out; if (PyType_Ready(&svcctl_EnumServicesStatusA_Type) < 0) goto out; if (PyType_Ready(&svcctl_OpenSCManagerA_Type) < 0) goto out; if (PyType_Ready(&svcctl_OpenServiceA_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceConfigA_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceLockStatusA_Type) < 0) goto out; if (PyType_Ready(&svcctl_StartServiceA_Type) < 0) goto out; if (PyType_Ready(&svcctl_GetServiceDisplayNameA_Type) < 0) goto out; if (PyType_Ready(&svcctl_GetServiceKeyNameA_Type) < 0) goto out; if (PyType_Ready(&svcctl_ChangeServiceConfig2A_Type) < 0) goto out; if (PyType_Ready(&svcctl_ChangeServiceConfig2W_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceConfig2A_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceConfig2W_Type) < 0) goto out; if (PyType_Ready(&svcctl_QueryServiceStatusEx_Type) < 0) goto out; if (PyType_Ready(&EnumServicesStatusExA_Type) < 0) goto out; if (PyType_Ready(&EnumServicesStatusExW_Type) < 0) goto out; if (PyType_Ready(&svcctl_InterfaceType) < 0) goto out; if (PyType_Ready(&svcctl_SyntaxType) < 0) goto out; if (!PyInterface_AddNdrRpcMethods(&svcctl_InterfaceType, py_ndr_svcctl_methods)) return NULL; #ifdef PY_SERVICE_LOCK_STATUS_PATCH PY_SERVICE_LOCK_STATUS_PATCH(&SERVICE_LOCK_STATUS_Type); #endif #ifdef PY_SERVICE_STATUS_PATCH PY_SERVICE_STATUS_PATCH(&SERVICE_STATUS_Type); #endif #ifdef PY_SERVICE_STATUS_PROCESS_PATCH PY_SERVICE_STATUS_PROCESS_PATCH(&SERVICE_STATUS_PROCESS_Type); #endif #ifdef PY_ENUM_SERVICE_STATUSW_PATCH PY_ENUM_SERVICE_STATUSW_PATCH(&ENUM_SERVICE_STATUSW_Type); #endif #ifdef PY_ENUM_SERVICE_STATUSA_PATCH PY_ENUM_SERVICE_STATUSA_PATCH(&ENUM_SERVICE_STATUSA_Type); #endif #ifdef PY_QUERY_SERVICE_CONFIG_PATCH PY_QUERY_SERVICE_CONFIG_PATCH(&QUERY_SERVICE_CONFIG_Type); #endif #ifdef PY_ARGUMENTSTRING_PATCH PY_ARGUMENTSTRING_PATCH(&svcctl_ArgumentString_Type); #endif #ifdef PY_SERVICE_DESCRIPTION_PATCH PY_SERVICE_DESCRIPTION_PATCH(&SERVICE_DESCRIPTION_Type); #endif #ifdef PY_SC_ACTION_PATCH PY_SC_ACTION_PATCH(&SC_ACTION_Type); #endif #ifdef PY_SERVICE_FAILURE_ACTIONS_PATCH PY_SERVICE_FAILURE_ACTIONS_PATCH(&SERVICE_FAILURE_ACTIONS_Type); #endif #ifdef PY_CLOSESERVICEHANDLE_PATCH PY_CLOSESERVICEHANDLE_PATCH(&svcctl_CloseServiceHandle_Type); #endif #ifdef PY_CONTROLSERVICE_PATCH PY_CONTROLSERVICE_PATCH(&svcctl_ControlService_Type); #endif #ifdef PY_DELETESERVICE_PATCH PY_DELETESERVICE_PATCH(&svcctl_DeleteService_Type); #endif #ifdef PY_LOCKSERVICEDATABASE_PATCH PY_LOCKSERVICEDATABASE_PATCH(&svcctl_LockServiceDatabase_Type); #endif #ifdef PY_QUERYSERVICEOBJECTSECURITY_PATCH PY_QUERYSERVICEOBJECTSECURITY_PATCH(&svcctl_QueryServiceObjectSecurity_Type); #endif #ifdef PY_SETSERVICEOBJECTSECURITY_PATCH PY_SETSERVICEOBJECTSECURITY_PATCH(&svcctl_SetServiceObjectSecurity_Type); #endif #ifdef PY_QUERYSERVICESTATUS_PATCH PY_QUERYSERVICESTATUS_PATCH(&svcctl_QueryServiceStatus_Type); #endif #ifdef PY_UNLOCKSERVICEDATABASE_PATCH PY_UNLOCKSERVICEDATABASE_PATCH(&svcctl_UnlockServiceDatabase_Type); #endif #ifdef PY_SCSETSERVICEBITSW_PATCH PY_SCSETSERVICEBITSW_PATCH(&svcctl_SCSetServiceBitsW_Type); #endif #ifdef PY_CHANGESERVICECONFIGW_PATCH PY_CHANGESERVICECONFIGW_PATCH(&svcctl_ChangeServiceConfigW_Type); #endif #ifdef PY_CREATESERVICEW_PATCH PY_CREATESERVICEW_PATCH(&svcctl_CreateServiceW_Type); #endif #ifdef PY_ENUMDEPENDENTSERVICESW_PATCH PY_ENUMDEPENDENTSERVICESW_PATCH(&svcctl_EnumDependentServicesW_Type); #endif #ifdef PY_ENUMSERVICESSTATUSW_PATCH PY_ENUMSERVICESSTATUSW_PATCH(&svcctl_EnumServicesStatusW_Type); #endif #ifdef PY_OPENSCMANAGERW_PATCH PY_OPENSCMANAGERW_PATCH(&svcctl_OpenSCManagerW_Type); #endif #ifdef PY_OPENSERVICEW_PATCH PY_OPENSERVICEW_PATCH(&svcctl_OpenServiceW_Type); #endif #ifdef PY_QUERYSERVICECONFIGW_PATCH PY_QUERYSERVICECONFIGW_PATCH(&svcctl_QueryServiceConfigW_Type); #endif #ifdef PY_QUERYSERVICELOCKSTATUSW_PATCH PY_QUERYSERVICELOCKSTATUSW_PATCH(&svcctl_QueryServiceLockStatusW_Type); #endif #ifdef PY_STARTSERVICEW_PATCH PY_STARTSERVICEW_PATCH(&svcctl_StartServiceW_Type); #endif #ifdef PY_GETSERVICEDISPLAYNAMEW_PATCH PY_GETSERVICEDISPLAYNAMEW_PATCH(&svcctl_GetServiceDisplayNameW_Type); #endif #ifdef PY_GETSERVICEKEYNAMEW_PATCH PY_GETSERVICEKEYNAMEW_PATCH(&svcctl_GetServiceKeyNameW_Type); #endif #ifdef PY_SCSETSERVICEBITSA_PATCH PY_SCSETSERVICEBITSA_PATCH(&svcctl_SCSetServiceBitsA_Type); #endif #ifdef PY_CHANGESERVICECONFIGA_PATCH PY_CHANGESERVICECONFIGA_PATCH(&svcctl_ChangeServiceConfigA_Type); #endif #ifdef PY_CREATESERVICEA_PATCH PY_CREATESERVICEA_PATCH(&svcctl_CreateServiceA_Type); #endif #ifdef PY_ENUMDEPENDENTSERVICESA_PATCH PY_ENUMDEPENDENTSERVICESA_PATCH(&svcctl_EnumDependentServicesA_Type); #endif #ifdef PY_ENUMSERVICESSTATUSA_PATCH PY_ENUMSERVICESSTATUSA_PATCH(&svcctl_EnumServicesStatusA_Type); #endif #ifdef PY_OPENSCMANAGERA_PATCH PY_OPENSCMANAGERA_PATCH(&svcctl_OpenSCManagerA_Type); #endif #ifdef PY_OPENSERVICEA_PATCH PY_OPENSERVICEA_PATCH(&svcctl_OpenServiceA_Type); #endif #ifdef PY_QUERYSERVICECONFIGA_PATCH PY_QUERYSERVICECONFIGA_PATCH(&svcctl_QueryServiceConfigA_Type); #endif #ifdef PY_QUERYSERVICELOCKSTATUSA_PATCH PY_QUERYSERVICELOCKSTATUSA_PATCH(&svcctl_QueryServiceLockStatusA_Type); #endif #ifdef PY_STARTSERVICEA_PATCH PY_STARTSERVICEA_PATCH(&svcctl_StartServiceA_Type); #endif #ifdef PY_GETSERVICEDISPLAYNAMEA_PATCH PY_GETSERVICEDISPLAYNAMEA_PATCH(&svcctl_GetServiceDisplayNameA_Type); #endif #ifdef PY_GETSERVICEKEYNAMEA_PATCH PY_GETSERVICEKEYNAMEA_PATCH(&svcctl_GetServiceKeyNameA_Type); #endif #ifdef PY_CHANGESERVICECONFIG2A_PATCH PY_CHANGESERVICECONFIG2A_PATCH(&svcctl_ChangeServiceConfig2A_Type); #endif #ifdef PY_CHANGESERVICECONFIG2W_PATCH PY_CHANGESERVICECONFIG2W_PATCH(&svcctl_ChangeServiceConfig2W_Type); #endif #ifdef PY_QUERYSERVICECONFIG2A_PATCH PY_QUERYSERVICECONFIG2A_PATCH(&svcctl_QueryServiceConfig2A_Type); #endif #ifdef PY_QUERYSERVICECONFIG2W_PATCH PY_QUERYSERVICECONFIG2W_PATCH(&svcctl_QueryServiceConfig2W_Type); #endif #ifdef PY_QUERYSERVICESTATUSEX_PATCH PY_QUERYSERVICESTATUSEX_PATCH(&svcctl_QueryServiceStatusEx_Type); #endif #ifdef PY_ENUMSERVICESSTATUSEXA_PATCH PY_ENUMSERVICESSTATUSEXA_PATCH(&EnumServicesStatusExA_Type); #endif #ifdef PY_ENUMSERVICESSTATUSEXW_PATCH PY_ENUMSERVICESSTATUSEXW_PATCH(&EnumServicesStatusExW_Type); #endif #ifdef PY_SVCCTL_PATCH PY_SVCCTL_PATCH(&svcctl_InterfaceType); #endif #ifdef PY_SVCCTL_ABSTRACT_SYNTAX_PATCH PY_SVCCTL_ABSTRACT_SYNTAX_PATCH(&svcctl_SyntaxType); #endif #ifdef PY_ABSTRACT_SYNTAX_PATCH PY_ABSTRACT_SYNTAX_PATCH(&svcctl_SyntaxType); #endif m = PyModule_Create(&moduledef); if (m == NULL) goto out; PyModule_AddObject(m, "MAX_SERVICE_NAME_LENGTH", PyLong_FromUnsignedLongLong(256)); PyModule_AddObject(m, "SC_MAX_DEPEND_SIZE", PyLong_FromLong(4*1024)); PyModule_AddObject(m, "SC_MAX_NAME_LENGTH", PyLong_FromLong(MAX_SERVICE_NAME_LENGTH+1)); PyModule_AddObject(m, "SC_MAX_PATH_LENGTH", PyLong_FromLong(32*1024)); PyModule_AddObject(m, "SC_MAX_PWD_SIZE", PyLong_FromUnsignedLongLong(514)); PyModule_AddObject(m, "SC_MAX_COMPUTER_NAME_LENGTH", PyLong_FromUnsignedLongLong(1024)); PyModule_AddObject(m, "SC_MAX_ACCOUNT_NAME_LENGTH", PyLong_FromLong(2*1024)); PyModule_AddObject(m, "SC_MAX_COMMENT_LENGTH", PyLong_FromUnsignedLongLong(128)); PyModule_AddObject(m, "SC_MAX_ARGUMENT_LENGTH", PyLong_FromUnsignedLongLong(1024)); PyModule_AddObject(m, "SC_MAX_ARGUMENTS", PyLong_FromUnsignedLongLong(1024)); PyModule_AddObject(m, "SVCCTL_ACCEPT_NONE", PyLong_FromUnsignedLongLong(0x00000000)); PyModule_AddObject(m, "SERVICE_TYPE_KERNEL_DRIVER", PyLong_FromUnsignedLongLong(0x01)); PyModule_AddObject(m, "SERVICE_TYPE_FS_DRIVER", PyLong_FromUnsignedLongLong(0x02)); PyModule_AddObject(m, "SERVICE_TYPE_ADAPTER", PyLong_FromUnsignedLongLong(0x04)); PyModule_AddObject(m, "SERVICE_TYPE_RECOGNIZER_DRIVER", PyLong_FromUnsignedLongLong(0x08)); PyModule_AddObject(m, "SERVICE_TYPE_DRIVER", PyLong_FromLong(SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER)); PyModule_AddObject(m, "SERVICE_TYPE_WIN32_OWN_PROCESS", PyLong_FromUnsignedLongLong(0x10)); PyModule_AddObject(m, "SERVICE_TYPE_WIN32_SHARE_PROCESS", PyLong_FromUnsignedLongLong(0x20)); PyModule_AddObject(m, "SERVICE_TYPE_WIN32", PyLong_FromLong(SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS)); PyModule_AddObject(m, "SERVICE_TYPE_INTERACTIVE_PROCESS", PyLong_FromUnsignedLongLong(0x100)); PyModule_AddObject(m, "SC_MANAGER_READ_ACCESS", PyLong_FromLong((SEC_STD_READ_CONTROL|SC_RIGHT_MGR_CONNECT|SC_RIGHT_MGR_ENUMERATE_SERVICE|SC_RIGHT_MGR_QUERY_LOCK_STATUS))); PyModule_AddObject(m, "SC_MANAGER_EXECUTE_ACCESS", PyLong_FromLong(SC_MANAGER_READ_ACCESS)); PyModule_AddObject(m, "SC_MANAGER_WRITE_ACCESS", PyLong_FromLong((SEC_STD_REQUIRED|SC_MANAGER_READ_ACCESS|SC_RIGHT_MGR_CREATE_SERVICE|SC_RIGHT_MGR_LOCK|SC_RIGHT_MGR_MODIFY_BOOT_CONFIG))); PyModule_AddObject(m, "SC_MANAGER_ALL_ACCESS", PyLong_FromLong(SC_MANAGER_WRITE_ACCESS)); PyModule_AddObject(m, "SERVICE_READ_ACCESS", PyLong_FromLong((SEC_STD_READ_CONTROL|SC_RIGHT_SVC_ENUMERATE_DEPENDENTS|SC_RIGHT_SVC_INTERROGATE|SC_RIGHT_SVC_QUERY_CONFIG|SC_RIGHT_SVC_QUERY_STATUS|SC_RIGHT_SVC_USER_DEFINED_CONTROL))); PyModule_AddObject(m, "SERVICE_EXECUTE_ACCESS", PyLong_FromLong((SERVICE_READ_ACCESS|SC_RIGHT_SVC_START|SC_RIGHT_SVC_STOP|SC_RIGHT_SVC_PAUSE_CONTINUE))); PyModule_AddObject(m, "SERVICE_WRITE_ACCESS", PyLong_FromLong((SEC_STD_REQUIRED|SERVICE_READ_ACCESS|SERVICE_EXECUTE_ACCESS|SC_RIGHT_SVC_CHANGE_CONFIG))); PyModule_AddObject(m, "SERVICE_ALL_ACCESS", PyLong_FromLong(SERVICE_WRITE_ACCESS)); PyModule_AddObject(m, "SVCCTL_STATE_UNKNOWN", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_STATE_UNKNOWN)); PyModule_AddObject(m, "SVCCTL_STOPPED", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_STOPPED)); PyModule_AddObject(m, "SVCCTL_START_PENDING", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_START_PENDING)); PyModule_AddObject(m, "SVCCTL_STOP_PENDING", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_STOP_PENDING)); PyModule_AddObject(m, "SVCCTL_RUNNING", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_RUNNING)); PyModule_AddObject(m, "SVCCTL_CONTINUE_PENDING", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_CONTINUE_PENDING)); PyModule_AddObject(m, "SVCCTL_PAUSE_PENDING", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_PAUSE_PENDING)); PyModule_AddObject(m, "SVCCTL_PAUSED", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_PAUSED)); PyModule_AddObject(m, "SVCCTL_ACCEPT_STOP", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_ACCEPT_STOP)); PyModule_AddObject(m, "SVCCTL_ACCEPT_PAUSE_CONTINUE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_ACCEPT_PAUSE_CONTINUE)); PyModule_AddObject(m, "SVCCTL_ACCEPT_SHUTDOWN", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_ACCEPT_SHUTDOWN)); PyModule_AddObject(m, "SVCCTL_ACCEPT_PARAMCHANGE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_ACCEPT_PARAMCHANGE)); PyModule_AddObject(m, "SVCCTL_ACCEPT_NETBINDCHANGE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_ACCEPT_NETBINDCHANGE)); PyModule_AddObject(m, "SVCCTL_ACCEPT_HARDWAREPROFILECHANGE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_ACCEPT_HARDWAREPROFILECHANGE)); PyModule_AddObject(m, "SVCCTL_ACCEPT_POWEREVENT", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_ACCEPT_POWEREVENT)); PyModule_AddObject(m, "SVCCTL_CONTROL_STOP", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_CONTROL_STOP)); PyModule_AddObject(m, "SVCCTL_CONTROL_PAUSE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_CONTROL_PAUSE)); PyModule_AddObject(m, "SVCCTL_CONTROL_CONTINUE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_CONTROL_CONTINUE)); PyModule_AddObject(m, "SVCCTL_CONTROL_INTERROGATE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_CONTROL_INTERROGATE)); PyModule_AddObject(m, "SVCCTL_CONTROL_SHUTDOWN", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_CONTROL_SHUTDOWN)); PyModule_AddObject(m, "SVCCTL_SVC_ERROR_IGNORE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_SVC_ERROR_IGNORE)); PyModule_AddObject(m, "SVCCTL_SVC_ERROR_NORMAL", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_SVC_ERROR_NORMAL)); PyModule_AddObject(m, "SVCCTL_SVC_ERROR_CRITICAL", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_SVC_ERROR_CRITICAL)); PyModule_AddObject(m, "SVCCTL_SVC_ERROR_SEVERE", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_SVC_ERROR_SEVERE)); PyModule_AddObject(m, "SVCCTL_BOOT_START", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_BOOT_START)); PyModule_AddObject(m, "SVCCTL_SYSTEM_START", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_SYSTEM_START)); PyModule_AddObject(m, "SVCCTL_AUTO_START", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_AUTO_START)); PyModule_AddObject(m, "SVCCTL_DEMAND_START", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_DEMAND_START)); PyModule_AddObject(m, "SVCCTL_DISABLED", PyLong_FromUnsignedLongLong((uint32_t)SVCCTL_DISABLED)); PyModule_AddObject(m, "SERVICE_STATE_ACTIVE", PyLong_FromUnsignedLongLong((uint32_t)SERVICE_STATE_ACTIVE)); PyModule_AddObject(m, "SERVICE_STATE_INACTIVE", PyLong_FromUnsignedLongLong((uint32_t)SERVICE_STATE_INACTIVE)); PyModule_AddObject(m, "SERVICE_STATE_ALL", PyLong_FromUnsignedLongLong((uint32_t)SERVICE_STATE_ALL)); PyModule_AddObject(m, "SC_RIGHT_MGR_CONNECT", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_MGR_CONNECT)); PyModule_AddObject(m, "SC_RIGHT_MGR_CREATE_SERVICE", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_MGR_CREATE_SERVICE)); PyModule_AddObject(m, "SC_RIGHT_MGR_ENUMERATE_SERVICE", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_MGR_ENUMERATE_SERVICE)); PyModule_AddObject(m, "SC_RIGHT_MGR_LOCK", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_MGR_LOCK)); PyModule_AddObject(m, "SC_RIGHT_MGR_QUERY_LOCK_STATUS", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_MGR_QUERY_LOCK_STATUS)); PyModule_AddObject(m, "SC_RIGHT_MGR_MODIFY_BOOT_CONFIG", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_MGR_MODIFY_BOOT_CONFIG)); PyModule_AddObject(m, "SC_RIGHT_SVC_QUERY_CONFIG", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_QUERY_CONFIG)); PyModule_AddObject(m, "SC_RIGHT_SVC_CHANGE_CONFIG", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_CHANGE_CONFIG)); PyModule_AddObject(m, "SC_RIGHT_SVC_QUERY_STATUS", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_QUERY_STATUS)); PyModule_AddObject(m, "SC_RIGHT_SVC_ENUMERATE_DEPENDENTS", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_ENUMERATE_DEPENDENTS)); PyModule_AddObject(m, "SC_RIGHT_SVC_START", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_START)); PyModule_AddObject(m, "SC_RIGHT_SVC_STOP", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_STOP)); PyModule_AddObject(m, "SC_RIGHT_SVC_PAUSE_CONTINUE", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_PAUSE_CONTINUE)); PyModule_AddObject(m, "SC_RIGHT_SVC_INTERROGATE", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_INTERROGATE)); PyModule_AddObject(m, "SC_RIGHT_SVC_USER_DEFINED_CONTROL", PyLong_FromUnsignedLongLong((uint32_t)SC_RIGHT_SVC_USER_DEFINED_CONTROL)); PyModule_AddObject(m, "SERVICE_CONFIG_DESCRIPTION", PyLong_FromUnsignedLongLong((uint32_t)SERVICE_CONFIG_DESCRIPTION)); PyModule_AddObject(m, "SERVICE_CONFIG_FAILURE_ACTIONS", PyLong_FromUnsignedLongLong((uint32_t)SERVICE_CONFIG_FAILURE_ACTIONS)); PyModule_AddObject(m, "SC_ACTION_NONE", PyLong_FromUnsignedLongLong((uint32_t)SC_ACTION_NONE)); PyModule_AddObject(m, "SC_ACTION_RESTART", PyLong_FromUnsignedLongLong((uint32_t)SC_ACTION_RESTART)); PyModule_AddObject(m, "SC_ACTION_REBOOT", PyLong_FromUnsignedLongLong((uint32_t)SC_ACTION_REBOOT)); PyModule_AddObject(m, "SC_ACTION_RUN_COMMAND", PyLong_FromUnsignedLongLong((uint32_t)SC_ACTION_RUN_COMMAND)); PyModule_AddObject(m, "SVC_STATUS_PROCESS_INFO", PyLong_FromUnsignedLongLong((uint32_t)SVC_STATUS_PROCESS_INFO)); Py_INCREF((PyObject *)(void *)&SERVICE_LOCK_STATUS_Type); PyModule_AddObject(m, "SERVICE_LOCK_STATUS", (PyObject *)(void *)&SERVICE_LOCK_STATUS_Type); Py_INCREF((PyObject *)(void *)&SERVICE_STATUS_Type); PyModule_AddObject(m, "SERVICE_STATUS", (PyObject *)(void *)&SERVICE_STATUS_Type); Py_INCREF((PyObject *)(void *)&SERVICE_STATUS_PROCESS_Type); PyModule_AddObject(m, "SERVICE_STATUS_PROCESS", (PyObject *)(void *)&SERVICE_STATUS_PROCESS_Type); Py_INCREF((PyObject *)(void *)&ENUM_SERVICE_STATUSW_Type); PyModule_AddObject(m, "ENUM_SERVICE_STATUSW", (PyObject *)(void *)&ENUM_SERVICE_STATUSW_Type); Py_INCREF((PyObject *)(void *)&ENUM_SERVICE_STATUSA_Type); PyModule_AddObject(m, "ENUM_SERVICE_STATUSA", (PyObject *)(void *)&ENUM_SERVICE_STATUSA_Type); Py_INCREF((PyObject *)(void *)&QUERY_SERVICE_CONFIG_Type); PyModule_AddObject(m, "QUERY_SERVICE_CONFIG", (PyObject *)(void *)&QUERY_SERVICE_CONFIG_Type); Py_INCREF((PyObject *)(void *)&svcctl_ArgumentString_Type); PyModule_AddObject(m, "ArgumentString", (PyObject *)(void *)&svcctl_ArgumentString_Type); Py_INCREF((PyObject *)(void *)&SERVICE_DESCRIPTION_Type); PyModule_AddObject(m, "SERVICE_DESCRIPTION", (PyObject *)(void *)&SERVICE_DESCRIPTION_Type); Py_INCREF((PyObject *)(void *)&SC_ACTION_Type); PyModule_AddObject(m, "SC_ACTION", (PyObject *)(void *)&SC_ACTION_Type); Py_INCREF((PyObject *)(void *)&SERVICE_FAILURE_ACTIONS_Type); PyModule_AddObject(m, "SERVICE_FAILURE_ACTIONS", (PyObject *)(void *)&SERVICE_FAILURE_ACTIONS_Type); Py_INCREF((PyObject *)(void *)&svcctl_CloseServiceHandle_Type); PyModule_AddObject(m, "CloseServiceHandle", (PyObject *)(void *)&svcctl_CloseServiceHandle_Type); Py_INCREF((PyObject *)(void *)&svcctl_ControlService_Type); PyModule_AddObject(m, "ControlService", (PyObject *)(void *)&svcctl_ControlService_Type); Py_INCREF((PyObject *)(void *)&svcctl_DeleteService_Type); PyModule_AddObject(m, "DeleteService", (PyObject *)(void *)&svcctl_DeleteService_Type); Py_INCREF((PyObject *)(void *)&svcctl_LockServiceDatabase_Type); PyModule_AddObject(m, "LockServiceDatabase", (PyObject *)(void *)&svcctl_LockServiceDatabase_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceObjectSecurity_Type); PyModule_AddObject(m, "QueryServiceObjectSecurity", (PyObject *)(void *)&svcctl_QueryServiceObjectSecurity_Type); Py_INCREF((PyObject *)(void *)&svcctl_SetServiceObjectSecurity_Type); PyModule_AddObject(m, "SetServiceObjectSecurity", (PyObject *)(void *)&svcctl_SetServiceObjectSecurity_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceStatus_Type); PyModule_AddObject(m, "QueryServiceStatus", (PyObject *)(void *)&svcctl_QueryServiceStatus_Type); Py_INCREF((PyObject *)(void *)&svcctl_UnlockServiceDatabase_Type); PyModule_AddObject(m, "UnlockServiceDatabase", (PyObject *)(void *)&svcctl_UnlockServiceDatabase_Type); Py_INCREF((PyObject *)(void *)&svcctl_SCSetServiceBitsW_Type); PyModule_AddObject(m, "SCSetServiceBitsW", (PyObject *)(void *)&svcctl_SCSetServiceBitsW_Type); Py_INCREF((PyObject *)(void *)&svcctl_ChangeServiceConfigW_Type); PyModule_AddObject(m, "ChangeServiceConfigW", (PyObject *)(void *)&svcctl_ChangeServiceConfigW_Type); Py_INCREF((PyObject *)(void *)&svcctl_CreateServiceW_Type); PyModule_AddObject(m, "CreateServiceW", (PyObject *)(void *)&svcctl_CreateServiceW_Type); Py_INCREF((PyObject *)(void *)&svcctl_EnumDependentServicesW_Type); PyModule_AddObject(m, "EnumDependentServicesW", (PyObject *)(void *)&svcctl_EnumDependentServicesW_Type); Py_INCREF((PyObject *)(void *)&svcctl_EnumServicesStatusW_Type); PyModule_AddObject(m, "EnumServicesStatusW", (PyObject *)(void *)&svcctl_EnumServicesStatusW_Type); Py_INCREF((PyObject *)(void *)&svcctl_OpenSCManagerW_Type); PyModule_AddObject(m, "OpenSCManagerW", (PyObject *)(void *)&svcctl_OpenSCManagerW_Type); Py_INCREF((PyObject *)(void *)&svcctl_OpenServiceW_Type); PyModule_AddObject(m, "OpenServiceW", (PyObject *)(void *)&svcctl_OpenServiceW_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceConfigW_Type); PyModule_AddObject(m, "QueryServiceConfigW", (PyObject *)(void *)&svcctl_QueryServiceConfigW_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceLockStatusW_Type); PyModule_AddObject(m, "QueryServiceLockStatusW", (PyObject *)(void *)&svcctl_QueryServiceLockStatusW_Type); Py_INCREF((PyObject *)(void *)&svcctl_StartServiceW_Type); PyModule_AddObject(m, "StartServiceW", (PyObject *)(void *)&svcctl_StartServiceW_Type); Py_INCREF((PyObject *)(void *)&svcctl_GetServiceDisplayNameW_Type); PyModule_AddObject(m, "GetServiceDisplayNameW", (PyObject *)(void *)&svcctl_GetServiceDisplayNameW_Type); Py_INCREF((PyObject *)(void *)&svcctl_GetServiceKeyNameW_Type); PyModule_AddObject(m, "GetServiceKeyNameW", (PyObject *)(void *)&svcctl_GetServiceKeyNameW_Type); Py_INCREF((PyObject *)(void *)&svcctl_SCSetServiceBitsA_Type); PyModule_AddObject(m, "SCSetServiceBitsA", (PyObject *)(void *)&svcctl_SCSetServiceBitsA_Type); Py_INCREF((PyObject *)(void *)&svcctl_ChangeServiceConfigA_Type); PyModule_AddObject(m, "ChangeServiceConfigA", (PyObject *)(void *)&svcctl_ChangeServiceConfigA_Type); Py_INCREF((PyObject *)(void *)&svcctl_CreateServiceA_Type); PyModule_AddObject(m, "CreateServiceA", (PyObject *)(void *)&svcctl_CreateServiceA_Type); Py_INCREF((PyObject *)(void *)&svcctl_EnumDependentServicesA_Type); PyModule_AddObject(m, "EnumDependentServicesA", (PyObject *)(void *)&svcctl_EnumDependentServicesA_Type); Py_INCREF((PyObject *)(void *)&svcctl_EnumServicesStatusA_Type); PyModule_AddObject(m, "EnumServicesStatusA", (PyObject *)(void *)&svcctl_EnumServicesStatusA_Type); Py_INCREF((PyObject *)(void *)&svcctl_OpenSCManagerA_Type); PyModule_AddObject(m, "OpenSCManagerA", (PyObject *)(void *)&svcctl_OpenSCManagerA_Type); Py_INCREF((PyObject *)(void *)&svcctl_OpenServiceA_Type); PyModule_AddObject(m, "OpenServiceA", (PyObject *)(void *)&svcctl_OpenServiceA_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceConfigA_Type); PyModule_AddObject(m, "QueryServiceConfigA", (PyObject *)(void *)&svcctl_QueryServiceConfigA_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceLockStatusA_Type); PyModule_AddObject(m, "QueryServiceLockStatusA", (PyObject *)(void *)&svcctl_QueryServiceLockStatusA_Type); Py_INCREF((PyObject *)(void *)&svcctl_StartServiceA_Type); PyModule_AddObject(m, "StartServiceA", (PyObject *)(void *)&svcctl_StartServiceA_Type); Py_INCREF((PyObject *)(void *)&svcctl_GetServiceDisplayNameA_Type); PyModule_AddObject(m, "GetServiceDisplayNameA", (PyObject *)(void *)&svcctl_GetServiceDisplayNameA_Type); Py_INCREF((PyObject *)(void *)&svcctl_GetServiceKeyNameA_Type); PyModule_AddObject(m, "GetServiceKeyNameA", (PyObject *)(void *)&svcctl_GetServiceKeyNameA_Type); Py_INCREF((PyObject *)(void *)&svcctl_ChangeServiceConfig2A_Type); PyModule_AddObject(m, "ChangeServiceConfig2A", (PyObject *)(void *)&svcctl_ChangeServiceConfig2A_Type); Py_INCREF((PyObject *)(void *)&svcctl_ChangeServiceConfig2W_Type); PyModule_AddObject(m, "ChangeServiceConfig2W", (PyObject *)(void *)&svcctl_ChangeServiceConfig2W_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceConfig2A_Type); PyModule_AddObject(m, "QueryServiceConfig2A", (PyObject *)(void *)&svcctl_QueryServiceConfig2A_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceConfig2W_Type); PyModule_AddObject(m, "QueryServiceConfig2W", (PyObject *)(void *)&svcctl_QueryServiceConfig2W_Type); Py_INCREF((PyObject *)(void *)&svcctl_QueryServiceStatusEx_Type); PyModule_AddObject(m, "QueryServiceStatusEx", (PyObject *)(void *)&svcctl_QueryServiceStatusEx_Type); Py_INCREF((PyObject *)(void *)&EnumServicesStatusExA_Type); PyModule_AddObject(m, "EnumServicesStatusExA", (PyObject *)(void *)&EnumServicesStatusExA_Type); Py_INCREF((PyObject *)(void *)&EnumServicesStatusExW_Type); PyModule_AddObject(m, "EnumServicesStatusExW", (PyObject *)(void *)&EnumServicesStatusExW_Type); Py_INCREF((PyObject *)(void *)&svcctl_InterfaceType); PyModule_AddObject(m, "svcctl", (PyObject *)(void *)&svcctl_InterfaceType); Py_INCREF((PyObject *)(void *)&svcctl_SyntaxType); PyModule_AddObject(m, "svcctl_abstract_syntax", (PyObject *)(void *)&svcctl_SyntaxType); Py_INCREF((PyObject *)(void *)&svcctl_SyntaxType); PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&svcctl_SyntaxType); #ifdef PY_MOD_SVCCTL_PATCH PY_MOD_SVCCTL_PATCH(m); #endif out: Py_XDECREF(dep_samba_dcerpc_misc); Py_XDECREF(dep_samba_dcerpc_security); Py_XDECREF(dep_talloc); Py_XDECREF(dep_samba_dcerpc_base); return m; }