2 Unix SMB/Netbios implementation.
5 Copyright (C) Gerald Carter 2001,
6 Copyright (C) Tim Potter 2000-2001,
7 Copyright (C) Andrew Tridgell 1994-2000,
8 Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
9 Copyright (C) Jean-Francois Micouleau 1999-2000.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 /** @defgroup spoolss SPOOLSS - NT printing routines
34 /** Return a handle to the specified printer or print server.
36 * @param cli Pointer to client state structure which is open
37 * on the SPOOLSS pipe.
39 * @param mem_ctx Pointer to an initialised talloc context.
41 * @param printername The name of the printer or print server to be
42 * opened in UNC format.
44 * @param datatype Specifies the default data type for the printer.
46 * @param access_required The access rights requested on the printer or
49 * @param station The UNC name of the requesting workstation.
51 * @param username The name of the user requesting the open.
53 * @param pol Returned policy handle.
56 WERROR cli_spoolss_open_printer_ex(struct cli_state *cli, TALLOC_CTX *mem_ctx,
57 char *printername, char *datatype,
58 uint32 access_required, char *station,
59 char *username, POLICY_HND *pol)
61 prs_struct qbuf, rbuf;
62 SPOOL_Q_OPEN_PRINTER_EX q;
63 SPOOL_R_OPEN_PRINTER_EX r;
64 WERROR result = W_ERROR(ERRgeneral);
69 /* Initialise parse structures */
71 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
72 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
74 /* Initialise input parameters */
76 make_spoolss_q_open_printer_ex(&q, printername, datatype,
77 access_required, station, username);
79 /* Marshall data and send request */
81 if (!spoolss_io_q_open_printer_ex("", &q, &qbuf, 0) ||
82 !rpc_api_pipe_req(cli, SPOOLSS_OPENPRINTEREX, &qbuf, &rbuf))
85 /* Unmarshall response */
87 if (!spoolss_io_r_open_printer_ex("", &r, &rbuf, 0))
90 /* Return output parameters */
94 if (W_ERROR_IS_OK(result))
104 /** Close a printer handle
106 * @param cli Pointer to client state structure which is open
107 * on the SPOOLSS pipe.
109 * @param mem_ctx Pointer to an initialised talloc context.
111 * @param pol Policy handle of printer or print server to close.
114 WERROR cli_spoolss_close_printer(struct cli_state *cli, TALLOC_CTX *mem_ctx,
117 prs_struct qbuf, rbuf;
118 SPOOL_Q_CLOSEPRINTER q;
119 SPOOL_R_CLOSEPRINTER r;
120 WERROR result = W_ERROR(ERRgeneral);
125 /* Initialise parse structures */
127 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
128 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
130 /* Initialise input parameters */
132 make_spoolss_q_closeprinter(&q, pol);
134 /* Marshall data and send request */
136 if (!spoolss_io_q_closeprinter("", &q, &qbuf, 0) ||
137 !rpc_api_pipe_req(cli, SPOOLSS_CLOSEPRINTER, &qbuf, &rbuf))
140 /* Unmarshall response */
142 if (!spoolss_io_r_closeprinter("", &r, &rbuf, 0))
145 /* Return output parameters */
149 if (W_ERROR_IS_OK(result))
159 /* Initialize a spoolss NEW_BUFFER */
161 static void init_buffer(NEW_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx)
163 buffer->ptr = (size != 0);
165 buffer->string_at_end = size;
166 prs_init(&buffer->prs, size, ctx, MARSHALL);
167 buffer->struct_start = prs_offset(&buffer->prs);
170 /* Decode various printer info levels - perhaps this should live in
173 static void decode_printer_info_0(
177 PRINTER_INFO_0 **info
183 inf=(PRINTER_INFO_0 *)talloc(mem_ctx, returned*sizeof(PRINTER_INFO_0));
185 buffer->prs.data_offset=0;
187 for (i=0; i<returned; i++) {
188 smb_io_printer_info_0("", buffer, &inf[i], 0);
194 static void decode_printer_info_1(
198 PRINTER_INFO_1 **info
204 inf=(PRINTER_INFO_1 *)talloc(mem_ctx, returned*sizeof(PRINTER_INFO_1));
206 buffer->prs.data_offset=0;
208 for (i=0; i<returned; i++) {
209 smb_io_printer_info_1("", buffer, &inf[i], 0);
215 static void decode_printer_info_2(
219 PRINTER_INFO_2 **info
225 inf=(PRINTER_INFO_2 *)talloc(mem_ctx, returned*sizeof(PRINTER_INFO_2));
227 buffer->prs.data_offset=0;
229 for (i=0; i<returned; i++) {
230 /* a little initialization as we go */
231 inf[i].secdesc = NULL;
232 smb_io_printer_info_2("", buffer, &inf[i], 0);
238 static void decode_printer_info_3(
242 PRINTER_INFO_3 **info
248 inf=(PRINTER_INFO_3 *)talloc(mem_ctx, returned*sizeof(PRINTER_INFO_3));
250 buffer->prs.data_offset=0;
252 for (i=0; i<returned; i++) {
253 inf[i].secdesc = NULL;
254 smb_io_printer_info_3("", buffer, &inf[i], 0);
260 /**********************************************************************
261 Decode a PORT_INFO_1 struct from a NEW_BUFFER
262 **********************************************************************/
263 static void decode_port_info_1(
273 inf=(PORT_INFO_1*)talloc(mem_ctx, returned*sizeof(PORT_INFO_1));
275 prs_set_offset(&buffer->prs, 0);
277 for (i=0; i<returned; i++) {
278 smb_io_port_info_1("", buffer, &(inf[i]), 0);
284 /**********************************************************************
285 Decode a PORT_INFO_2 struct from a NEW_BUFFER
286 **********************************************************************/
287 static void decode_port_info_2(
296 inf=(PORT_INFO_2*)talloc(mem_ctx, returned*sizeof(PORT_INFO_2));
298 prs_set_offset(&buffer->prs, 0);
300 for (i=0; i<returned; i++) {
301 smb_io_port_info_2("", buffer, &(inf[i]), 0);
307 static void decode_printer_driver_1(
317 inf=(DRIVER_INFO_1 *)talloc(mem_ctx, returned*sizeof(DRIVER_INFO_1));
319 buffer->prs.data_offset=0;
321 for (i=0; i<returned; i++) {
322 smb_io_printer_driver_info_1("", buffer, &(inf[i]), 0);
328 static void decode_printer_driver_2(
338 inf=(DRIVER_INFO_2 *)talloc(mem_ctx, returned*sizeof(DRIVER_INFO_2));
340 buffer->prs.data_offset=0;
342 for (i=0; i<returned; i++) {
343 smb_io_printer_driver_info_2("", buffer, &(inf[i]), 0);
349 static void decode_printer_driver_3(
359 inf=(DRIVER_INFO_3 *)talloc(mem_ctx, returned*sizeof(DRIVER_INFO_3));
361 buffer->prs.data_offset=0;
363 for (i=0; i<returned; i++) {
364 smb_io_printer_driver_info_3("", buffer, &(inf[i]), 0);
370 static void decode_printerdriverdir_1 (
374 DRIVER_DIRECTORY_1 **info
377 DRIVER_DIRECTORY_1 *inf;
379 inf=(DRIVER_DIRECTORY_1 *)talloc(mem_ctx, sizeof(DRIVER_DIRECTORY_1));
381 prs_set_offset(&buffer->prs, 0);
383 smb_io_driverdir_1("", buffer, inf, 0);
388 /** Enumerate printers on a print server.
390 * @param cli Pointer to client state structure which is open
391 * on the SPOOLSS pipe.
392 * @param mem_ctx Pointer to an initialised talloc context.
394 * @param offered Buffer size offered in the request.
395 * @param needed Number of bytes needed to complete the request.
398 * @param flags Selected from PRINTER_ENUM_* flags.
399 * @param level Request information level.
401 * @param num_printers Pointer to number of printers returned. May be
403 * @param ctr Return structure for printer information. May
407 WERROR cli_spoolss_enum_printers(struct cli_state *cli, TALLOC_CTX *mem_ctx,
408 uint32 offered, uint32 *needed,
409 uint32 flags, uint32 level,
410 uint32 *num_printers, PRINTER_INFO_CTR *ctr)
412 prs_struct qbuf, rbuf;
413 SPOOL_Q_ENUMPRINTERS q;
414 SPOOL_R_ENUMPRINTERS r;
416 WERROR result = W_ERROR(ERRgeneral);
422 fstrcpy (server, cli->desthost);
425 /* Initialise input parameters */
427 init_buffer(&buffer, offered, mem_ctx);
429 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
430 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
432 make_spoolss_q_enumprinters(&q, flags, server, level, &buffer,
435 /* Marshall data and send request */
437 if (!spoolss_io_q_enumprinters("", &q, &qbuf, 0) ||
438 !rpc_api_pipe_req(cli, SPOOLSS_ENUMPRINTERS, &qbuf, &rbuf))
441 /* Unmarshall response */
443 if (spoolss_io_r_enumprinters("", &r, &rbuf, 0)) {
450 /* Return output parameters */
452 if (!W_ERROR_IS_OK(r.status))
456 *num_printers = r.returned;
463 decode_printer_info_1(mem_ctx, r.buffer, r.returned,
467 decode_printer_info_2(mem_ctx, r.buffer, r.returned,
471 decode_printer_info_3(mem_ctx, r.buffer, r.returned,
483 /** Enumerate printer ports on a print server.
485 * @param cli Pointer to client state structure which is open
486 * on the SPOOLSS pipe.
487 * @param mem_ctx Pointer to an initialised talloc context.
489 * @param offered Buffer size offered in the request.
490 * @param needed Number of bytes needed to complete the request.
493 * @param level Requested information level.
495 * @param num_ports Pointer to number of ports returned. May be NULL.
496 * @param ctr Pointer to structure holding port information.
500 WERROR cli_spoolss_enum_ports(struct cli_state *cli, TALLOC_CTX *mem_ctx,
501 uint32 offered, uint32 *needed,
502 uint32 level, int *num_ports, PORT_INFO_CTR *ctr)
504 prs_struct qbuf, rbuf;
508 WERROR result = W_ERROR(ERRgeneral);
514 slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
517 /* Initialise input parameters */
519 init_buffer(&buffer, offered, mem_ctx);
521 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
522 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
524 make_spoolss_q_enumports(&q, server, level, &buffer, offered);
526 /* Marshall data and send request */
528 if (!spoolss_io_q_enumports("", &q, &qbuf, 0) ||
529 !rpc_api_pipe_req(cli, SPOOLSS_ENUMPORTS, &qbuf, &rbuf))
532 /* Unmarshall response */
534 if (spoolss_io_r_enumports("", &r, &rbuf, 0)) {
541 /* Return output parameters */
543 if (!W_ERROR_IS_OK(result))
547 *num_ports = r.returned;
554 decode_port_info_1(mem_ctx, r.buffer, r.returned,
558 decode_port_info_2(mem_ctx, r.buffer, r.returned,
570 /* Get printer info */
571 NTSTATUS cli_spoolss_getprinter(
572 struct cli_state *cli,
576 PRINTER_INFO_CTR *ctr
579 prs_struct qbuf, rbuf;
580 SPOOL_Q_GETPRINTER q;
581 SPOOL_R_GETPRINTER r;
590 /* Initialise input parameters */
592 init_buffer(&buffer, needed, mem_ctx);
594 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
595 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
597 make_spoolss_q_getprinter(mem_ctx, &q, pol, level, &buffer, needed);
599 /* Marshall data and send request */
600 if (!spoolss_io_q_getprinter("", &q, &qbuf, 0) ||
601 !rpc_api_pipe_req(cli, SPOOLSS_GETPRINTER, &qbuf, &rbuf))
603 result = NT_STATUS_UNSUCCESSFUL;
607 /* Unmarshall response */
608 if (spoolss_io_r_getprinter("", &r, &rbuf, 0)) {
612 /* Return output parameters */
613 result = werror_to_ntstatus(r.status);
614 if (NT_STATUS_IS_OK(result)) {
617 decode_printer_info_0(mem_ctx, r.buffer, 1, &ctr->printers_0);
620 decode_printer_info_1(mem_ctx, r.buffer, 1, &ctr->printers_1);
623 decode_printer_info_2(mem_ctx, r.buffer, 1, &ctr->printers_2);
626 decode_printer_info_3(mem_ctx, r.buffer, 1, &ctr->printers_3);
635 } while (NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_BUFFER_TOO_SMALL));
640 /**********************************************************************
643 NTSTATUS cli_spoolss_setprinter(
644 struct cli_state *cli,
648 PRINTER_INFO_CTR *ctr,
652 prs_struct qbuf, rbuf;
653 SPOOL_Q_SETPRINTER q;
654 SPOOL_R_SETPRINTER r;
655 NTSTATUS result = NT_STATUS_ACCESS_DENIED;
660 /* Initialise input parameters */
661 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
662 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
664 make_spoolss_q_setprinter(mem_ctx, &q, pol, level, ctr, command);
666 /* Marshall data and send request */
667 if (!spoolss_io_q_setprinter("", &q, &qbuf, 0) ||
668 !rpc_api_pipe_req(cli, SPOOLSS_SETPRINTER, &qbuf, &rbuf))
670 result = NT_STATUS_ACCESS_DENIED;
674 /* Unmarshall response */
675 if (!spoolss_io_r_setprinter("", &r, &rbuf, 0))
680 result = werror_to_ntstatus(r.status);
690 /** Get installed printer drivers for a given printer
692 * @param cli Pointer to client state structure which is open
693 * on the SPOOLSS pipe.
695 * @param mem_ctx Pointer to an initialised talloc context.
697 * @param offered Buffer size offered in the request.
698 * @param needed Number of bytes needed to complete the request.
701 * @param pol Pointer to an open policy handle for the printer
702 * opened with cli_spoolss_open_printer_ex().
703 * @param level Requested information level.
704 * @param env The print environment or archictecture. This is
705 * "Windows NT x86" for NT4.
706 * @param ctr Returned printer driver information.
709 WERROR cli_spoolss_getprinterdriver(struct cli_state *cli,
711 uint32 offered, uint32 *needed,
712 POLICY_HND *pol, uint32 level,
713 char *env, PRINTER_DRIVER_CTR *ctr)
715 prs_struct qbuf, rbuf;
716 SPOOL_Q_GETPRINTERDRIVER2 q;
717 SPOOL_R_GETPRINTERDRIVER2 r;
719 WERROR result = W_ERROR(ERRgeneral);
725 fstrcpy (server, cli->desthost);
728 /* Initialise input parameters */
730 init_buffer(&buffer, offered, mem_ctx);
732 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
733 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
735 make_spoolss_q_getprinterdriver2(&q, pol, env, level, 2, 2,
738 /* Marshall data and send request */
740 if (!spoolss_io_q_getprinterdriver2 ("", &q, &qbuf, 0) ||
741 !rpc_api_pipe_req (cli, SPOOLSS_GETPRINTERDRIVER2, &qbuf, &rbuf))
744 /* Unmarshall response */
746 if (spoolss_io_r_getprinterdriver2 ("", &r, &rbuf, 0)) {
753 /* Return output parameters */
755 if (!W_ERROR_IS_OK(result))
763 decode_printer_driver_1(mem_ctx, r.buffer, 1, &ctr->info1);
766 decode_printer_driver_2(mem_ctx, r.buffer, 1, &ctr->info2);
769 decode_printer_driver_3(mem_ctx, r.buffer, 1, &ctr->info3);
780 /**********************************************************************
781 * Get installed printer drivers for a given printer
783 NTSTATUS cli_spoolss_enumprinterdrivers (
784 struct cli_state *cli,
789 PRINTER_DRIVER_CTR *ctr
792 prs_struct qbuf, rbuf;
793 SPOOL_Q_ENUMPRINTERDRIVERS q;
794 SPOOL_R_ENUMPRINTERDRIVERS r;
803 slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
808 /* Initialise input parameters */
809 init_buffer(&buffer, needed, mem_ctx);
811 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
812 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
815 /* write the request */
816 make_spoolss_q_enumprinterdrivers(&q, server, env, level, &buffer, needed);
818 /* Marshall data and send request */
819 if (!spoolss_io_q_enumprinterdrivers ("", &q, &qbuf, 0) ||
820 !rpc_api_pipe_req (cli, SPOOLSS_ENUMPRINTERDRIVERS, &qbuf, &rbuf))
822 result = NT_STATUS_UNSUCCESSFUL;
826 /* Unmarshall response */
827 if (spoolss_io_r_enumprinterdrivers ("", &r, &rbuf, 0))
832 /* Return output parameters */
833 result = werror_to_ntstatus(r.status);
834 if (NT_STATUS_IS_OK(result) &&
837 *returned = r.returned;
842 decode_printer_driver_1(mem_ctx, r.buffer, r.returned, &ctr->info1);
845 decode_printer_driver_2(mem_ctx, r.buffer, r.returned, &ctr->info2);
848 decode_printer_driver_3(mem_ctx, r.buffer, r.returned, &ctr->info3);
857 } while (NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_BUFFER_TOO_SMALL));
863 /**********************************************************************
864 * Get installed printer drivers for a given printer
866 NTSTATUS cli_spoolss_getprinterdriverdir (
867 struct cli_state *cli,
871 DRIVER_DIRECTORY_CTR *ctr
874 prs_struct qbuf, rbuf;
875 SPOOL_Q_GETPRINTERDRIVERDIR q;
876 SPOOL_R_GETPRINTERDRIVERDIR r;
885 slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
890 /* Initialise input parameters */
891 init_buffer(&buffer, needed, mem_ctx);
893 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
894 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
897 /* write the request */
898 make_spoolss_q_getprinterdriverdir(&q, server, env, level, &buffer, needed);
900 /* Marshall data and send request */
901 if (!spoolss_io_q_getprinterdriverdir ("", &q, &qbuf, 0) ||
902 !rpc_api_pipe_req (cli, SPOOLSS_GETPRINTERDRIVERDIRECTORY, &qbuf, &rbuf))
904 result = NT_STATUS_UNSUCCESSFUL;
908 /* Unmarshall response */
909 if (spoolss_io_r_getprinterdriverdir ("", &r, &rbuf, 0))
914 /* Return output parameters */
915 result = werror_to_ntstatus(r.status);
916 if (NT_STATUS_IS_OK(result))
921 decode_printerdriverdir_1(mem_ctx, r.buffer, 1, &ctr->info1);
930 } while (NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_BUFFER_TOO_SMALL));
935 /**********************************************************************
936 * Install a printer driver
938 NTSTATUS cli_spoolss_addprinterdriver (
939 struct cli_state *cli,
942 PRINTER_DRIVER_CTR *ctr
945 prs_struct qbuf, rbuf;
946 SPOOL_Q_ADDPRINTERDRIVER q;
947 SPOOL_R_ADDPRINTERDRIVER r;
948 NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
954 slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
957 /* Initialise input parameters */
958 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
959 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
962 /* write the request */
963 make_spoolss_q_addprinterdriver (mem_ctx, &q, server, level, ctr);
965 /* Marshall data and send request */
966 result = NT_STATUS_UNSUCCESSFUL;
967 if (!spoolss_io_q_addprinterdriver ("", &q, &qbuf, 0) ||
968 !rpc_api_pipe_req (cli, SPOOLSS_ADDPRINTERDRIVER, &qbuf, &rbuf))
974 /* Unmarshall response */
975 result = NT_STATUS_UNSUCCESSFUL;
976 if (!spoolss_io_r_addprinterdriver ("", &r, &rbuf, 0))
981 /* Return output parameters */
982 result = werror_to_ntstatus(r.status);
991 /**********************************************************************
994 NTSTATUS cli_spoolss_addprinterex (
995 struct cli_state *cli,
998 PRINTER_INFO_CTR *ctr
1001 prs_struct qbuf, rbuf;
1002 SPOOL_Q_ADDPRINTEREX q;
1003 SPOOL_R_ADDPRINTEREX r;
1012 slprintf (client, sizeof(fstring)-1, "\\\\%s", cli->desthost);
1014 slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
1016 fstrcpy (user, cli->user_name);
1019 /* Initialise input parameters */
1020 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
1021 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
1024 /* write the request */
1025 make_spoolss_q_addprinterex (mem_ctx, &q, server, client, user, level, ctr);
1027 /* Marshall data and send request */
1028 result = NT_STATUS_UNSUCCESSFUL;
1029 if (!spoolss_io_q_addprinterex ("", &q, &qbuf, 0) ||
1030 !rpc_api_pipe_req (cli, SPOOLSS_ADDPRINTEREX, &qbuf, &rbuf))
1036 /* Unmarshall response */
1037 result = NT_STATUS_UNSUCCESSFUL;
1038 if (!spoolss_io_r_addprinterex ("", &r, &rbuf, 0))
1043 /* Return output parameters */
1044 result = werror_to_ntstatus(r.status);
1047 prs_mem_free(&qbuf);
1048 prs_mem_free(&rbuf);
1053 /**********************************************************************
1054 * Delete a Printer Driver from the server (does not remove
1057 NTSTATUS cli_spoolss_deleteprinterdriver (
1058 struct cli_state *cli,
1059 TALLOC_CTX *mem_ctx,
1064 prs_struct qbuf, rbuf;
1065 SPOOL_Q_DELETEPRINTERDRIVER q;
1066 SPOOL_R_DELETEPRINTERDRIVER r;
1074 /* Initialise input parameters */
1075 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
1076 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
1078 slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
1081 /* write the request */
1082 make_spoolss_q_deleteprinterdriver (mem_ctx, &q, server, arch, driver);
1084 /* Marshall data and send request */
1085 result = NT_STATUS_UNSUCCESSFUL;
1086 if (!spoolss_io_q_deleteprinterdriver ("", &q, &qbuf, 0) ||
1087 !rpc_api_pipe_req (cli,SPOOLSS_DELETEPRINTERDRIVER , &qbuf, &rbuf))
1093 /* Unmarshall response */
1094 result = NT_STATUS_UNSUCCESSFUL;
1095 if (!spoolss_io_r_deleteprinterdriver ("", &r, &rbuf, 0))
1100 /* Return output parameters */
1101 result = werror_to_ntstatus(r.status);
1104 prs_mem_free(&qbuf);
1105 prs_mem_free(&rbuf);
1110 /* Get print processor directory */
1112 NTSTATUS cli_spoolss_getprintprocessordirectory(struct cli_state *cli,
1113 TALLOC_CTX *mem_ctx,
1118 prs_struct qbuf, rbuf;
1119 SPOOL_Q_GETPRINTPROCESSORDIRECTORY q;
1120 SPOOL_R_GETPRINTPROCESSORDIRECTORY r;
1124 uint32 needed = 100;
1129 /* Initialise parse structures */
1132 /* Initialise input parameters */
1135 init_buffer(&buffer, needed, mem_ctx);
1137 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
1138 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
1140 make_spoolss_q_getprintprocessordirectory(&q, name,
1144 /* Marshall data and send request */
1146 if (!spoolss_io_q_getprintprocessordirectory("", &q, &qbuf, 0) ||
1147 !rpc_api_pipe_req(cli, SPOOLSS_GETPRINTPROCESSORDIRECTORY, &qbuf, &rbuf)) {
1148 result = NT_STATUS_UNSUCCESSFUL;
1152 /* Unmarshall response */
1154 if (!spoolss_io_r_getprintprocessordirectory("", &r, &rbuf, 0)) {
1155 result = NT_STATUS_UNSUCCESSFUL;
1159 /* Return output parameters */
1161 result = werror_to_ntstatus(r.status);
1163 } while (NT_STATUS_V(result) ==
1164 NT_STATUS_V(NT_STATUS_BUFFER_TOO_SMALL));
1167 prs_mem_free(&qbuf);
1168 prs_mem_free(&rbuf);