s3-spoolss: use pidl for _spoolss_SetForm.
[Samba/gebeck_regimport.git] / source3 / rpc_server / srv_spoolss.c
blobd2a7a5149e26568d66bae3f15526f714ab056518
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2000,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6 * Copyright (C) Jean François Micouleau 1998-2000,
7 * Copyright (C) Jeremy Allison 2001,
8 * Copyright (C) Gerald Carter 2001-2002,
9 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003.
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 3 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, see <http://www.gnu.org/licenses/>.
25 #include "includes.h"
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_RPC_SRV
30 /*******************************************************************
31 ********************************************************************/
33 static bool proxy_spoolss_call(pipes_struct *p, uint8_t opnum)
35 struct api_struct *fns;
36 int n_fns;
38 spoolss_get_pipe_fns(&fns, &n_fns);
40 if (opnum >= n_fns) {
41 return false;
44 if (fns[opnum].opnum != opnum) {
45 smb_panic("SPOOLSS function table not sorted");
48 return fns[opnum].fn(p);
51 /********************************************************************
52 * api_spoolss_open_printer_ex (rarely seen - older call)
53 ********************************************************************/
55 static bool api_spoolss_open_printer(pipes_struct *p)
57 SPOOL_Q_OPEN_PRINTER q_u;
58 SPOOL_R_OPEN_PRINTER r_u;
59 prs_struct *data = &p->in_data.data;
60 prs_struct *rdata = &p->out_data.rdata;
62 ZERO_STRUCT(q_u);
63 ZERO_STRUCT(r_u);
65 if (!spoolss_io_q_open_printer("", &q_u, data, 0)) {
66 DEBUG(0,("spoolss_io_q_open_printer: unable to unmarshall SPOOL_Q_OPEN_PRINTER.\n"));
67 return False;
70 r_u.status = _spoolss_open_printer( p, &q_u, &r_u);
72 if (!spoolss_io_r_open_printer("",&r_u,rdata,0)){
73 DEBUG(0,("spoolss_io_r_open_printer: unable to marshall SPOOL_R_OPEN_PRINTER.\n"));
74 return False;
77 return True;
81 /********************************************************************
82 * api_spoolss_open_printer_ex
83 ********************************************************************/
85 static bool api_spoolss_open_printer_ex(pipes_struct *p)
87 SPOOL_Q_OPEN_PRINTER_EX q_u;
88 SPOOL_R_OPEN_PRINTER_EX r_u;
89 prs_struct *data = &p->in_data.data;
90 prs_struct *rdata = &p->out_data.rdata;
92 ZERO_STRUCT(q_u);
93 ZERO_STRUCT(r_u);
95 if (!spoolss_io_q_open_printer_ex("", &q_u, data, 0)) {
96 DEBUG(0,("spoolss_io_q_open_printer_ex: unable to unmarshall SPOOL_Q_OPEN_PRINTER_EX.\n"));
97 return False;
100 r_u.status = _spoolss_open_printer_ex( p, &q_u, &r_u);
102 if (!spoolss_io_r_open_printer_ex("",&r_u,rdata,0)){
103 DEBUG(0,("spoolss_io_r_open_printer_ex: unable to marshall SPOOL_R_OPEN_PRINTER_EX.\n"));
104 return False;
107 return True;
110 /********************************************************************
111 * api_spoolss_getprinterdata
113 * called from the spoolss dispatcher
114 ********************************************************************/
116 static bool api_spoolss_getprinterdata(pipes_struct *p)
118 SPOOL_Q_GETPRINTERDATA q_u;
119 SPOOL_R_GETPRINTERDATA r_u;
120 prs_struct *data = &p->in_data.data;
121 prs_struct *rdata = &p->out_data.rdata;
123 ZERO_STRUCT(q_u);
124 ZERO_STRUCT(r_u);
126 /* read the stream and fill the struct */
127 if (!spoolss_io_q_getprinterdata("", &q_u, data, 0)) {
128 DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall SPOOL_Q_GETPRINTERDATA.\n"));
129 return False;
132 r_u.status = _spoolss_getprinterdata( p, &q_u, &r_u);
134 if (!spoolss_io_r_getprinterdata("", &r_u, rdata, 0)) {
135 DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall SPOOL_R_GETPRINTERDATA.\n"));
136 return False;
139 return True;
142 /********************************************************************
143 * api_spoolss_deleteprinterdata
145 * called from the spoolss dispatcher
146 ********************************************************************/
148 static bool api_spoolss_deleteprinterdata(pipes_struct *p)
150 SPOOL_Q_DELETEPRINTERDATA q_u;
151 SPOOL_R_DELETEPRINTERDATA r_u;
152 prs_struct *data = &p->in_data.data;
153 prs_struct *rdata = &p->out_data.rdata;
155 ZERO_STRUCT(q_u);
156 ZERO_STRUCT(r_u);
158 /* read the stream and fill the struct */
159 if (!spoolss_io_q_deleteprinterdata("", &q_u, data, 0)) {
160 DEBUG(0,("spoolss_io_q_deleteprinterdata: unable to unmarshall SPOOL_Q_DELETEPRINTERDATA.\n"));
161 return False;
164 r_u.status = _spoolss_deleteprinterdata( p, &q_u, &r_u );
166 if (!spoolss_io_r_deleteprinterdata("", &r_u, rdata, 0)) {
167 DEBUG(0,("spoolss_io_r_deleteprinterdata: unable to marshall SPOOL_R_DELETEPRINTERDATA.\n"));
168 return False;
171 return True;
174 /********************************************************************
175 * api_spoolss_closeprinter
177 * called from the spoolss dispatcher
178 ********************************************************************/
180 static bool api_spoolss_closeprinter(pipes_struct *p)
182 return proxy_spoolss_call(p, NDR_SPOOLSS_CLOSEPRINTER);
185 /********************************************************************
186 * api_spoolss_abortprinter
188 * called from the spoolss dispatcher
189 ********************************************************************/
191 static bool api_spoolss_abortprinter(pipes_struct *p)
193 return proxy_spoolss_call(p, NDR_SPOOLSS_ABORTPRINTER);
196 /********************************************************************
197 * api_spoolss_deleteprinter
199 * called from the spoolss dispatcher
200 ********************************************************************/
202 static bool api_spoolss_deleteprinter(pipes_struct *p)
204 return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTER);
207 /********************************************************************
208 * api_spoolss_deleteprinterdriver
210 * called from the spoolss dispatcher
211 ********************************************************************/
213 static bool api_spoolss_deleteprinterdriver(pipes_struct *p)
215 SPOOL_Q_DELETEPRINTERDRIVER q_u;
216 SPOOL_R_DELETEPRINTERDRIVER r_u;
217 prs_struct *data = &p->in_data.data;
218 prs_struct *rdata = &p->out_data.rdata;
220 ZERO_STRUCT(q_u);
221 ZERO_STRUCT(r_u);
223 if (!spoolss_io_q_deleteprinterdriver("", &q_u, data, 0)) {
224 DEBUG(0,("spoolss_io_q_deleteprinterdriver: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVER.\n"));
225 return False;
228 r_u.status = _spoolss_deleteprinterdriver(p, &q_u, &r_u);
230 if (!spoolss_io_r_deleteprinterdriver("",&r_u,rdata,0)) {
231 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
232 return False;
235 return True;
239 /********************************************************************
240 * api_spoolss_rffpcnex
241 * ReplyFindFirstPrinterChangeNotifyEx
242 ********************************************************************/
244 static bool api_spoolss_rffpcnex(pipes_struct *p)
246 SPOOL_Q_RFFPCNEX q_u;
247 SPOOL_R_RFFPCNEX r_u;
248 prs_struct *data = &p->in_data.data;
249 prs_struct *rdata = &p->out_data.rdata;
251 ZERO_STRUCT(q_u);
252 ZERO_STRUCT(r_u);
254 if (!spoolss_io_q_rffpcnex("", &q_u, data, 0)) {
255 DEBUG(0,("spoolss_io_q_rffpcnex: unable to unmarshall SPOOL_Q_RFFPCNEX.\n"));
256 return False;
259 r_u.status = _spoolss_rffpcnex(p, &q_u, &r_u);
261 if (!spoolss_io_r_rffpcnex("", &r_u, rdata, 0)) {
262 DEBUG(0,("spoolss_io_r_rffpcnex: unable to marshall SPOOL_R_RFFPCNEX.\n"));
263 return False;
266 return True;
270 /********************************************************************
271 * api_spoolss_rfnpcnex
272 * ReplyFindNextPrinterChangeNotifyEx
273 * called from the spoolss dispatcher
275 * Note - this is the *ONLY* function that breaks the RPC call
276 * symmetry in all the other calls. We need to do this to fix
277 * the massive memory allocation problem with thousands of jobs...
278 * JRA.
279 ********************************************************************/
281 static bool api_spoolss_rfnpcnex(pipes_struct *p)
283 SPOOL_Q_RFNPCNEX q_u;
284 SPOOL_R_RFNPCNEX r_u;
285 prs_struct *data = &p->in_data.data;
286 prs_struct *rdata = &p->out_data.rdata;
288 ZERO_STRUCT(q_u);
289 ZERO_STRUCT(r_u);
291 if (!spoolss_io_q_rfnpcnex("", &q_u, data, 0)) {
292 DEBUG(0,("spoolss_io_q_rfnpcnex: unable to unmarshall SPOOL_Q_RFNPCNEX.\n"));
293 return False;
296 r_u.status = _spoolss_rfnpcnex(p, &q_u, &r_u);
298 if (!spoolss_io_r_rfnpcnex("", &r_u, rdata, 0)) {
299 SAFE_FREE(r_u.info.data);
300 DEBUG(0,("spoolss_io_r_rfnpcnex: unable to marshall SPOOL_R_RFNPCNEX.\n"));
301 return False;
304 SAFE_FREE(r_u.info.data);
306 return True;
310 /********************************************************************
311 * api_spoolss_enumprinters
312 * called from the spoolss dispatcher
314 ********************************************************************/
316 static bool api_spoolss_enumprinters(pipes_struct *p)
318 SPOOL_Q_ENUMPRINTERS q_u;
319 SPOOL_R_ENUMPRINTERS r_u;
320 prs_struct *data = &p->in_data.data;
321 prs_struct *rdata = &p->out_data.rdata;
323 ZERO_STRUCT(q_u);
324 ZERO_STRUCT(r_u);
326 if (!spoolss_io_q_enumprinters("", &q_u, data, 0)) {
327 DEBUG(0,("spoolss_io_q_enumprinters: unable to unmarshall SPOOL_Q_ENUMPRINTERS.\n"));
328 return False;
331 r_u.status = _spoolss_enumprinters( p, &q_u, &r_u);
333 if (!spoolss_io_r_enumprinters("", &r_u, rdata, 0)) {
334 DEBUG(0,("spoolss_io_r_enumprinters: unable to marshall SPOOL_R_ENUMPRINTERS.\n"));
335 return False;
338 return True;
341 /********************************************************************
342 * api_spoolss_getprinter
343 * called from the spoolss dispatcher
345 ********************************************************************/
347 static bool api_spoolss_getprinter(pipes_struct *p)
349 SPOOL_Q_GETPRINTER q_u;
350 SPOOL_R_GETPRINTER r_u;
351 prs_struct *data = &p->in_data.data;
352 prs_struct *rdata = &p->out_data.rdata;
354 ZERO_STRUCT(q_u);
355 ZERO_STRUCT(r_u);
357 if(!spoolss_io_q_getprinter("", &q_u, data, 0)) {
358 DEBUG(0,("spoolss_io_q_getprinter: unable to unmarshall SPOOL_Q_GETPRINTER.\n"));
359 return False;
362 r_u.status = _spoolss_getprinter(p, &q_u, &r_u);
364 if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {
365 DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));
366 return False;
369 return True;
372 /********************************************************************
373 * api_spoolss_getprinter
374 * called from the spoolss dispatcher
376 ********************************************************************/
378 static bool api_spoolss_getprinterdriver2(pipes_struct *p)
380 SPOOL_Q_GETPRINTERDRIVER2 q_u;
381 SPOOL_R_GETPRINTERDRIVER2 r_u;
382 prs_struct *data = &p->in_data.data;
383 prs_struct *rdata = &p->out_data.rdata;
385 ZERO_STRUCT(q_u);
386 ZERO_STRUCT(r_u);
388 if(!spoolss_io_q_getprinterdriver2("", &q_u, data, 0)) {
389 DEBUG(0,("spoolss_io_q_getprinterdriver2: unable to unmarshall SPOOL_Q_GETPRINTERDRIVER2.\n"));
390 return False;
393 r_u.status = _spoolss_getprinterdriver2(p, &q_u, &r_u);
395 if(!spoolss_io_r_getprinterdriver2("",&r_u,rdata,0)) {
396 DEBUG(0,("spoolss_io_r_getprinterdriver2: unable to marshall SPOOL_R_GETPRINTERDRIVER2.\n"));
397 return False;
400 return True;
403 /********************************************************************
404 * api_spoolss_getprinter
405 * called from the spoolss dispatcher
407 ********************************************************************/
409 static bool api_spoolss_startpageprinter(pipes_struct *p)
411 return proxy_spoolss_call(p, NDR_SPOOLSS_STARTPAGEPRINTER);
414 /********************************************************************
415 * api_spoolss_getprinter
416 * called from the spoolss dispatcher
418 ********************************************************************/
420 static bool api_spoolss_endpageprinter(pipes_struct *p)
422 return proxy_spoolss_call(p, NDR_SPOOLSS_ENDPAGEPRINTER);
425 /********************************************************************
426 ********************************************************************/
428 static bool api_spoolss_startdocprinter(pipes_struct *p)
430 SPOOL_Q_STARTDOCPRINTER q_u;
431 SPOOL_R_STARTDOCPRINTER r_u;
432 prs_struct *data = &p->in_data.data;
433 prs_struct *rdata = &p->out_data.rdata;
435 ZERO_STRUCT(q_u);
436 ZERO_STRUCT(r_u);
438 if(!spoolss_io_q_startdocprinter("", &q_u, data, 0)) {
439 DEBUG(0,("spoolss_io_q_startdocprinter: unable to unmarshall SPOOL_Q_STARTDOCPRINTER.\n"));
440 return False;
443 r_u.status = _spoolss_startdocprinter(p, &q_u, &r_u);
445 if(!spoolss_io_r_startdocprinter("",&r_u,rdata,0)) {
446 DEBUG(0,("spoolss_io_r_startdocprinter: unable to marshall SPOOL_R_STARTDOCPRINTER.\n"));
447 return False;
450 return True;
453 /********************************************************************
454 ********************************************************************/
456 static bool api_spoolss_enddocprinter(pipes_struct *p)
458 return proxy_spoolss_call(p, NDR_SPOOLSS_ENDDOCPRINTER);
461 /********************************************************************
462 ********************************************************************/
464 static bool api_spoolss_writeprinter(pipes_struct *p)
466 return proxy_spoolss_call(p, NDR_SPOOLSS_WRITEPRINTER);
469 /****************************************************************************
471 ****************************************************************************/
473 static bool api_spoolss_setprinter(pipes_struct *p)
475 SPOOL_Q_SETPRINTER q_u;
476 SPOOL_R_SETPRINTER r_u;
477 prs_struct *data = &p->in_data.data;
478 prs_struct *rdata = &p->out_data.rdata;
480 ZERO_STRUCT(q_u);
481 ZERO_STRUCT(r_u);
483 if(!spoolss_io_q_setprinter("", &q_u, data, 0)) {
484 DEBUG(0,("spoolss_io_q_setprinter: unable to unmarshall SPOOL_Q_SETPRINTER.\n"));
485 return False;
488 r_u.status = _spoolss_setprinter(p, &q_u, &r_u);
490 if(!spoolss_io_r_setprinter("",&r_u,rdata,0)) {
491 DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n"));
492 return False;
495 return True;
498 /****************************************************************************
499 ****************************************************************************/
501 static bool api_spoolss_fcpn(pipes_struct *p)
503 SPOOL_Q_FCPN q_u;
504 SPOOL_R_FCPN r_u;
505 prs_struct *data = &p->in_data.data;
506 prs_struct *rdata = &p->out_data.rdata;
508 ZERO_STRUCT(q_u);
509 ZERO_STRUCT(r_u);
511 if(!spoolss_io_q_fcpn("", &q_u, data, 0)) {
512 DEBUG(0,("spoolss_io_q_fcpn: unable to unmarshall SPOOL_Q_FCPN.\n"));
513 return False;
516 r_u.status = _spoolss_fcpn(p, &q_u, &r_u);
518 if(!spoolss_io_r_fcpn("",&r_u,rdata,0)) {
519 DEBUG(0,("spoolss_io_r_fcpn: unable to marshall SPOOL_R_FCPN.\n"));
520 return False;
523 return True;
526 /****************************************************************************
527 ****************************************************************************/
529 static bool api_spoolss_addjob(pipes_struct *p)
531 SPOOL_Q_ADDJOB q_u;
532 SPOOL_R_ADDJOB r_u;
533 prs_struct *data = &p->in_data.data;
534 prs_struct *rdata = &p->out_data.rdata;
536 ZERO_STRUCT(q_u);
537 ZERO_STRUCT(r_u);
539 if(!spoolss_io_q_addjob("", &q_u, data, 0)) {
540 DEBUG(0,("spoolss_io_q_addjob: unable to unmarshall SPOOL_Q_ADDJOB.\n"));
541 return False;
544 r_u.status = _spoolss_addjob(p, &q_u, &r_u);
546 if(!spoolss_io_r_addjob("",&r_u,rdata,0)) {
547 DEBUG(0,("spoolss_io_r_addjob: unable to marshall SPOOL_R_ADDJOB.\n"));
548 return False;
551 return True;
554 /****************************************************************************
555 ****************************************************************************/
557 static bool api_spoolss_enumjobs(pipes_struct *p)
559 SPOOL_Q_ENUMJOBS q_u;
560 SPOOL_R_ENUMJOBS r_u;
561 prs_struct *data = &p->in_data.data;
562 prs_struct *rdata = &p->out_data.rdata;
564 ZERO_STRUCT(q_u);
565 ZERO_STRUCT(r_u);
567 if (!spoolss_io_q_enumjobs("", &q_u, data, 0)) {
568 DEBUG(0,("spoolss_io_q_enumjobs: unable to unmarshall SPOOL_Q_ENUMJOBS.\n"));
569 return False;
572 r_u.status = _spoolss_enumjobs(p, &q_u, &r_u);
574 if (!spoolss_io_r_enumjobs("",&r_u,rdata,0)) {
575 DEBUG(0,("spoolss_io_r_enumjobs: unable to marshall SPOOL_R_ENUMJOBS.\n"));
576 return False;
579 return True;
582 /****************************************************************************
583 ****************************************************************************/
585 static bool api_spoolss_schedulejob(pipes_struct *p)
587 SPOOL_Q_SCHEDULEJOB q_u;
588 SPOOL_R_SCHEDULEJOB r_u;
589 prs_struct *data = &p->in_data.data;
590 prs_struct *rdata = &p->out_data.rdata;
592 ZERO_STRUCT(q_u);
593 ZERO_STRUCT(r_u);
595 if(!spoolss_io_q_schedulejob("", &q_u, data, 0)) {
596 DEBUG(0,("spoolss_io_q_schedulejob: unable to unmarshall SPOOL_Q_SCHEDULEJOB.\n"));
597 return False;
600 r_u.status = _spoolss_schedulejob(p, &q_u, &r_u);
602 if(!spoolss_io_r_schedulejob("",&r_u,rdata,0)) {
603 DEBUG(0,("spoolss_io_r_schedulejob: unable to marshall SPOOL_R_SCHEDULEJOB.\n"));
604 return False;
607 return True;
610 /****************************************************************************
611 ****************************************************************************/
613 static bool api_spoolss_setjob(pipes_struct *p)
615 SPOOL_Q_SETJOB q_u;
616 SPOOL_R_SETJOB r_u;
617 prs_struct *data = &p->in_data.data;
618 prs_struct *rdata = &p->out_data.rdata;
620 ZERO_STRUCT(q_u);
621 ZERO_STRUCT(r_u);
623 if(!spoolss_io_q_setjob("", &q_u, data, 0)) {
624 DEBUG(0,("spoolss_io_q_setjob: unable to unmarshall SPOOL_Q_SETJOB.\n"));
625 return False;
628 r_u.status = _spoolss_setjob(p, &q_u, &r_u);
630 if(!spoolss_io_r_setjob("",&r_u,rdata,0)) {
631 DEBUG(0,("spoolss_io_r_setjob: unable to marshall SPOOL_R_SETJOB.\n"));
632 return False;
635 return True;
638 /****************************************************************************
639 ****************************************************************************/
641 static bool api_spoolss_enumprinterdrivers(pipes_struct *p)
643 SPOOL_Q_ENUMPRINTERDRIVERS q_u;
644 SPOOL_R_ENUMPRINTERDRIVERS r_u;
645 prs_struct *data = &p->in_data.data;
646 prs_struct *rdata = &p->out_data.rdata;
648 ZERO_STRUCT(q_u);
649 ZERO_STRUCT(r_u);
651 if (!spoolss_io_q_enumprinterdrivers("", &q_u, data, 0)) {
652 DEBUG(0,("spoolss_io_q_enumprinterdrivers: unable to unmarshall SPOOL_Q_ENUMPRINTERDRIVERS.\n"));
653 return False;
656 r_u.status = _spoolss_enumprinterdrivers(p, &q_u, &r_u);
658 if (!spoolss_io_r_enumprinterdrivers("",&r_u,rdata,0)) {
659 DEBUG(0,("spoolss_io_r_enumprinterdrivers: unable to marshall SPOOL_R_ENUMPRINTERDRIVERS.\n"));
660 return False;
663 return True;
666 /****************************************************************************
667 ****************************************************************************/
669 static bool api_spoolss_getform(pipes_struct *p)
671 SPOOL_Q_GETFORM q_u;
672 SPOOL_R_GETFORM r_u;
673 prs_struct *data = &p->in_data.data;
674 prs_struct *rdata = &p->out_data.rdata;
676 ZERO_STRUCT(q_u);
677 ZERO_STRUCT(r_u);
679 if (!spoolss_io_q_getform("", &q_u, data, 0)) {
680 DEBUG(0,("spoolss_io_q_getform: unable to unmarshall SPOOL_Q_GETFORM.\n"));
681 return False;
684 r_u.status = _spoolss_getform(p, &q_u, &r_u);
686 if (!spoolss_io_r_getform("",&r_u,rdata,0)) {
687 DEBUG(0,("spoolss_io_r_getform: unable to marshall SPOOL_R_GETFORM.\n"));
688 return False;
691 return True;
694 /****************************************************************************
695 ****************************************************************************/
697 static bool api_spoolss_enumforms(pipes_struct *p)
699 SPOOL_Q_ENUMFORMS q_u;
700 SPOOL_R_ENUMFORMS r_u;
701 prs_struct *data = &p->in_data.data;
702 prs_struct *rdata = &p->out_data.rdata;
704 ZERO_STRUCT(q_u);
705 ZERO_STRUCT(r_u);
707 if (!spoolss_io_q_enumforms("", &q_u, data, 0)) {
708 DEBUG(0,("spoolss_io_q_enumforms: unable to unmarshall SPOOL_Q_ENUMFORMS.\n"));
709 return False;
712 r_u.status = _spoolss_enumforms(p, &q_u, &r_u);
714 if (!spoolss_io_r_enumforms("",&r_u,rdata,0)) {
715 DEBUG(0,("spoolss_io_r_enumforms: unable to marshall SPOOL_R_ENUMFORMS.\n"));
716 return False;
719 return True;
722 /****************************************************************************
723 ****************************************************************************/
725 static bool api_spoolss_enumports(pipes_struct *p)
727 SPOOL_Q_ENUMPORTS q_u;
728 SPOOL_R_ENUMPORTS r_u;
729 prs_struct *data = &p->in_data.data;
730 prs_struct *rdata = &p->out_data.rdata;
732 ZERO_STRUCT(q_u);
733 ZERO_STRUCT(r_u);
735 if(!spoolss_io_q_enumports("", &q_u, data, 0)) {
736 DEBUG(0,("spoolss_io_q_enumports: unable to unmarshall SPOOL_Q_ENUMPORTS.\n"));
737 return False;
740 r_u.status = _spoolss_enumports(p, &q_u, &r_u);
742 if (!spoolss_io_r_enumports("",&r_u,rdata,0)) {
743 DEBUG(0,("spoolss_io_r_enumports: unable to marshall SPOOL_R_ENUMPORTS.\n"));
744 return False;
747 return True;
750 /****************************************************************************
751 ****************************************************************************/
753 static bool api_spoolss_addprinterex(pipes_struct *p)
755 SPOOL_Q_ADDPRINTEREX q_u;
756 SPOOL_R_ADDPRINTEREX r_u;
757 prs_struct *data = &p->in_data.data;
758 prs_struct *rdata = &p->out_data.rdata;
760 ZERO_STRUCT(q_u);
761 ZERO_STRUCT(r_u);
763 if(!spoolss_io_q_addprinterex("", &q_u, data, 0)) {
764 DEBUG(0,("spoolss_io_q_addprinterex: unable to unmarshall SPOOL_Q_ADDPRINTEREX.\n"));
765 return False;
768 r_u.status = _spoolss_addprinterex(p, &q_u, &r_u);
770 if(!spoolss_io_r_addprinterex("", &r_u, rdata, 0)) {
771 DEBUG(0,("spoolss_io_r_addprinterex: unable to marshall SPOOL_R_ADDPRINTEREX.\n"));
772 return False;
775 return True;
778 /****************************************************************************
779 ****************************************************************************/
781 static bool api_spoolss_addprinterdriver(pipes_struct *p)
783 SPOOL_Q_ADDPRINTERDRIVER q_u;
784 SPOOL_R_ADDPRINTERDRIVER r_u;
785 prs_struct *data = &p->in_data.data;
786 prs_struct *rdata = &p->out_data.rdata;
788 ZERO_STRUCT(q_u);
789 ZERO_STRUCT(r_u);
791 if(!spoolss_io_q_addprinterdriver("", &q_u, data, 0)) {
792 if (q_u.level != 3 && q_u.level != 6) {
793 /* Clever hack from Martin Zielinski <mz@seh.de>
794 * to allow downgrade from level 8 (Vista).
796 DEBUG(3,("api_spoolss_addprinterdriver: unknown SPOOL_Q_ADDPRINTERDRIVER level %u.\n",
797 (unsigned int)q_u.level ));
798 setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_INVALID_TAG));
799 return True;
801 DEBUG(0,("spoolss_io_q_addprinterdriver: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVER.\n"));
802 return False;
805 r_u.status = _spoolss_addprinterdriver(p, &q_u, &r_u);
807 if(!spoolss_io_r_addprinterdriver("", &r_u, rdata, 0)) {
808 DEBUG(0,("spoolss_io_r_addprinterdriver: unable to marshall SPOOL_R_ADDPRINTERDRIVER.\n"));
809 return False;
812 return True;
815 /****************************************************************************
816 ****************************************************************************/
818 static bool api_spoolss_getprinterdriverdirectory(pipes_struct *p)
820 SPOOL_Q_GETPRINTERDRIVERDIR q_u;
821 SPOOL_R_GETPRINTERDRIVERDIR r_u;
822 prs_struct *data = &p->in_data.data;
823 prs_struct *rdata = &p->out_data.rdata;
825 ZERO_STRUCT(q_u);
826 ZERO_STRUCT(r_u);
828 if(!spoolss_io_q_getprinterdriverdir("", &q_u, data, 0)) {
829 DEBUG(0,("spoolss_io_q_getprinterdriverdir: unable to unmarshall SPOOL_Q_GETPRINTERDRIVERDIR.\n"));
830 return False;
833 r_u.status = _spoolss_getprinterdriverdirectory(p, &q_u, &r_u);
835 if(!spoolss_io_r_getprinterdriverdir("", &r_u, rdata, 0)) {
836 DEBUG(0,("spoolss_io_r_getprinterdriverdir: unable to marshall SPOOL_R_GETPRINTERDRIVERDIR.\n"));
837 return False;
840 return True;
843 /****************************************************************************
844 ****************************************************************************/
846 static bool api_spoolss_enumprinterdata(pipes_struct *p)
848 SPOOL_Q_ENUMPRINTERDATA q_u;
849 SPOOL_R_ENUMPRINTERDATA r_u;
850 prs_struct *data = &p->in_data.data;
851 prs_struct *rdata = &p->out_data.rdata;
853 ZERO_STRUCT(q_u);
854 ZERO_STRUCT(r_u);
856 if(!spoolss_io_q_enumprinterdata("", &q_u, data, 0)) {
857 DEBUG(0,("spoolss_io_q_enumprinterdata: unable to unmarshall SPOOL_Q_ENUMPRINTERDATA.\n"));
858 return False;
861 r_u.status = _spoolss_enumprinterdata(p, &q_u, &r_u);
863 if(!spoolss_io_r_enumprinterdata("", &r_u, rdata, 0)) {
864 DEBUG(0,("spoolss_io_r_enumprinterdata: unable to marshall SPOOL_R_ENUMPRINTERDATA.\n"));
865 return False;
868 return True;
871 /****************************************************************************
872 ****************************************************************************/
874 static bool api_spoolss_setprinterdata(pipes_struct *p)
876 SPOOL_Q_SETPRINTERDATA q_u;
877 SPOOL_R_SETPRINTERDATA r_u;
878 prs_struct *data = &p->in_data.data;
879 prs_struct *rdata = &p->out_data.rdata;
881 ZERO_STRUCT(q_u);
882 ZERO_STRUCT(r_u);
884 if(!spoolss_io_q_setprinterdata("", &q_u, data, 0)) {
885 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
886 return False;
889 r_u.status = _spoolss_setprinterdata(p, &q_u, &r_u);
891 if(!spoolss_io_r_setprinterdata("", &r_u, rdata, 0)) {
892 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_SETPRINTERDATA.\n"));
893 return False;
896 return True;
899 /****************************************************************************
900 ****************************************************************************/
901 static bool api_spoolss_reset_printer(pipes_struct *p)
903 SPOOL_Q_RESETPRINTER q_u;
904 SPOOL_R_RESETPRINTER r_u;
905 prs_struct *data = &p->in_data.data;
906 prs_struct *rdata = &p->out_data.rdata;
908 ZERO_STRUCT(q_u);
909 ZERO_STRUCT(r_u);
911 if(!spoolss_io_q_resetprinter("", &q_u, data, 0)) {
912 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
913 return False;
916 r_u.status = _spoolss_resetprinter(p, &q_u, &r_u);
918 if(!spoolss_io_r_resetprinter("", &r_u, rdata, 0)) {
919 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_RESETPRINTER.\n"));
920 return False;
923 return True;
926 /****************************************************************************
927 ****************************************************************************/
928 static bool api_spoolss_addform(pipes_struct *p)
930 return proxy_spoolss_call(p, NDR_SPOOLSS_ADDFORM);
933 /****************************************************************************
934 ****************************************************************************/
936 static bool api_spoolss_deleteform(pipes_struct *p)
938 return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEFORM);
941 /****************************************************************************
942 ****************************************************************************/
944 static bool api_spoolss_setform(pipes_struct *p)
946 return proxy_spoolss_call(p, NDR_SPOOLSS_SETFORM);
949 /****************************************************************************
950 ****************************************************************************/
952 static bool api_spoolss_enumprintprocessors(pipes_struct *p)
954 SPOOL_Q_ENUMPRINTPROCESSORS q_u;
955 SPOOL_R_ENUMPRINTPROCESSORS r_u;
956 prs_struct *data = &p->in_data.data;
957 prs_struct *rdata = &p->out_data.rdata;
959 ZERO_STRUCT(q_u);
960 ZERO_STRUCT(r_u);
962 if(!spoolss_io_q_enumprintprocessors("", &q_u, data, 0)) {
963 DEBUG(0,("spoolss_io_q_enumprintprocessors: unable to unmarshall SPOOL_Q_ENUMPRINTPROCESSORS.\n"));
964 return False;
967 r_u.status = _spoolss_enumprintprocessors(p, &q_u, &r_u);
969 if(!spoolss_io_r_enumprintprocessors("", &r_u, rdata, 0)) {
970 DEBUG(0,("spoolss_io_r_enumprintprocessors: unable to marshall SPOOL_R_ENUMPRINTPROCESSORS.\n"));
971 return False;
974 return True;
977 /****************************************************************************
978 ****************************************************************************/
980 static bool api_spoolss_addprintprocessor(pipes_struct *p)
982 SPOOL_Q_ADDPRINTPROCESSOR q_u;
983 SPOOL_R_ADDPRINTPROCESSOR r_u;
984 prs_struct *data = &p->in_data.data;
985 prs_struct *rdata = &p->out_data.rdata;
987 ZERO_STRUCT(q_u);
988 ZERO_STRUCT(r_u);
990 if(!spoolss_io_q_addprintprocessor("", &q_u, data, 0)) {
991 DEBUG(0,("spoolss_io_q_addprintprocessor: unable to unmarshall SPOOL_Q_ADDPRINTPROCESSOR.\n"));
992 return False;
995 /* for now, just indicate success and ignore the add. We'll
996 automatically set the winprint processor for printer
997 entries later. Used to debug the LexMark Optra S 1855 PCL
998 driver --jerry */
999 r_u.status = WERR_OK;
1001 if(!spoolss_io_r_addprintprocessor("", &r_u, rdata, 0)) {
1002 DEBUG(0,("spoolss_io_r_addprintprocessor: unable to marshall SPOOL_R_ADDPRINTPROCESSOR.\n"));
1003 return False;
1006 return True;
1009 /****************************************************************************
1010 ****************************************************************************/
1012 static bool api_spoolss_enumprintprocdatatypes(pipes_struct *p)
1014 SPOOL_Q_ENUMPRINTPROCDATATYPES q_u;
1015 SPOOL_R_ENUMPRINTPROCDATATYPES r_u;
1016 prs_struct *data = &p->in_data.data;
1017 prs_struct *rdata = &p->out_data.rdata;
1019 ZERO_STRUCT(q_u);
1020 ZERO_STRUCT(r_u);
1022 if(!spoolss_io_q_enumprintprocdatatypes("", &q_u, data, 0)) {
1023 DEBUG(0,("spoolss_io_q_enumprintprocdatatypes: unable to unmarshall SPOOL_Q_ENUMPRINTPROCDATATYPES.\n"));
1024 return False;
1027 r_u.status = _spoolss_enumprintprocdatatypes(p, &q_u, &r_u);
1029 if(!spoolss_io_r_enumprintprocdatatypes("", &r_u, rdata, 0)) {
1030 DEBUG(0,("spoolss_io_r_enumprintprocdatatypes: unable to marshall SPOOL_R_ENUMPRINTPROCDATATYPES.\n"));
1031 return False;
1034 return True;
1037 /****************************************************************************
1038 ****************************************************************************/
1040 static bool api_spoolss_enumprintmonitors(pipes_struct *p)
1042 SPOOL_Q_ENUMPRINTMONITORS q_u;
1043 SPOOL_R_ENUMPRINTMONITORS r_u;
1044 prs_struct *data = &p->in_data.data;
1045 prs_struct *rdata = &p->out_data.rdata;
1047 ZERO_STRUCT(q_u);
1048 ZERO_STRUCT(r_u);
1050 if (!spoolss_io_q_enumprintmonitors("", &q_u, data, 0)) {
1051 DEBUG(0,("spoolss_io_q_enumprintmonitors: unable to unmarshall SPOOL_Q_ENUMPRINTMONITORS.\n"));
1052 return False;
1055 r_u.status = _spoolss_enumprintmonitors(p, &q_u, &r_u);
1057 if (!spoolss_io_r_enumprintmonitors("", &r_u, rdata, 0)) {
1058 DEBUG(0,("spoolss_io_r_enumprintmonitors: unable to marshall SPOOL_R_ENUMPRINTMONITORS.\n"));
1059 return False;
1062 return True;
1065 /****************************************************************************
1066 ****************************************************************************/
1068 static bool api_spoolss_getjob(pipes_struct *p)
1070 SPOOL_Q_GETJOB q_u;
1071 SPOOL_R_GETJOB r_u;
1072 prs_struct *data = &p->in_data.data;
1073 prs_struct *rdata = &p->out_data.rdata;
1075 ZERO_STRUCT(q_u);
1076 ZERO_STRUCT(r_u);
1078 if(!spoolss_io_q_getjob("", &q_u, data, 0)) {
1079 DEBUG(0,("spoolss_io_q_getjob: unable to unmarshall SPOOL_Q_GETJOB.\n"));
1080 return False;
1083 r_u.status = _spoolss_getjob(p, &q_u, &r_u);
1085 if(!spoolss_io_r_getjob("",&r_u,rdata,0)) {
1086 DEBUG(0,("spoolss_io_r_getjob: unable to marshall SPOOL_R_GETJOB.\n"));
1087 return False;
1090 return True;
1093 /********************************************************************
1094 * api_spoolss_getprinterdataex
1096 * called from the spoolss dispatcher
1097 ********************************************************************/
1099 static bool api_spoolss_getprinterdataex(pipes_struct *p)
1101 SPOOL_Q_GETPRINTERDATAEX q_u;
1102 SPOOL_R_GETPRINTERDATAEX r_u;
1103 prs_struct *data = &p->in_data.data;
1104 prs_struct *rdata = &p->out_data.rdata;
1106 ZERO_STRUCT(q_u);
1107 ZERO_STRUCT(r_u);
1109 /* read the stream and fill the struct */
1110 if (!spoolss_io_q_getprinterdataex("", &q_u, data, 0)) {
1111 DEBUG(0,("spoolss_io_q_getprinterdataex: unable to unmarshall SPOOL_Q_GETPRINTERDATAEX.\n"));
1112 return False;
1115 r_u.status = _spoolss_getprinterdataex( p, &q_u, &r_u);
1117 if (!spoolss_io_r_getprinterdataex("", &r_u, rdata, 0)) {
1118 DEBUG(0,("spoolss_io_r_getprinterdataex: unable to marshall SPOOL_R_GETPRINTERDATAEX.\n"));
1119 return False;
1122 return True;
1125 /****************************************************************************
1126 ****************************************************************************/
1128 static bool api_spoolss_setprinterdataex(pipes_struct *p)
1130 SPOOL_Q_SETPRINTERDATAEX q_u;
1131 SPOOL_R_SETPRINTERDATAEX r_u;
1132 prs_struct *data = &p->in_data.data;
1133 prs_struct *rdata = &p->out_data.rdata;
1135 ZERO_STRUCT(q_u);
1136 ZERO_STRUCT(r_u);
1138 if(!spoolss_io_q_setprinterdataex("", &q_u, data, 0)) {
1139 DEBUG(0,("spoolss_io_q_setprinterdataex: unable to unmarshall SPOOL_Q_SETPRINTERDATAEX.\n"));
1140 return False;
1143 r_u.status = _spoolss_setprinterdataex(p, &q_u, &r_u);
1145 if(!spoolss_io_r_setprinterdataex("", &r_u, rdata, 0)) {
1146 DEBUG(0,("spoolss_io_r_setprinterdataex: unable to marshall SPOOL_R_SETPRINTERDATAEX.\n"));
1147 return False;
1150 return True;
1154 /****************************************************************************
1155 ****************************************************************************/
1157 static bool api_spoolss_enumprinterkey(pipes_struct *p)
1159 SPOOL_Q_ENUMPRINTERKEY q_u;
1160 SPOOL_R_ENUMPRINTERKEY r_u;
1161 prs_struct *data = &p->in_data.data;
1162 prs_struct *rdata = &p->out_data.rdata;
1164 ZERO_STRUCT(q_u);
1165 ZERO_STRUCT(r_u);
1167 if(!spoolss_io_q_enumprinterkey("", &q_u, data, 0)) {
1168 DEBUG(0,("spoolss_io_q_setprinterkey: unable to unmarshall SPOOL_Q_ENUMPRINTERKEY.\n"));
1169 return False;
1172 r_u.status = _spoolss_enumprinterkey(p, &q_u, &r_u);
1174 if(!spoolss_io_r_enumprinterkey("", &r_u, rdata, 0)) {
1175 DEBUG(0,("spoolss_io_r_enumprinterkey: unable to marshall SPOOL_R_ENUMPRINTERKEY.\n"));
1176 return False;
1179 return True;
1182 /****************************************************************************
1183 ****************************************************************************/
1185 static bool api_spoolss_enumprinterdataex(pipes_struct *p)
1187 SPOOL_Q_ENUMPRINTERDATAEX q_u;
1188 SPOOL_R_ENUMPRINTERDATAEX r_u;
1189 prs_struct *data = &p->in_data.data;
1190 prs_struct *rdata = &p->out_data.rdata;
1192 ZERO_STRUCT(q_u);
1193 ZERO_STRUCT(r_u);
1195 if(!spoolss_io_q_enumprinterdataex("", &q_u, data, 0)) {
1196 DEBUG(0,("spoolss_io_q_enumprinterdataex: unable to unmarshall SPOOL_Q_ENUMPRINTERDATAEX.\n"));
1197 return False;
1200 r_u.status = _spoolss_enumprinterdataex(p, &q_u, &r_u);
1202 if(!spoolss_io_r_enumprinterdataex("", &r_u, rdata, 0)) {
1203 DEBUG(0,("spoolss_io_r_enumprinterdataex: unable to marshall SPOOL_R_ENUMPRINTERDATAEX.\n"));
1204 return False;
1207 return True;
1210 /****************************************************************************
1211 ****************************************************************************/
1213 static bool api_spoolss_getprintprocessordirectory(pipes_struct *p)
1215 SPOOL_Q_GETPRINTPROCESSORDIRECTORY q_u;
1216 SPOOL_R_GETPRINTPROCESSORDIRECTORY r_u;
1217 prs_struct *data = &p->in_data.data;
1218 prs_struct *rdata = &p->out_data.rdata;
1220 ZERO_STRUCT(q_u);
1221 ZERO_STRUCT(r_u);
1223 if(!spoolss_io_q_getprintprocessordirectory("", &q_u, data, 0)) {
1224 DEBUG(0,("spoolss_io_q_getprintprocessordirectory: unable to unmarshall SPOOL_Q_GETPRINTPROCESSORDIRECTORY.\n"));
1225 return False;
1228 r_u.status = _spoolss_getprintprocessordirectory(p, &q_u, &r_u);
1230 if(!spoolss_io_r_getprintprocessordirectory("", &r_u, rdata, 0)) {
1231 DEBUG(0,("spoolss_io_r_getprintprocessordirectory: unable to marshall SPOOL_R_GETPRINTPROCESSORDIRECTORY.\n"));
1232 return False;
1235 return True;
1238 /****************************************************************************
1239 ****************************************************************************/
1241 static bool api_spoolss_deleteprinterdataex(pipes_struct *p)
1243 SPOOL_Q_DELETEPRINTERDATAEX q_u;
1244 SPOOL_R_DELETEPRINTERDATAEX r_u;
1245 prs_struct *data = &p->in_data.data;
1246 prs_struct *rdata = &p->out_data.rdata;
1248 ZERO_STRUCT(q_u);
1249 ZERO_STRUCT(r_u);
1251 if(!spoolss_io_q_deleteprinterdataex("", &q_u, data, 0)) {
1252 DEBUG(0,("spoolss_io_q_deleteprinterdataex: unable to unmarshall SPOOL_Q_DELETEPRINTERDATAEX.\n"));
1253 return False;
1256 r_u.status = _spoolss_deleteprinterdataex(p, &q_u, &r_u);
1258 if(!spoolss_io_r_deleteprinterdataex("", &r_u, rdata, 0)) {
1259 DEBUG(0,("spoolss_io_r_deleteprinterdataex: unable to marshall SPOOL_R_DELETEPRINTERDATAEX.\n"));
1260 return False;
1263 return True;
1266 /****************************************************************************
1267 ****************************************************************************/
1269 static bool api_spoolss_deleteprinterkey(pipes_struct *p)
1271 SPOOL_Q_DELETEPRINTERKEY q_u;
1272 SPOOL_R_DELETEPRINTERKEY r_u;
1273 prs_struct *data = &p->in_data.data;
1274 prs_struct *rdata = &p->out_data.rdata;
1276 ZERO_STRUCT(q_u);
1277 ZERO_STRUCT(r_u);
1279 if(!spoolss_io_q_deleteprinterkey("", &q_u, data, 0)) {
1280 DEBUG(0,("spoolss_io_q_deleteprinterkey: unable to unmarshall SPOOL_Q_DELETEPRINTERKEY.\n"));
1281 return False;
1284 r_u.status = _spoolss_deleteprinterkey(p, &q_u, &r_u);
1286 if(!spoolss_io_r_deleteprinterkey("", &r_u, rdata, 0)) {
1287 DEBUG(0,("spoolss_io_r_deleteprinterkey: unable to marshall SPOOL_R_DELETEPRINTERKEY.\n"));
1288 return False;
1291 return True;
1294 /****************************************************************************
1295 ****************************************************************************/
1297 static bool api_spoolss_addprinterdriverex(pipes_struct *p)
1299 SPOOL_Q_ADDPRINTERDRIVEREX q_u;
1300 SPOOL_R_ADDPRINTERDRIVEREX r_u;
1301 prs_struct *data = &p->in_data.data;
1302 prs_struct *rdata = &p->out_data.rdata;
1304 ZERO_STRUCT(q_u);
1305 ZERO_STRUCT(r_u);
1307 if(!spoolss_io_q_addprinterdriverex("", &q_u, data, 0)) {
1308 if (q_u.level != 3 && q_u.level != 6) {
1309 /* Clever hack from Martin Zielinski <mz@seh.de>
1310 * to allow downgrade from level 8 (Vista).
1312 DEBUG(3,("api_spoolss_addprinterdriverex: unknown SPOOL_Q_ADDPRINTERDRIVEREX level %u.\n",
1313 (unsigned int)q_u.level ));
1314 setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_INVALID_TAG));
1315 return True;
1317 DEBUG(0,("spoolss_io_q_addprinterdriverex: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVEREX.\n"));
1318 return False;
1321 r_u.status = _spoolss_addprinterdriverex(p, &q_u, &r_u);
1323 if(!spoolss_io_r_addprinterdriverex("", &r_u, rdata, 0)) {
1324 DEBUG(0,("spoolss_io_r_addprinterdriverex: unable to marshall SPOOL_R_ADDPRINTERDRIVEREX.\n"));
1325 return False;
1328 return True;
1331 /****************************************************************************
1332 ****************************************************************************/
1334 static bool api_spoolss_deleteprinterdriverex(pipes_struct *p)
1336 SPOOL_Q_DELETEPRINTERDRIVEREX q_u;
1337 SPOOL_R_DELETEPRINTERDRIVEREX r_u;
1338 prs_struct *data = &p->in_data.data;
1339 prs_struct *rdata = &p->out_data.rdata;
1341 ZERO_STRUCT(q_u);
1342 ZERO_STRUCT(r_u);
1344 if(!spoolss_io_q_deleteprinterdriverex("", &q_u, data, 0)) {
1345 DEBUG(0,("spoolss_io_q_deleteprinterdriverex: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVEREX.\n"));
1346 return False;
1349 r_u.status = _spoolss_deleteprinterdriverex(p, &q_u, &r_u);
1351 if(!spoolss_io_r_deleteprinterdriverex("", &r_u, rdata, 0)) {
1352 DEBUG(0,("spoolss_io_r_deleteprinterdriverex: unable to marshall SPOOL_R_DELETEPRINTERDRIVEREX.\n"));
1353 return False;
1356 return True;
1359 /****************************************************************************
1360 ****************************************************************************/
1362 static bool api_spoolss_xcvdataport(pipes_struct *p)
1364 SPOOL_Q_XCVDATAPORT q_u;
1365 SPOOL_R_XCVDATAPORT r_u;
1366 prs_struct *data = &p->in_data.data;
1367 prs_struct *rdata = &p->out_data.rdata;
1369 ZERO_STRUCT(q_u);
1370 ZERO_STRUCT(r_u);
1372 if(!spoolss_io_q_xcvdataport("", &q_u, data, 0)) {
1373 DEBUG(0,("spoolss_io_q_replyopenprinter: unable to unmarshall SPOOL_Q_XCVDATAPORT.\n"));
1374 return False;
1377 r_u.status = _spoolss_xcvdataport(p, &q_u, &r_u);
1379 if(!spoolss_io_r_xcvdataport("", &r_u, rdata, 0)) {
1380 DEBUG(0,("spoolss_io_r_replyopenprinter: unable to marshall SPOOL_R_XCVDATAPORT.\n"));
1381 return False;
1384 return True;
1387 /*******************************************************************
1388 \pipe\spoolss commands
1389 ********************************************************************/
1391 struct api_struct api_spoolss_cmds[] =
1393 {"SPOOLSS_OPENPRINTER", SPOOLSS_OPENPRINTER, api_spoolss_open_printer },
1394 {"SPOOLSS_OPENPRINTEREX", SPOOLSS_OPENPRINTEREX, api_spoolss_open_printer_ex },
1395 {"SPOOLSS_GETPRINTERDATA", SPOOLSS_GETPRINTERDATA, api_spoolss_getprinterdata },
1396 {"SPOOLSS_CLOSEPRINTER", SPOOLSS_CLOSEPRINTER, api_spoolss_closeprinter },
1397 {"SPOOLSS_DELETEPRINTER", SPOOLSS_DELETEPRINTER, api_spoolss_deleteprinter },
1398 {"SPOOLSS_ABORTPRINTER", SPOOLSS_ABORTPRINTER, api_spoolss_abortprinter },
1399 {"SPOOLSS_RFFPCNEX", SPOOLSS_RFFPCNEX, api_spoolss_rffpcnex },
1400 {"SPOOLSS_RFNPCNEX", SPOOLSS_RFNPCNEX, api_spoolss_rfnpcnex },
1401 {"SPOOLSS_ENUMPRINTERS", SPOOLSS_ENUMPRINTERS, api_spoolss_enumprinters },
1402 {"SPOOLSS_GETPRINTER", SPOOLSS_GETPRINTER, api_spoolss_getprinter },
1403 {"SPOOLSS_GETPRINTERDRIVER2", SPOOLSS_GETPRINTERDRIVER2, api_spoolss_getprinterdriver2 },
1404 {"SPOOLSS_STARTPAGEPRINTER", SPOOLSS_STARTPAGEPRINTER, api_spoolss_startpageprinter },
1405 {"SPOOLSS_ENDPAGEPRINTER", SPOOLSS_ENDPAGEPRINTER, api_spoolss_endpageprinter },
1406 {"SPOOLSS_STARTDOCPRINTER", SPOOLSS_STARTDOCPRINTER, api_spoolss_startdocprinter },
1407 {"SPOOLSS_ENDDOCPRINTER", SPOOLSS_ENDDOCPRINTER, api_spoolss_enddocprinter },
1408 {"SPOOLSS_WRITEPRINTER", SPOOLSS_WRITEPRINTER, api_spoolss_writeprinter },
1409 {"SPOOLSS_SETPRINTER", SPOOLSS_SETPRINTER, api_spoolss_setprinter },
1410 {"SPOOLSS_FCPN", SPOOLSS_FCPN, api_spoolss_fcpn },
1411 {"SPOOLSS_ADDJOB", SPOOLSS_ADDJOB, api_spoolss_addjob },
1412 {"SPOOLSS_ENUMJOBS", SPOOLSS_ENUMJOBS, api_spoolss_enumjobs },
1413 {"SPOOLSS_SCHEDULEJOB", SPOOLSS_SCHEDULEJOB, api_spoolss_schedulejob },
1414 {"SPOOLSS_SETJOB", SPOOLSS_SETJOB, api_spoolss_setjob },
1415 {"SPOOLSS_ENUMFORMS", SPOOLSS_ENUMFORMS, api_spoolss_enumforms },
1416 {"SPOOLSS_ENUMPORTS", SPOOLSS_ENUMPORTS, api_spoolss_enumports },
1417 {"SPOOLSS_ENUMPRINTERDRIVERS", SPOOLSS_ENUMPRINTERDRIVERS, api_spoolss_enumprinterdrivers },
1418 {"SPOOLSS_ADDPRINTEREX", SPOOLSS_ADDPRINTEREX, api_spoolss_addprinterex },
1419 {"SPOOLSS_ADDPRINTERDRIVER", SPOOLSS_ADDPRINTERDRIVER, api_spoolss_addprinterdriver },
1420 {"SPOOLSS_DELETEPRINTERDRIVER", SPOOLSS_DELETEPRINTERDRIVER, api_spoolss_deleteprinterdriver },
1421 {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_getprinterdriverdirectory },
1422 {"SPOOLSS_ENUMPRINTERDATA", SPOOLSS_ENUMPRINTERDATA, api_spoolss_enumprinterdata },
1423 {"SPOOLSS_SETPRINTERDATA", SPOOLSS_SETPRINTERDATA, api_spoolss_setprinterdata },
1424 {"SPOOLSS_RESETPRINTER", SPOOLSS_RESETPRINTER, api_spoolss_reset_printer },
1425 {"SPOOLSS_DELETEPRINTERDATA", SPOOLSS_DELETEPRINTERDATA, api_spoolss_deleteprinterdata },
1426 {"SPOOLSS_ADDFORM", SPOOLSS_ADDFORM, api_spoolss_addform },
1427 {"SPOOLSS_DELETEFORM", SPOOLSS_DELETEFORM, api_spoolss_deleteform },
1428 {"SPOOLSS_GETFORM", SPOOLSS_GETFORM, api_spoolss_getform },
1429 {"SPOOLSS_SETFORM", SPOOLSS_SETFORM, api_spoolss_setform },
1430 {"SPOOLSS_ADDPRINTPROCESSOR", SPOOLSS_ADDPRINTPROCESSOR, api_spoolss_addprintprocessor },
1431 {"SPOOLSS_ENUMPRINTPROCESSORS", SPOOLSS_ENUMPRINTPROCESSORS, api_spoolss_enumprintprocessors },
1432 {"SPOOLSS_ENUMMONITORS", SPOOLSS_ENUMMONITORS, api_spoolss_enumprintmonitors },
1433 {"SPOOLSS_GETJOB", SPOOLSS_GETJOB, api_spoolss_getjob },
1434 {"SPOOLSS_ENUMPRINTPROCDATATYPES", SPOOLSS_ENUMPRINTPROCDATATYPES, api_spoolss_enumprintprocdatatypes },
1435 {"SPOOLSS_GETPRINTERDATAEX", SPOOLSS_GETPRINTERDATAEX, api_spoolss_getprinterdataex },
1436 {"SPOOLSS_SETPRINTERDATAEX", SPOOLSS_SETPRINTERDATAEX, api_spoolss_setprinterdataex },
1437 {"SPOOLSS_DELETEPRINTERDATAEX", SPOOLSS_DELETEPRINTERDATAEX, api_spoolss_deleteprinterdataex },
1438 {"SPOOLSS_ENUMPRINTERDATAEX", SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_enumprinterdataex },
1439 {"SPOOLSS_ENUMPRINTERKEY", SPOOLSS_ENUMPRINTERKEY, api_spoolss_enumprinterkey },
1440 {"SPOOLSS_DELETEPRINTERKEY", SPOOLSS_DELETEPRINTERKEY, api_spoolss_deleteprinterkey },
1441 {"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory},
1442 {"SPOOLSS_ADDPRINTERDRIVEREX", SPOOLSS_ADDPRINTERDRIVEREX, api_spoolss_addprinterdriverex },
1443 {"SPOOLSS_DELETEPRINTERDRIVEREX", SPOOLSS_DELETEPRINTERDRIVEREX, api_spoolss_deleteprinterdriverex },
1444 {"SPOOLSS_XCVDATAPORT", SPOOLSS_XCVDATAPORT, api_spoolss_xcvdataport },
1447 void spoolss2_get_pipe_fns( struct api_struct **fns, int *n_fns )
1449 *fns = api_spoolss_cmds;
1450 *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
1453 NTSTATUS rpc_spoolss2_init(void)
1455 return rpc_srv_register(
1456 SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss",
1457 &ndr_table_spoolss,
1458 api_spoolss_cmds,
1459 sizeof(api_spoolss_cmds) / sizeof(struct api_struct));