関数 | |
PyObject * | spoolss_enumprinterdrivers (PyObject *self, PyObject *args, PyObject *kw) |
PyObject * | spoolss_hnd_getprinterdriver (PyObject *self, PyObject *args, PyObject *kw) |
PyObject * | spoolss_getprinterdriverdir (PyObject *self, PyObject *args, PyObject *kw) |
PyObject * | spoolss_addprinterdriver (PyObject *self, PyObject *args, PyObject *kw) |
PyObject * | spoolss_addprinterdriverex (PyObject *self, PyObject *args, PyObject *kw) |
PyObject * | spoolss_deleteprinterdriver (PyObject *self, PyObject *args, PyObject *kw) |
PyObject * | spoolss_deleteprinterdriverex (PyObject *self, PyObject *args, PyObject *kw) |
PyObject* spoolss_enumprinterdrivers | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_spoolss_drivers.c の 25 行で定義されています。
参照先 UNISTR::buffer・cli・cli_shutdown()・driver_info_info::info1・driver_info_info::info2・driver_info_info::info3・driver_info_info::info6・level・cli_state::mem_ctx・driver_info_6::name・driver_info_3::name・driver_info_2::name・driver_info_1::name・name・open_pipe_creds()・cli_state::pipe_list・py_from_DRIVER_INFO_1()・py_from_DRIVER_INFO_2()・py_from_DRIVER_INFO_3()・py_from_DRIVER_INFO_6()・py_werror_tuple()・result・rpccli_spoolss_enumprinterdrivers()・rpcstr_pull()・server・spoolss_error・spoolss_werror・talloc_init()・werror.
00027 { 00028 WERROR werror; 00029 PyObject *result = NULL, *creds = NULL; 00030 PRINTER_DRIVER_CTR ctr; 00031 int level = 1, i; 00032 uint32 num_drivers; 00033 char *arch = "Windows NT x86", *server, *errstr; 00034 static char *kwlist[] = {"server", "level", "creds", "arch", NULL}; 00035 struct cli_state *cli = NULL; 00036 TALLOC_CTX *mem_ctx = NULL; 00037 00038 /* Parse parameters */ 00039 00040 if (!PyArg_ParseTupleAndKeywords( 00041 args, kw, "s|iOs", kwlist, &server, &level, &creds, 00042 &arch)) 00043 return NULL; 00044 00045 if (server[0] != '\\' || server[1] != '\\') { 00046 PyErr_SetString(PyExc_ValueError, "UNC name required"); 00047 return NULL; 00048 } 00049 00050 server += 2; 00051 00052 if (creds && creds != Py_None && !PyDict_Check(creds)) { 00053 PyErr_SetString(PyExc_TypeError, 00054 "credentials must be dictionary or None"); 00055 return NULL; 00056 } 00057 00058 /* Call rpc function */ 00059 00060 if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { 00061 PyErr_SetString(spoolss_error, errstr); 00062 free(errstr); 00063 goto done; 00064 } 00065 00066 if (!(mem_ctx = talloc_init("spoolss_enumprinterdrivers"))) { 00067 PyErr_SetString( 00068 spoolss_error, "unable to init talloc context\n"); 00069 goto done; 00070 } 00071 00072 werror = rpccli_spoolss_enumprinterdrivers( 00073 cli->pipe_list, mem_ctx, level, arch, 00074 &num_drivers, &ctr); 00075 00076 if (!W_ERROR_IS_OK(werror)) { 00077 PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); 00078 goto done; 00079 } 00080 00081 /* Return value */ 00082 00083 switch (level) { 00084 case 1: 00085 result = PyDict_New(); 00086 00087 for (i = 0; i < num_drivers; i++) { 00088 PyObject *value; 00089 fstring name; 00090 00091 rpcstr_pull(name, ctr.info1[i].name.buffer, 00092 sizeof(fstring), -1, STR_TERMINATE); 00093 00094 py_from_DRIVER_INFO_1(&value, &ctr.info1[i]); 00095 00096 PyDict_SetItemString(result, name, value); 00097 } 00098 00099 break; 00100 case 2: 00101 result = PyDict_New(); 00102 00103 for(i = 0; i < num_drivers; i++) { 00104 PyObject *value; 00105 fstring name; 00106 00107 rpcstr_pull(name, ctr.info2[i].name.buffer, 00108 sizeof(fstring), -1, STR_TERMINATE); 00109 00110 py_from_DRIVER_INFO_2(&value, &ctr.info2[i]); 00111 00112 PyDict_SetItemString(result, name, value); 00113 } 00114 00115 break; 00116 case 3: 00117 result = PyDict_New(); 00118 00119 for(i = 0; i < num_drivers; i++) { 00120 PyObject *value; 00121 fstring name; 00122 00123 rpcstr_pull(name, ctr.info3[i].name.buffer, 00124 sizeof(fstring), -1, STR_TERMINATE); 00125 00126 py_from_DRIVER_INFO_3(&value, &ctr.info3[i]); 00127 00128 PyDict_SetItemString(result, name, value); 00129 } 00130 00131 break; 00132 case 6: 00133 result = PyDict_New(); 00134 00135 for(i = 0; i < num_drivers; i++) { 00136 PyObject *value; 00137 fstring name; 00138 00139 rpcstr_pull(name, ctr.info6[i].name.buffer, 00140 sizeof(fstring), -1, STR_TERMINATE); 00141 00142 py_from_DRIVER_INFO_6(&value, &ctr.info6[i]); 00143 00144 PyList_SetItem(result, i, value); 00145 } 00146 00147 break; 00148 default: 00149 PyErr_SetString(spoolss_error, "unknown info level"); 00150 goto done; 00151 } 00152 00153 done: 00154 if (cli) 00155 cli_shutdown(cli); 00156 00157 if (mem_ctx) 00158 talloc_destroy(mem_ctx); 00159 00160 return result; 00161 }
PyObject* spoolss_hnd_getprinterdriver | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_spoolss_drivers.c の 165 行で定義されています。
参照先 spoolss_policy_hnd_object::cli・driver_info_info::info1・driver_info_info::info2・driver_info_info::info3・driver_info_info::info6・level・spoolss_policy_hnd_object::mem_ctx・spoolss_policy_hnd_object::pol・py_from_DRIVER_INFO_1()・py_from_DRIVER_INFO_2()・py_from_DRIVER_INFO_3()・py_from_DRIVER_INFO_6()・py_werror_tuple()・result・rpccli_spoolss_getprinterdriver()・spoolss_error・spoolss_werror・werror.
00167 { 00168 spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self; 00169 WERROR werror; 00170 PyObject *result = Py_None; 00171 PRINTER_DRIVER_CTR ctr; 00172 int level = 1; 00173 char *arch = "Windows NT x86"; 00174 int version = 2; 00175 static char *kwlist[] = {"level", "arch", NULL}; 00176 00177 /* Parse parameters */ 00178 00179 if (!PyArg_ParseTupleAndKeywords( 00180 args, kw, "|is", kwlist, &level, &arch)) 00181 return NULL; 00182 00183 /* Call rpc function */ 00184 00185 werror = rpccli_spoolss_getprinterdriver( 00186 hnd->cli, hnd->mem_ctx, &hnd->pol, level, arch, version, &ctr); 00187 00188 if (!W_ERROR_IS_OK(werror)) { 00189 PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); 00190 return NULL; 00191 } 00192 00193 /* Return value */ 00194 00195 switch (level) { 00196 case 1: 00197 py_from_DRIVER_INFO_1(&result, ctr.info1); 00198 break; 00199 case 2: 00200 py_from_DRIVER_INFO_2(&result, ctr.info2); 00201 break; 00202 case 3: 00203 py_from_DRIVER_INFO_3(&result, ctr.info3); 00204 break; 00205 case 6: 00206 py_from_DRIVER_INFO_6(&result, ctr.info6); 00207 break; 00208 default: 00209 PyErr_SetString(spoolss_error, "unsupported info level"); 00210 return NULL; 00211 } 00212 00213 Py_INCREF(result); 00214 return result; 00215 }
PyObject* spoolss_getprinterdriverdir | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_spoolss_drivers.c の 219 行で定義されています。
参照先 cli・cli_shutdown()・driver_info_ctr_info::info1・level・cli_state::mem_ctx・open_pipe_creds()・cli_state::pipe_list・py_from_DRIVER_DIRECTORY_1()・py_werror_tuple()・result・rpccli_spoolss_getprinterdriverdir()・server・spoolss_error・spoolss_werror・talloc_init()・werror.
00221 { 00222 WERROR werror; 00223 PyObject *result = NULL, *creds = NULL; 00224 DRIVER_DIRECTORY_CTR ctr; 00225 uint32 level = 1; 00226 char *arch = "Windows NT x86", *server, *errstr; 00227 static char *kwlist[] = {"server", "level", "arch", "creds", NULL}; 00228 struct cli_state *cli = NULL; 00229 TALLOC_CTX *mem_ctx = NULL; 00230 00231 /* Parse parameters */ 00232 00233 if (!PyArg_ParseTupleAndKeywords( 00234 args, kw, "s|isO", kwlist, &server, &level, 00235 &arch, &creds)) 00236 return NULL; 00237 00238 if (server[0] != '\\' || server[1] != '\\') { 00239 PyErr_SetString(PyExc_ValueError, "UNC name required"); 00240 return NULL; 00241 } 00242 00243 server += 2; 00244 00245 if (creds && creds != Py_None && !PyDict_Check(creds)) { 00246 PyErr_SetString(PyExc_TypeError, 00247 "credentials must be dictionary or None"); 00248 return NULL; 00249 } 00250 00251 /* Call rpc function */ 00252 00253 if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { 00254 PyErr_SetString(spoolss_error, errstr); 00255 free(errstr); 00256 goto done; 00257 } 00258 00259 if (!(mem_ctx = talloc_init("spoolss_getprinterdriverdir"))) { 00260 PyErr_SetString( 00261 spoolss_error, "unable to init talloc context\n"); 00262 goto done; 00263 } 00264 00265 werror = rpccli_spoolss_getprinterdriverdir( 00266 cli->pipe_list, mem_ctx, level, arch, &ctr); 00267 00268 if (!W_ERROR_IS_OK(werror)) { 00269 PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); 00270 goto done; 00271 } 00272 00273 /* Return value */ 00274 00275 switch (level) { 00276 case 1: 00277 py_from_DRIVER_DIRECTORY_1(&result, ctr.info1); 00278 break; 00279 default: 00280 PyErr_SetString(spoolss_error, "unknown info level"); 00281 goto done; 00282 } 00283 00284 done: 00285 if (cli) 00286 cli_shutdown(cli); 00287 00288 if (mem_ctx) 00289 talloc_destroy(mem_ctx); 00290 00291 return result; 00292 }
PyObject* spoolss_addprinterdriver | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_spoolss_drivers.c の 294 行で定義されています。
参照先 cli・cli_shutdown()・get_level_value()・driver_info_info::info3・level・cli_state::mem_ctx・open_pipe_creds()・cli_state::pipe_list・py_to_DRIVER_INFO_3()・py_werror_tuple()・result・rpccli_spoolss_addprinterdriver()・server・spoolss_error・spoolss_werror・talloc_init()・werror.
00296 { 00297 static char *kwlist[] = { "server", "info", "creds", NULL }; 00298 char *server, *errstr; 00299 uint32 level; 00300 PyObject *info, *result = NULL, *creds = NULL; 00301 WERROR werror; 00302 TALLOC_CTX *mem_ctx = NULL; 00303 struct cli_state *cli = NULL; 00304 PRINTER_DRIVER_CTR ctr; 00305 union { 00306 DRIVER_INFO_3 driver_3; 00307 } dinfo; 00308 00309 if (!PyArg_ParseTupleAndKeywords( 00310 args, kw, "sO!|O", kwlist, &server, &PyDict_Type, 00311 &info, &creds)) 00312 return NULL; 00313 00314 if (server[0] == '\\' || server[1] == '\\') 00315 server += 2; 00316 00317 if (creds && creds != Py_None && !PyDict_Check(creds)) { 00318 PyErr_SetString(PyExc_TypeError, 00319 "credentials must be dictionary or None"); 00320 return NULL; 00321 } 00322 00323 if (!(mem_ctx = talloc_init("spoolss_addprinterdriver"))) { 00324 PyErr_SetString( 00325 spoolss_error, "unable to init talloc context\n"); 00326 return NULL; 00327 } 00328 00329 if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { 00330 PyErr_SetString(spoolss_error, errstr); 00331 free(errstr); 00332 goto done; 00333 } 00334 00335 if (!get_level_value(info, &level)) { 00336 PyErr_SetString(spoolss_error, "invalid info level"); 00337 goto done; 00338 } 00339 00340 if (level != 3) { 00341 PyErr_SetString(spoolss_error, "unsupported info level"); 00342 goto done; 00343 } 00344 00345 ZERO_STRUCT(ctr); 00346 ZERO_STRUCT(dinfo); 00347 00348 switch(level) { 00349 case 3: 00350 ctr.info3 = &dinfo.driver_3; 00351 00352 if (!py_to_DRIVER_INFO_3(&dinfo.driver_3, info, mem_ctx)) { 00353 PyErr_SetString(spoolss_error, 00354 "error converting to driver info 3"); 00355 goto done; 00356 } 00357 00358 break; 00359 default: 00360 PyErr_SetString(spoolss_error, "unsupported info level"); 00361 goto done; 00362 } 00363 00364 werror = rpccli_spoolss_addprinterdriver(cli->pipe_list, mem_ctx, level, &ctr); 00365 00366 if (!W_ERROR_IS_OK(werror)) { 00367 PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); 00368 goto done; 00369 } 00370 00371 Py_INCREF(Py_None); 00372 result = Py_None; 00373 00374 done: 00375 if (cli) 00376 cli_shutdown(cli); 00377 00378 if (mem_ctx) 00379 talloc_destroy(mem_ctx); 00380 00381 return result; 00382 00383 }
PyObject* spoolss_addprinterdriverex | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_spoolss_drivers.c の 385 行で定義されています。
参照先 spoolss_error.
00387 { 00388 /* Not supported by Samba server */ 00389 00390 PyErr_SetString(spoolss_error, "Not implemented"); 00391 return NULL; 00392 }
PyObject* spoolss_deleteprinterdriver | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_spoolss_drivers.c の 394 行で定義されています。
参照先 spoolss_error.
00396 { 00397 PyErr_SetString(spoolss_error, "Not implemented"); 00398 return NULL; 00399 }
PyObject* spoolss_deleteprinterdriverex | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_spoolss_drivers.c の 401 行で定義されています。
参照先 spoolss_error.
00403 { 00404 PyErr_SetString(spoolss_error, "Not implemented"); 00405 return NULL; 00406 }