diff options
Diffstat (limited to 'source3/python')
-rw-r--r-- | source3/python/py_spoolss_drivers_conv.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/source3/python/py_spoolss_drivers_conv.c b/source3/python/py_spoolss_drivers_conv.c index dbf33905ae..5d181f9cd9 100644 --- a/source3/python/py_spoolss_drivers_conv.c +++ b/source3/python/py_spoolss_drivers_conv.c @@ -46,7 +46,6 @@ struct pyconv py_DRIVER_INFO_3[] = { { "data_file", PY_UNISTR, offsetof(DRIVER_INFO_3, datafile) }, { "config_file", PY_UNISTR, offsetof(DRIVER_INFO_3, configfile) }, { "help_file", PY_UNISTR, offsetof(DRIVER_INFO_3, helpfile) }, - /* dependentfiles */ { "monitor_name", PY_UNISTR, offsetof(DRIVER_INFO_3, monitorname) }, { "default_datatype", PY_UNISTR, offsetof(DRIVER_INFO_3, defaultdatatype) }, { NULL } @@ -80,6 +79,30 @@ struct pyconv py_DRIVER_DIRECTORY_1[] = { { NULL } }; +/* Convert a NULL terminated list of NULL terminated unicode strings + to a list of (char *) strings */ + +static PyObject *from_dependentfiles(uint16 *dependentfiles) +{ + PyObject *list; + int offset = 0; + + list = PyList_New(0); + + while (*(dependentfiles + offset) != 0) { + fstring name; + int len; + + len = rpcstr_pull(name, dependentfiles + offset, + sizeof(fstring), -1, STR_TERMINATE); + + offset += len / 2; + PyList_Append(list, PyString_FromString(name)); + } + + return list; +} + BOOL py_from_DRIVER_INFO_1(PyObject **dict, DRIVER_INFO_1 *info) { *dict = from_struct(info, py_DRIVER_INFO_1); @@ -108,6 +131,10 @@ BOOL py_from_DRIVER_INFO_3(PyObject **dict, DRIVER_INFO_3 *info) { *dict = from_struct(info, py_DRIVER_INFO_3); PyDict_SetItemString(*dict, "level", PyInt_FromLong(3)); + PyDict_SetItemString( + *dict, "dependent_files", + from_dependentfiles(info->dependentfiles)); + return True; } @@ -127,6 +154,9 @@ BOOL py_from_DRIVER_INFO_6(PyObject **dict, DRIVER_INFO_6 *info) { *dict = from_struct(info, py_DRIVER_INFO_6); PyDict_SetItemString(*dict, "level", PyInt_FromLong(6)); + PyDict_SetItemString( + *dict, "dependent_files", + from_dependentfiles (info->dependentfiles)); return True; } |