| 1 |
|
|---|
| 2 | /* Python wrapper functions auto-generated by pidl */
|
|---|
| 3 | #include <Python.h>
|
|---|
| 4 | #include "includes.h"
|
|---|
| 5 | #include <pytalloc.h>
|
|---|
| 6 | #include "librpc/rpc/pyrpc.h"
|
|---|
| 7 | #include "librpc/rpc/pyrpc_util.h"
|
|---|
| 8 | #include "librpc/gen_ndr/ndr_ntsvcs.h"
|
|---|
| 9 | #include "librpc/gen_ndr/ndr_ntsvcs_c.h"
|
|---|
| 10 |
|
|---|
| 11 | #include "librpc/gen_ndr/misc.h"
|
|---|
| 12 | staticforward PyTypeObject PNP_HwProfInfo_Type;
|
|---|
| 13 | staticforward PyTypeObject ntsvcs_InterfaceType;
|
|---|
| 14 |
|
|---|
| 15 | void initntsvcs(void);static PyTypeObject *Object_Type;
|
|---|
| 16 | static PyTypeObject *ClientConnection_Type;
|
|---|
| 17 |
|
|---|
| 18 | static PyObject *py_PNP_HwProfInfo_get_profile_handle(PyObject *obj, void *closure)
|
|---|
| 19 | {
|
|---|
| 20 | struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)py_talloc_get_ptr(obj);
|
|---|
| 21 | PyObject *py_profile_handle;
|
|---|
| 22 | py_profile_handle = PyInt_FromLong(object->profile_handle);
|
|---|
| 23 | return py_profile_handle;
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | static int py_PNP_HwProfInfo_set_profile_handle(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 27 | {
|
|---|
| 28 | struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)py_talloc_get_ptr(py_obj);
|
|---|
| 29 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 30 | object->profile_handle = PyInt_AsLong(value);
|
|---|
| 31 | return 0;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | static PyObject *py_PNP_HwProfInfo_get_friendly_name(PyObject *obj, void *closure)
|
|---|
| 35 | {
|
|---|
| 36 | struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)py_talloc_get_ptr(obj);
|
|---|
| 37 | PyObject *py_friendly_name;
|
|---|
| 38 | py_friendly_name = PyList_New(80);
|
|---|
| 39 | if (py_friendly_name == NULL) {
|
|---|
| 40 | return NULL;
|
|---|
| 41 | }
|
|---|
| 42 | {
|
|---|
| 43 | int friendly_name_cntr_0;
|
|---|
| 44 | for (friendly_name_cntr_0 = 0; friendly_name_cntr_0 < 80; friendly_name_cntr_0++) {
|
|---|
| 45 | PyObject *py_friendly_name_0;
|
|---|
| 46 | py_friendly_name_0 = PyInt_FromLong(object->friendly_name[friendly_name_cntr_0]);
|
|---|
| 47 | PyList_SetItem(py_friendly_name, friendly_name_cntr_0, py_friendly_name_0);
|
|---|
| 48 | }
|
|---|
| 49 | }
|
|---|
| 50 | return py_friendly_name;
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | static int py_PNP_HwProfInfo_set_friendly_name(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 54 | {
|
|---|
| 55 | struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)py_talloc_get_ptr(py_obj);
|
|---|
| 56 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 57 | {
|
|---|
| 58 | int friendly_name_cntr_0;
|
|---|
| 59 | for (friendly_name_cntr_0 = 0; friendly_name_cntr_0 < PyList_GET_SIZE(value); friendly_name_cntr_0++) {
|
|---|
| 60 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, friendly_name_cntr_0), return -1;);
|
|---|
| 61 | object->friendly_name[friendly_name_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, friendly_name_cntr_0));
|
|---|
| 62 | }
|
|---|
| 63 | }
|
|---|
| 64 | return 0;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | static PyObject *py_PNP_HwProfInfo_get_flags(PyObject *obj, void *closure)
|
|---|
| 68 | {
|
|---|
| 69 | struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)py_talloc_get_ptr(obj);
|
|---|
| 70 | PyObject *py_flags;
|
|---|
| 71 | py_flags = PyInt_FromLong(object->flags);
|
|---|
| 72 | return py_flags;
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | static int py_PNP_HwProfInfo_set_flags(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 76 | {
|
|---|
| 77 | struct PNP_HwProfInfo *object = (struct PNP_HwProfInfo *)py_talloc_get_ptr(py_obj);
|
|---|
| 78 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 79 | object->flags = PyInt_AsLong(value);
|
|---|
| 80 | return 0;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | static PyGetSetDef py_PNP_HwProfInfo_getsetters[] = {
|
|---|
| 84 | { discard_const_p(char, "profile_handle"), py_PNP_HwProfInfo_get_profile_handle, py_PNP_HwProfInfo_set_profile_handle },
|
|---|
| 85 | { discard_const_p(char, "friendly_name"), py_PNP_HwProfInfo_get_friendly_name, py_PNP_HwProfInfo_set_friendly_name },
|
|---|
| 86 | { discard_const_p(char, "flags"), py_PNP_HwProfInfo_get_flags, py_PNP_HwProfInfo_set_flags },
|
|---|
| 87 | { NULL }
|
|---|
| 88 | };
|
|---|
| 89 |
|
|---|
| 90 | static PyObject *py_PNP_HwProfInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 91 | {
|
|---|
| 92 | return py_talloc_new(struct PNP_HwProfInfo, type);
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | static PyTypeObject PNP_HwProfInfo_Type = {
|
|---|
| 97 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 98 | .tp_name = "ntsvcs.PNP_HwProfInfo",
|
|---|
| 99 | .tp_getset = py_PNP_HwProfInfo_getsetters,
|
|---|
| 100 | .tp_methods = NULL,
|
|---|
| 101 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 102 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 103 | .tp_new = py_PNP_HwProfInfo_new,
|
|---|
| 104 | };
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | static bool pack_py_PNP_GetVersion_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetVersion *r)
|
|---|
| 108 | {
|
|---|
| 109 | const char *kwnames[] = {
|
|---|
| 110 | NULL
|
|---|
| 111 | };
|
|---|
| 112 |
|
|---|
| 113 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":PNP_GetVersion", discard_const_p(char *, kwnames))) {
|
|---|
| 114 | return false;
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 117 | return true;
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | static PyObject *unpack_py_PNP_GetVersion_args_out(struct PNP_GetVersion *r)
|
|---|
| 121 | {
|
|---|
| 122 | PyObject *result;
|
|---|
| 123 | PyObject *py_version;
|
|---|
| 124 | py_version = PyInt_FromLong(*r->out.version);
|
|---|
| 125 | result = py_version;
|
|---|
| 126 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 127 | PyErr_SetWERROR(r->out.result);
|
|---|
| 128 | return NULL;
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | return result;
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | static bool pack_py_PNP_ValidateDeviceInstance_args_in(PyObject *args, PyObject *kwargs, struct PNP_ValidateDeviceInstance *r)
|
|---|
| 135 | {
|
|---|
| 136 | PyObject *py_devicepath;
|
|---|
| 137 | PyObject *py_flags;
|
|---|
| 138 | const char *kwnames[] = {
|
|---|
| 139 | "devicepath", "flags", NULL
|
|---|
| 140 | };
|
|---|
| 141 |
|
|---|
| 142 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:PNP_ValidateDeviceInstance", discard_const_p(char *, kwnames), &py_devicepath, &py_flags)) {
|
|---|
| 143 | return false;
|
|---|
| 144 | }
|
|---|
| 145 |
|
|---|
| 146 | r->in.devicepath = talloc_ptrtype(r, r->in.devicepath);
|
|---|
| 147 | if (PyUnicode_Check(py_devicepath)) {
|
|---|
| 148 | r->in.devicepath = PyString_AS_STRING(PyUnicode_AsEncodedString(py_devicepath, "utf-8", "ignore"));
|
|---|
| 149 | } else if (PyString_Check(py_devicepath)) {
|
|---|
| 150 | r->in.devicepath = PyString_AS_STRING(py_devicepath);
|
|---|
| 151 | } else {
|
|---|
| 152 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicepath)->tp_name);
|
|---|
| 153 | return false;
|
|---|
| 154 | }
|
|---|
| 155 | PY_CHECK_TYPE(&PyInt_Type, py_flags, return false;);
|
|---|
| 156 | r->in.flags = PyInt_AsLong(py_flags);
|
|---|
| 157 | return true;
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | static PyObject *unpack_py_PNP_ValidateDeviceInstance_args_out(struct PNP_ValidateDeviceInstance *r)
|
|---|
| 161 | {
|
|---|
| 162 | PyObject *result;
|
|---|
| 163 | result = Py_None;
|
|---|
| 164 | Py_INCREF(result);
|
|---|
| 165 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 166 | PyErr_SetWERROR(r->out.result);
|
|---|
| 167 | return NULL;
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | return result;
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | static bool pack_py_PNP_GetDeviceList_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetDeviceList *r)
|
|---|
| 174 | {
|
|---|
| 175 | PyObject *py_filter;
|
|---|
| 176 | PyObject *py_flags;
|
|---|
| 177 | const char *kwnames[] = {
|
|---|
| 178 | "filter", "flags", NULL
|
|---|
| 179 | };
|
|---|
| 180 |
|
|---|
| 181 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:PNP_GetDeviceList", discard_const_p(char *, kwnames), &py_filter, &py_flags)) {
|
|---|
| 182 | return false;
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 | if (py_filter == Py_None) {
|
|---|
| 186 | r->in.filter = NULL;
|
|---|
| 187 | } else {
|
|---|
| 188 | r->in.filter = NULL;
|
|---|
| 189 | if (PyUnicode_Check(py_filter)) {
|
|---|
| 190 | r->in.filter = PyString_AS_STRING(PyUnicode_AsEncodedString(py_filter, "utf-8", "ignore"));
|
|---|
| 191 | } else if (PyString_Check(py_filter)) {
|
|---|
| 192 | r->in.filter = PyString_AS_STRING(py_filter);
|
|---|
| 193 | } else {
|
|---|
| 194 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_filter)->tp_name);
|
|---|
| 195 | return false;
|
|---|
| 196 | }
|
|---|
| 197 | }
|
|---|
| 198 | r->in.length = talloc_ptrtype(r, r->in.length);
|
|---|
| 199 | PY_CHECK_TYPE(&PyInt_Type, py_length, return false;);
|
|---|
| 200 | *r->in.length = PyInt_AsLong(py_length);
|
|---|
| 201 | if (PyLong_Check(py_flags)) {
|
|---|
| 202 | r->in.flags = PyLong_AsLongLong(py_flags);
|
|---|
| 203 | } else if (PyInt_Check(py_flags)) {
|
|---|
| 204 | r->in.flags = PyInt_AsLong(py_flags);
|
|---|
| 205 | } else {
|
|---|
| 206 | PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
|
|---|
| 207 | PyInt_Type.tp_name, PyLong_Type.tp_name);
|
|---|
| 208 | return false;
|
|---|
| 209 | }
|
|---|
| 210 | return true;
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 | static PyObject *unpack_py_PNP_GetDeviceList_args_out(struct PNP_GetDeviceList *r)
|
|---|
| 214 | {
|
|---|
| 215 | PyObject *result;
|
|---|
| 216 | PyObject *py_buffer;
|
|---|
| 217 | py_buffer = PyList_New(*r->out.length);
|
|---|
| 218 | if (py_buffer == NULL) {
|
|---|
| 219 | return NULL;
|
|---|
| 220 | }
|
|---|
| 221 | {
|
|---|
| 222 | int buffer_cntr_1;
|
|---|
| 223 | for (buffer_cntr_1 = 0; buffer_cntr_1 < *r->out.length; buffer_cntr_1++) {
|
|---|
| 224 | PyObject *py_buffer_1;
|
|---|
| 225 | py_buffer_1 = PyInt_FromLong(r->out.buffer[buffer_cntr_1]);
|
|---|
| 226 | PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
|
|---|
| 227 | }
|
|---|
| 228 | }
|
|---|
| 229 | result = py_buffer;
|
|---|
| 230 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 231 | PyErr_SetWERROR(r->out.result);
|
|---|
| 232 | return NULL;
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | return result;
|
|---|
| 236 | }
|
|---|
| 237 |
|
|---|
| 238 | static bool pack_py_PNP_GetDeviceListSize_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetDeviceListSize *r)
|
|---|
| 239 | {
|
|---|
| 240 | PyObject *py_devicename;
|
|---|
| 241 | PyObject *py_flags;
|
|---|
| 242 | const char *kwnames[] = {
|
|---|
| 243 | "devicename", "flags", NULL
|
|---|
| 244 | };
|
|---|
| 245 |
|
|---|
| 246 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:PNP_GetDeviceListSize", discard_const_p(char *, kwnames), &py_devicename, &py_flags)) {
|
|---|
| 247 | return false;
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | if (py_devicename == Py_None) {
|
|---|
| 251 | r->in.devicename = NULL;
|
|---|
| 252 | } else {
|
|---|
| 253 | r->in.devicename = NULL;
|
|---|
| 254 | if (PyUnicode_Check(py_devicename)) {
|
|---|
| 255 | r->in.devicename = PyString_AS_STRING(PyUnicode_AsEncodedString(py_devicename, "utf-8", "ignore"));
|
|---|
| 256 | } else if (PyString_Check(py_devicename)) {
|
|---|
| 257 | r->in.devicename = PyString_AS_STRING(py_devicename);
|
|---|
| 258 | } else {
|
|---|
| 259 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicename)->tp_name);
|
|---|
| 260 | return false;
|
|---|
| 261 | }
|
|---|
| 262 | }
|
|---|
| 263 | if (PyLong_Check(py_flags)) {
|
|---|
| 264 | r->in.flags = PyLong_AsLongLong(py_flags);
|
|---|
| 265 | } else if (PyInt_Check(py_flags)) {
|
|---|
| 266 | r->in.flags = PyInt_AsLong(py_flags);
|
|---|
| 267 | } else {
|
|---|
| 268 | PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
|
|---|
| 269 | PyInt_Type.tp_name, PyLong_Type.tp_name);
|
|---|
| 270 | return false;
|
|---|
| 271 | }
|
|---|
| 272 | return true;
|
|---|
| 273 | }
|
|---|
| 274 |
|
|---|
| 275 | static PyObject *unpack_py_PNP_GetDeviceListSize_args_out(struct PNP_GetDeviceListSize *r)
|
|---|
| 276 | {
|
|---|
| 277 | PyObject *result;
|
|---|
| 278 | PyObject *py_size;
|
|---|
| 279 | py_size = PyInt_FromLong(*r->out.size);
|
|---|
| 280 | result = py_size;
|
|---|
| 281 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 282 | PyErr_SetWERROR(r->out.result);
|
|---|
| 283 | return NULL;
|
|---|
| 284 | }
|
|---|
| 285 |
|
|---|
| 286 | return result;
|
|---|
| 287 | }
|
|---|
| 288 |
|
|---|
| 289 | static bool pack_py_PNP_GetDeviceRegProp_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetDeviceRegProp *r)
|
|---|
| 290 | {
|
|---|
| 291 | PyObject *py_devicepath;
|
|---|
| 292 | PyObject *py_property;
|
|---|
| 293 | PyObject *py_reg_data_type;
|
|---|
| 294 | PyObject *py_needed;
|
|---|
| 295 | PyObject *py_flags;
|
|---|
| 296 | const char *kwnames[] = {
|
|---|
| 297 | "devicepath", "property", "reg_data_type", "needed", "flags", NULL
|
|---|
| 298 | };
|
|---|
| 299 |
|
|---|
| 300 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:PNP_GetDeviceRegProp", discard_const_p(char *, kwnames), &py_devicepath, &py_property, &py_reg_data_type, &py_needed, &py_flags)) {
|
|---|
| 301 | return false;
|
|---|
| 302 | }
|
|---|
| 303 |
|
|---|
| 304 | r->in.devicepath = talloc_ptrtype(r, r->in.devicepath);
|
|---|
| 305 | if (PyUnicode_Check(py_devicepath)) {
|
|---|
| 306 | r->in.devicepath = PyString_AS_STRING(PyUnicode_AsEncodedString(py_devicepath, "utf-8", "ignore"));
|
|---|
| 307 | } else if (PyString_Check(py_devicepath)) {
|
|---|
| 308 | r->in.devicepath = PyString_AS_STRING(py_devicepath);
|
|---|
| 309 | } else {
|
|---|
| 310 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicepath)->tp_name);
|
|---|
| 311 | return false;
|
|---|
| 312 | }
|
|---|
| 313 | PY_CHECK_TYPE(&PyInt_Type, py_property, return false;);
|
|---|
| 314 | r->in.property = PyInt_AsLong(py_property);
|
|---|
| 315 | r->in.reg_data_type = talloc_ptrtype(r, r->in.reg_data_type);
|
|---|
| 316 | if (PyLong_Check(py_reg_data_type)) {
|
|---|
| 317 | *r->in.reg_data_type = PyLong_AsLongLong(py_reg_data_type);
|
|---|
| 318 | } else if (PyInt_Check(py_reg_data_type)) {
|
|---|
| 319 | *r->in.reg_data_type = PyInt_AsLong(py_reg_data_type);
|
|---|
| 320 | } else {
|
|---|
| 321 | PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
|
|---|
| 322 | PyInt_Type.tp_name, PyLong_Type.tp_name);
|
|---|
| 323 | return false;
|
|---|
| 324 | }
|
|---|
| 325 | r->in.buffer_size = talloc_ptrtype(r, r->in.buffer_size);
|
|---|
| 326 | PY_CHECK_TYPE(&PyInt_Type, py_buffer_size, return false;);
|
|---|
| 327 | *r->in.buffer_size = PyInt_AsLong(py_buffer_size);
|
|---|
| 328 | r->in.needed = talloc_ptrtype(r, r->in.needed);
|
|---|
| 329 | PY_CHECK_TYPE(&PyInt_Type, py_needed, return false;);
|
|---|
| 330 | *r->in.needed = PyInt_AsLong(py_needed);
|
|---|
| 331 | PY_CHECK_TYPE(&PyInt_Type, py_flags, return false;);
|
|---|
| 332 | r->in.flags = PyInt_AsLong(py_flags);
|
|---|
| 333 | return true;
|
|---|
| 334 | }
|
|---|
| 335 |
|
|---|
| 336 | static PyObject *unpack_py_PNP_GetDeviceRegProp_args_out(struct PNP_GetDeviceRegProp *r)
|
|---|
| 337 | {
|
|---|
| 338 | PyObject *result;
|
|---|
| 339 | PyObject *py_reg_data_type;
|
|---|
| 340 | PyObject *py_buffer;
|
|---|
| 341 | PyObject *py_needed;
|
|---|
| 342 | result = PyTuple_New(3);
|
|---|
| 343 | py_reg_data_type = PyInt_FromLong(*r->out.reg_data_type);
|
|---|
| 344 | PyTuple_SetItem(result, 0, py_reg_data_type);
|
|---|
| 345 | py_buffer = PyList_New(*r->out.buffer_size);
|
|---|
| 346 | if (py_buffer == NULL) {
|
|---|
| 347 | return NULL;
|
|---|
| 348 | }
|
|---|
| 349 | {
|
|---|
| 350 | int buffer_cntr_1;
|
|---|
| 351 | for (buffer_cntr_1 = 0; buffer_cntr_1 < *r->out.buffer_size; buffer_cntr_1++) {
|
|---|
| 352 | PyObject *py_buffer_1;
|
|---|
| 353 | py_buffer_1 = PyInt_FromLong(r->out.buffer[buffer_cntr_1]);
|
|---|
| 354 | PyList_SetItem(py_buffer, buffer_cntr_1, py_buffer_1);
|
|---|
| 355 | }
|
|---|
| 356 | }
|
|---|
| 357 | PyTuple_SetItem(result, 1, py_buffer);
|
|---|
| 358 | py_needed = PyInt_FromLong(*r->out.needed);
|
|---|
| 359 | PyTuple_SetItem(result, 2, py_needed);
|
|---|
| 360 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 361 | PyErr_SetWERROR(r->out.result);
|
|---|
| 362 | return NULL;
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 | return result;
|
|---|
| 366 | }
|
|---|
| 367 |
|
|---|
| 368 | static bool pack_py_PNP_HwProfFlags_args_in(PyObject *args, PyObject *kwargs, struct PNP_HwProfFlags *r)
|
|---|
| 369 | {
|
|---|
| 370 | PyObject *py_action;
|
|---|
| 371 | PyObject *py_devicepath;
|
|---|
| 372 | PyObject *py_config;
|
|---|
| 373 | PyObject *py_profile_flags;
|
|---|
| 374 | PyObject *py_veto_type;
|
|---|
| 375 | PyObject *py_unknown5;
|
|---|
| 376 | PyObject *py_name_length;
|
|---|
| 377 | PyObject *py_flags;
|
|---|
| 378 | const char *kwnames[] = {
|
|---|
| 379 | "action", "devicepath", "config", "profile_flags", "veto_type", "unknown5", "name_length", "flags", NULL
|
|---|
| 380 | };
|
|---|
| 381 |
|
|---|
| 382 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOOO:PNP_HwProfFlags", discard_const_p(char *, kwnames), &py_action, &py_devicepath, &py_config, &py_profile_flags, &py_veto_type, &py_unknown5, &py_name_length, &py_flags)) {
|
|---|
| 383 | return false;
|
|---|
| 384 | }
|
|---|
| 385 |
|
|---|
| 386 | PY_CHECK_TYPE(&PyInt_Type, py_action, return false;);
|
|---|
| 387 | r->in.action = PyInt_AsLong(py_action);
|
|---|
| 388 | r->in.devicepath = talloc_ptrtype(r, r->in.devicepath);
|
|---|
| 389 | if (PyUnicode_Check(py_devicepath)) {
|
|---|
| 390 | r->in.devicepath = PyString_AS_STRING(PyUnicode_AsEncodedString(py_devicepath, "utf-8", "ignore"));
|
|---|
| 391 | } else if (PyString_Check(py_devicepath)) {
|
|---|
| 392 | r->in.devicepath = PyString_AS_STRING(py_devicepath);
|
|---|
| 393 | } else {
|
|---|
| 394 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_devicepath)->tp_name);
|
|---|
| 395 | return false;
|
|---|
| 396 | }
|
|---|
| 397 | PY_CHECK_TYPE(&PyInt_Type, py_config, return false;);
|
|---|
| 398 | r->in.config = PyInt_AsLong(py_config);
|
|---|
| 399 | r->in.profile_flags = talloc_ptrtype(r, r->in.profile_flags);
|
|---|
| 400 | PY_CHECK_TYPE(&PyInt_Type, py_profile_flags, return false;);
|
|---|
| 401 | *r->in.profile_flags = PyInt_AsLong(py_profile_flags);
|
|---|
| 402 | if (py_veto_type == Py_None) {
|
|---|
| 403 | r->in.veto_type = NULL;
|
|---|
| 404 | } else {
|
|---|
| 405 | r->in.veto_type = talloc_ptrtype(r, r->in.veto_type);
|
|---|
| 406 | PY_CHECK_TYPE(&PyInt_Type, py_veto_type, return false;);
|
|---|
| 407 | *r->in.veto_type = PyInt_AsLong(py_veto_type);
|
|---|
| 408 | }
|
|---|
| 409 | if (py_unknown5 == Py_None) {
|
|---|
| 410 | r->in.unknown5 = NULL;
|
|---|
| 411 | } else {
|
|---|
| 412 | r->in.unknown5 = NULL;
|
|---|
| 413 | if (PyUnicode_Check(py_unknown5)) {
|
|---|
| 414 | r->in.unknown5 = PyString_AS_STRING(PyUnicode_AsEncodedString(py_unknown5, "utf-8", "ignore"));
|
|---|
| 415 | } else if (PyString_Check(py_unknown5)) {
|
|---|
| 416 | r->in.unknown5 = PyString_AS_STRING(py_unknown5);
|
|---|
| 417 | } else {
|
|---|
| 418 | PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_unknown5)->tp_name);
|
|---|
| 419 | return false;
|
|---|
| 420 | }
|
|---|
| 421 | }
|
|---|
| 422 | PY_CHECK_TYPE(&PyInt_Type, py_name_length, return false;);
|
|---|
| 423 | r->in.name_length = PyInt_AsLong(py_name_length);
|
|---|
| 424 | PY_CHECK_TYPE(&PyInt_Type, py_flags, return false;);
|
|---|
| 425 | r->in.flags = PyInt_AsLong(py_flags);
|
|---|
| 426 | return true;
|
|---|
| 427 | }
|
|---|
| 428 |
|
|---|
| 429 | static PyObject *unpack_py_PNP_HwProfFlags_args_out(struct PNP_HwProfFlags *r)
|
|---|
| 430 | {
|
|---|
| 431 | PyObject *result;
|
|---|
| 432 | PyObject *py_profile_flags;
|
|---|
| 433 | PyObject *py_veto_type;
|
|---|
| 434 | PyObject *py_unknown5a;
|
|---|
| 435 | result = PyTuple_New(3);
|
|---|
| 436 | py_profile_flags = PyInt_FromLong(*r->out.profile_flags);
|
|---|
| 437 | PyTuple_SetItem(result, 0, py_profile_flags);
|
|---|
| 438 | if (r->out.veto_type == NULL) {
|
|---|
| 439 | py_veto_type = Py_None;
|
|---|
| 440 | Py_INCREF(py_veto_type);
|
|---|
| 441 | } else {
|
|---|
| 442 | py_veto_type = PyInt_FromLong(*r->out.veto_type);
|
|---|
| 443 | }
|
|---|
| 444 | PyTuple_SetItem(result, 1, py_veto_type);
|
|---|
| 445 | if (r->out.unknown5a == NULL) {
|
|---|
| 446 | py_unknown5a = Py_None;
|
|---|
| 447 | Py_INCREF(py_unknown5a);
|
|---|
| 448 | } else {
|
|---|
| 449 | if (*r->out.unknown5a == NULL) {
|
|---|
| 450 | py_unknown5a = Py_None;
|
|---|
| 451 | Py_INCREF(py_unknown5a);
|
|---|
| 452 | } else {
|
|---|
| 453 | if (*r->out.unknown5a == NULL) {
|
|---|
| 454 | py_unknown5a = Py_None;
|
|---|
| 455 | Py_INCREF(py_unknown5a);
|
|---|
| 456 | } else {
|
|---|
| 457 | py_unknown5a = PyUnicode_Decode(*r->out.unknown5a, strlen(*r->out.unknown5a), "utf-8", "ignore");
|
|---|
| 458 | }
|
|---|
| 459 | }
|
|---|
| 460 | }
|
|---|
| 461 | PyTuple_SetItem(result, 2, py_unknown5a);
|
|---|
| 462 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 463 | PyErr_SetWERROR(r->out.result);
|
|---|
| 464 | return NULL;
|
|---|
| 465 | }
|
|---|
| 466 |
|
|---|
| 467 | return result;
|
|---|
| 468 | }
|
|---|
| 469 |
|
|---|
| 470 | static bool pack_py_PNP_GetHwProfInfo_args_in(PyObject *args, PyObject *kwargs, struct PNP_GetHwProfInfo *r)
|
|---|
| 471 | {
|
|---|
| 472 | PyObject *py_idx;
|
|---|
| 473 | PyObject *py_info;
|
|---|
| 474 | PyObject *py_size;
|
|---|
| 475 | PyObject *py_flags;
|
|---|
| 476 | const char *kwnames[] = {
|
|---|
| 477 | "idx", "info", "size", "flags", NULL
|
|---|
| 478 | };
|
|---|
| 479 |
|
|---|
| 480 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOO:PNP_GetHwProfInfo", discard_const_p(char *, kwnames), &py_idx, &py_info, &py_size, &py_flags)) {
|
|---|
| 481 | return false;
|
|---|
| 482 | }
|
|---|
| 483 |
|
|---|
| 484 | PY_CHECK_TYPE(&PyInt_Type, py_idx, return false;);
|
|---|
| 485 | r->in.idx = PyInt_AsLong(py_idx);
|
|---|
| 486 | r->in.info = talloc_ptrtype(r, r->in.info);
|
|---|
| 487 | PY_CHECK_TYPE(&PNP_HwProfInfo_Type, py_info, return false;);
|
|---|
| 488 | if (talloc_reference(r, py_talloc_get_mem_ctx(py_info)) == NULL) {
|
|---|
| 489 | PyErr_NoMemory();
|
|---|
| 490 | return false;
|
|---|
| 491 | }
|
|---|
| 492 | r->in.info = (struct PNP_HwProfInfo *)py_talloc_get_ptr(py_info);
|
|---|
| 493 | PY_CHECK_TYPE(&PyInt_Type, py_size, return false;);
|
|---|
| 494 | r->in.size = PyInt_AsLong(py_size);
|
|---|
| 495 | PY_CHECK_TYPE(&PyInt_Type, py_flags, return false;);
|
|---|
| 496 | r->in.flags = PyInt_AsLong(py_flags);
|
|---|
| 497 | return true;
|
|---|
| 498 | }
|
|---|
| 499 |
|
|---|
| 500 | static PyObject *unpack_py_PNP_GetHwProfInfo_args_out(struct PNP_GetHwProfInfo *r)
|
|---|
| 501 | {
|
|---|
| 502 | PyObject *result;
|
|---|
| 503 | PyObject *py_info;
|
|---|
| 504 | py_info = py_talloc_reference_ex(&PNP_HwProfInfo_Type, r->out.info, r->out.info);
|
|---|
| 505 | result = py_info;
|
|---|
| 506 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 507 | PyErr_SetWERROR(r->out.result);
|
|---|
| 508 | return NULL;
|
|---|
| 509 | }
|
|---|
| 510 |
|
|---|
| 511 | return result;
|
|---|
| 512 | }
|
|---|
| 513 |
|
|---|
| 514 | const struct PyNdrRpcMethodDef py_ndr_ntsvcs_methods[] = {
|
|---|
| 515 | { "PNP_GetVersion", "S.PNP_GetVersion() -> version", (py_dcerpc_call_fn)dcerpc_PNP_GetVersion_r, (py_data_pack_fn)pack_py_PNP_GetVersion_args_in, (py_data_unpack_fn)unpack_py_PNP_GetVersion_args_out, 2, &ndr_table_ntsvcs },
|
|---|
| 516 | { "PNP_ValidateDeviceInstance", "S.PNP_ValidateDeviceInstance(devicepath, flags) -> None", (py_dcerpc_call_fn)dcerpc_PNP_ValidateDeviceInstance_r, (py_data_pack_fn)pack_py_PNP_ValidateDeviceInstance_args_in, (py_data_unpack_fn)unpack_py_PNP_ValidateDeviceInstance_args_out, 6, &ndr_table_ntsvcs },
|
|---|
| 517 | { "PNP_GetDeviceList", "S.PNP_GetDeviceList(filter, flags) -> buffer", (py_dcerpc_call_fn)dcerpc_PNP_GetDeviceList_r, (py_data_pack_fn)pack_py_PNP_GetDeviceList_args_in, (py_data_unpack_fn)unpack_py_PNP_GetDeviceList_args_out, 10, &ndr_table_ntsvcs },
|
|---|
| 518 | { "PNP_GetDeviceListSize", "S.PNP_GetDeviceListSize(devicename, flags) -> size", (py_dcerpc_call_fn)dcerpc_PNP_GetDeviceListSize_r, (py_data_pack_fn)pack_py_PNP_GetDeviceListSize_args_in, (py_data_unpack_fn)unpack_py_PNP_GetDeviceListSize_args_out, 11, &ndr_table_ntsvcs },
|
|---|
| 519 | { "PNP_GetDeviceRegProp", "S.PNP_GetDeviceRegProp(devicepath, property, reg_data_type, needed, flags) -> (reg_data_type, buffer, needed)", (py_dcerpc_call_fn)dcerpc_PNP_GetDeviceRegProp_r, (py_data_pack_fn)pack_py_PNP_GetDeviceRegProp_args_in, (py_data_unpack_fn)unpack_py_PNP_GetDeviceRegProp_args_out, 13, &ndr_table_ntsvcs },
|
|---|
| 520 | { "PNP_HwProfFlags", "S.PNP_HwProfFlags(action, devicepath, config, profile_flags, veto_type, unknown5, name_length, flags) -> (profile_flags, veto_type, unknown5a)", (py_dcerpc_call_fn)dcerpc_PNP_HwProfFlags_r, (py_data_pack_fn)pack_py_PNP_HwProfFlags_args_in, (py_data_unpack_fn)unpack_py_PNP_HwProfFlags_args_out, 40, &ndr_table_ntsvcs },
|
|---|
| 521 | { "PNP_GetHwProfInfo", "S.PNP_GetHwProfInfo(idx, info, size, flags) -> info", (py_dcerpc_call_fn)dcerpc_PNP_GetHwProfInfo_r, (py_data_pack_fn)pack_py_PNP_GetHwProfInfo_args_in, (py_data_unpack_fn)unpack_py_PNP_GetHwProfInfo_args_out, 41, &ndr_table_ntsvcs },
|
|---|
| 522 | { NULL }
|
|---|
| 523 | };
|
|---|
| 524 |
|
|---|
| 525 | static PyObject *interface_ntsvcs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 526 | {
|
|---|
| 527 | return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_ntsvcs);
|
|---|
| 528 | }
|
|---|
| 529 |
|
|---|
| 530 | #define PY_DOC_NTSVCS "Plug and Play services"
|
|---|
| 531 | static PyTypeObject ntsvcs_InterfaceType = {
|
|---|
| 532 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 533 | .tp_name = "ntsvcs.ntsvcs",
|
|---|
| 534 | .tp_basicsize = sizeof(dcerpc_InterfaceObject),
|
|---|
| 535 | .tp_doc = "ntsvcs(binding, lp_ctx=None, credentials=None) -> connection\n"
|
|---|
| 536 | "\n"
|
|---|
| 537 | "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
|
|---|
| 538 | "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
|
|---|
| 539 | "credentials should be a credentials.Credentials object.\n\n"PY_DOC_NTSVCS,
|
|---|
| 540 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 541 | .tp_new = interface_ntsvcs_new,
|
|---|
| 542 | };
|
|---|
| 543 |
|
|---|
| 544 | static PyMethodDef ntsvcs_methods[] = {
|
|---|
| 545 | { NULL, NULL, 0, NULL }
|
|---|
| 546 | };
|
|---|
| 547 |
|
|---|
| 548 | void initntsvcs(void)
|
|---|
| 549 | {
|
|---|
| 550 | PyObject *m;
|
|---|
| 551 | PyObject *dep_talloc;
|
|---|
| 552 | PyObject *dep_samba_dcerpc_misc;
|
|---|
| 553 | PyObject *dep_samba_dcerpc_base;
|
|---|
| 554 |
|
|---|
| 555 | dep_talloc = PyImport_ImportModule("talloc");
|
|---|
| 556 | if (dep_talloc == NULL)
|
|---|
| 557 | return;
|
|---|
| 558 |
|
|---|
| 559 | dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
|
|---|
| 560 | if (dep_samba_dcerpc_misc == NULL)
|
|---|
| 561 | return;
|
|---|
| 562 |
|
|---|
| 563 | dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
|
|---|
| 564 | if (dep_samba_dcerpc_base == NULL)
|
|---|
| 565 | return;
|
|---|
| 566 |
|
|---|
| 567 | Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
|
|---|
| 568 | if (Object_Type == NULL)
|
|---|
| 569 | return;
|
|---|
| 570 |
|
|---|
| 571 | ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
|
|---|
| 572 | if (ClientConnection_Type == NULL)
|
|---|
| 573 | return;
|
|---|
| 574 |
|
|---|
| 575 | PNP_HwProfInfo_Type.tp_base = Object_Type;
|
|---|
| 576 |
|
|---|
| 577 | ntsvcs_InterfaceType.tp_base = ClientConnection_Type;
|
|---|
| 578 |
|
|---|
| 579 | if (PyType_Ready(&PNP_HwProfInfo_Type) < 0)
|
|---|
| 580 | return;
|
|---|
| 581 | if (PyType_Ready(&ntsvcs_InterfaceType) < 0)
|
|---|
| 582 | return;
|
|---|
| 583 | if (!PyInterface_AddNdrRpcMethods(&ntsvcs_InterfaceType, py_ndr_ntsvcs_methods))
|
|---|
| 584 | return;
|
|---|
| 585 |
|
|---|
| 586 | #ifdef PY_PNP_HWPROFINFO_PATCH
|
|---|
| 587 | PY_PNP_HWPROFINFO_PATCH(&PNP_HwProfInfo_Type);
|
|---|
| 588 | #endif
|
|---|
| 589 | #ifdef PY_NTSVCS_PATCH
|
|---|
| 590 | PY_NTSVCS_PATCH(&ntsvcs_InterfaceType);
|
|---|
| 591 | #endif
|
|---|
| 592 |
|
|---|
| 593 | m = Py_InitModule3("ntsvcs", ntsvcs_methods, "ntsvcs DCE/RPC");
|
|---|
| 594 | if (m == NULL)
|
|---|
| 595 | return;
|
|---|
| 596 |
|
|---|
| 597 | PyModule_AddObject(m, "CM_GETIDLIST_DONOTGENERATE", PyInt_FromLong(CM_GETIDLIST_DONOTGENERATE));
|
|---|
| 598 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_NONE", PyInt_FromLong(0x00000000));
|
|---|
| 599 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_BUSRELATIONS", PyInt_FromLong(CM_GETIDLIST_FILTER_BUSRELATIONS));
|
|---|
| 600 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_PRESENT", PyInt_FromLong(CM_GETIDLIST_FILTER_PRESENT));
|
|---|
| 601 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_REMOVALRELATIONS", PyInt_FromLong(CM_GETIDLIST_FILTER_REMOVALRELATIONS));
|
|---|
| 602 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_EJECTRELATIONS", PyInt_FromLong(CM_GETIDLIST_FILTER_EJECTRELATIONS));
|
|---|
| 603 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_POWERRELATIONS", PyInt_FromLong(CM_GETIDLIST_FILTER_POWERRELATIONS));
|
|---|
| 604 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_SERVICE", PyInt_FromLong(CM_GETIDLIST_FILTER_SERVICE));
|
|---|
| 605 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_TRANSPORTRELATIONS", PyInt_FromLong(CM_GETIDLIST_FILTER_TRANSPORTRELATIONS));
|
|---|
| 606 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_CLASS", PyInt_FromLong(CM_GETIDLIST_FILTER_CLASS));
|
|---|
| 607 | PyModule_AddObject(m, "CM_GETIDLIST_FILTER_ENUMERATOR", PyInt_FromLong(CM_GETIDLIST_FILTER_ENUMERATOR));
|
|---|
| 608 | PyModule_AddObject(m, "DEV_REGPROP_DESC", PyInt_FromLong(1));
|
|---|
| 609 | Py_INCREF((PyObject *)(void *)&PNP_HwProfInfo_Type);
|
|---|
| 610 | PyModule_AddObject(m, "PNP_HwProfInfo", (PyObject *)(void *)&PNP_HwProfInfo_Type);
|
|---|
| 611 | Py_INCREF((PyObject *)(void *)&ntsvcs_InterfaceType);
|
|---|
| 612 | PyModule_AddObject(m, "ntsvcs", (PyObject *)(void *)&ntsvcs_InterfaceType);
|
|---|
| 613 | #ifdef PY_MOD_NTSVCS_PATCH
|
|---|
| 614 | PY_MOD_NTSVCS_PATCH(m);
|
|---|
| 615 | #endif
|
|---|
| 616 |
|
|---|
| 617 | }
|
|---|