First round of merging various UUID structures.
[Samba/gebeck_regimport.git] / source3 / rpc_server / srv_spoolss.c
blobf846813a40b86be85dc653b428e60ae4f316fc47
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 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.
26 #include "includes.h"
28 #undef DBGC_CLASS
29 #define DBGC_CLASS DBGC_RPC_SRV
31 /********************************************************************
32 * api_spoolss_open_printer_ex (rarely seen - older call)
33 ********************************************************************/
35 static BOOL api_spoolss_open_printer(pipes_struct *p)
37 SPOOL_Q_OPEN_PRINTER q_u;
38 SPOOL_R_OPEN_PRINTER r_u;
39 prs_struct *data = &p->in_data.data;
40 prs_struct *rdata = &p->out_data.rdata;
42 ZERO_STRUCT(q_u);
43 ZERO_STRUCT(r_u);
45 if (!spoolss_io_q_open_printer("", &q_u, data, 0)) {
46 DEBUG(0,("spoolss_io_q_open_printer: unable to unmarshall SPOOL_Q_OPEN_PRINTER.\n"));
47 return False;
50 r_u.status = _spoolss_open_printer( p, &q_u, &r_u);
52 if (!spoolss_io_r_open_printer("",&r_u,rdata,0)){
53 DEBUG(0,("spoolss_io_r_open_printer: unable to marshall SPOOL_R_OPEN_PRINTER.\n"));
54 return False;
57 return True;
61 /********************************************************************
62 * api_spoolss_open_printer_ex
63 ********************************************************************/
65 static BOOL api_spoolss_open_printer_ex(pipes_struct *p)
67 SPOOL_Q_OPEN_PRINTER_EX q_u;
68 SPOOL_R_OPEN_PRINTER_EX r_u;
69 prs_struct *data = &p->in_data.data;
70 prs_struct *rdata = &p->out_data.rdata;
72 ZERO_STRUCT(q_u);
73 ZERO_STRUCT(r_u);
75 if (!spoolss_io_q_open_printer_ex("", &q_u, data, 0)) {
76 DEBUG(0,("spoolss_io_q_open_printer_ex: unable to unmarshall SPOOL_Q_OPEN_PRINTER_EX.\n"));
77 return False;
80 r_u.status = _spoolss_open_printer_ex( p, &q_u, &r_u);
82 if (!spoolss_io_r_open_printer_ex("",&r_u,rdata,0)){
83 DEBUG(0,("spoolss_io_r_open_printer_ex: unable to marshall SPOOL_R_OPEN_PRINTER_EX.\n"));
84 return False;
87 return True;
90 /********************************************************************
91 * api_spoolss_getprinterdata
93 * called from the spoolss dispatcher
94 ********************************************************************/
96 static BOOL api_spoolss_getprinterdata(pipes_struct *p)
98 SPOOL_Q_GETPRINTERDATA q_u;
99 SPOOL_R_GETPRINTERDATA r_u;
100 prs_struct *data = &p->in_data.data;
101 prs_struct *rdata = &p->out_data.rdata;
103 ZERO_STRUCT(q_u);
104 ZERO_STRUCT(r_u);
106 /* read the stream and fill the struct */
107 if (!spoolss_io_q_getprinterdata("", &q_u, data, 0)) {
108 DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall SPOOL_Q_GETPRINTERDATA.\n"));
109 return False;
112 r_u.status = _spoolss_getprinterdata( p, &q_u, &r_u);
114 if (!spoolss_io_r_getprinterdata("", &r_u, rdata, 0)) {
115 DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall SPOOL_R_GETPRINTERDATA.\n"));
116 return False;
119 return True;
122 /********************************************************************
123 * api_spoolss_deleteprinterdata
125 * called from the spoolss dispatcher
126 ********************************************************************/
128 static BOOL api_spoolss_deleteprinterdata(pipes_struct *p)
130 SPOOL_Q_DELETEPRINTERDATA q_u;
131 SPOOL_R_DELETEPRINTERDATA r_u;
132 prs_struct *data = &p->in_data.data;
133 prs_struct *rdata = &p->out_data.rdata;
135 ZERO_STRUCT(q_u);
136 ZERO_STRUCT(r_u);
138 /* read the stream and fill the struct */
139 if (!spoolss_io_q_deleteprinterdata("", &q_u, data, 0)) {
140 DEBUG(0,("spoolss_io_q_deleteprinterdata: unable to unmarshall SPOOL_Q_DELETEPRINTERDATA.\n"));
141 return False;
144 r_u.status = _spoolss_deleteprinterdata( p, &q_u, &r_u );
146 if (!spoolss_io_r_deleteprinterdata("", &r_u, rdata, 0)) {
147 DEBUG(0,("spoolss_io_r_deleteprinterdata: unable to marshall SPOOL_R_DELETEPRINTERDATA.\n"));
148 return False;
151 return True;
154 /********************************************************************
155 * api_spoolss_closeprinter
157 * called from the spoolss dispatcher
158 ********************************************************************/
160 static BOOL api_spoolss_closeprinter(pipes_struct *p)
162 SPOOL_Q_CLOSEPRINTER q_u;
163 SPOOL_R_CLOSEPRINTER r_u;
164 prs_struct *data = &p->in_data.data;
165 prs_struct *rdata = &p->out_data.rdata;
167 ZERO_STRUCT(q_u);
168 ZERO_STRUCT(r_u);
170 if (!spoolss_io_q_closeprinter("", &q_u, data, 0)) {
171 DEBUG(0,("spoolss_io_q_closeprinter: unable to unmarshall SPOOL_Q_CLOSEPRINTER.\n"));
172 return False;
175 r_u.status = _spoolss_closeprinter(p, &q_u, &r_u);
177 if (!spoolss_io_r_closeprinter("",&r_u,rdata,0)) {
178 DEBUG(0,("spoolss_io_r_closeprinter: unable to marshall SPOOL_R_CLOSEPRINTER.\n"));
179 return False;
182 return True;
185 /********************************************************************
186 * api_spoolss_abortprinter
188 * called from the spoolss dispatcher
189 ********************************************************************/
191 static BOOL api_spoolss_abortprinter(pipes_struct *p)
193 SPOOL_Q_ABORTPRINTER q_u;
194 SPOOL_R_ABORTPRINTER r_u;
195 prs_struct *data = &p->in_data.data;
196 prs_struct *rdata = &p->out_data.rdata;
198 ZERO_STRUCT(q_u);
199 ZERO_STRUCT(r_u);
201 if (!spoolss_io_q_abortprinter("", &q_u, data, 0)) {
202 DEBUG(0,("spoolss_io_q_abortprinter: unable to unmarshall SPOOL_Q_ABORTPRINTER.\n"));
203 return False;
206 r_u.status = _spoolss_abortprinter(p, &q_u, &r_u);
208 if (!spoolss_io_r_abortprinter("",&r_u,rdata,0)) {
209 DEBUG(0,("spoolss_io_r_abortprinter: unable to marshall SPOOL_R_ABORTPRINTER.\n"));
210 return False;
213 return True;
216 /********************************************************************
217 * api_spoolss_deleteprinter
219 * called from the spoolss dispatcher
220 ********************************************************************/
222 static BOOL api_spoolss_deleteprinter(pipes_struct *p)
224 SPOOL_Q_DELETEPRINTER q_u;
225 SPOOL_R_DELETEPRINTER r_u;
226 prs_struct *data = &p->in_data.data;
227 prs_struct *rdata = &p->out_data.rdata;
229 ZERO_STRUCT(q_u);
230 ZERO_STRUCT(r_u);
232 if (!spoolss_io_q_deleteprinter("", &q_u, data, 0)) {
233 DEBUG(0,("spoolss_io_q_deleteprinter: unable to unmarshall SPOOL_Q_DELETEPRINTER.\n"));
234 return False;
237 r_u.status = _spoolss_deleteprinter(p, &q_u, &r_u);
239 if (!spoolss_io_r_deleteprinter("",&r_u,rdata,0)) {
240 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
241 return False;
244 return True;
248 /********************************************************************
249 * api_spoolss_deleteprinterdriver
251 * called from the spoolss dispatcher
252 ********************************************************************/
254 static BOOL api_spoolss_deleteprinterdriver(pipes_struct *p)
256 SPOOL_Q_DELETEPRINTERDRIVER q_u;
257 SPOOL_R_DELETEPRINTERDRIVER r_u;
258 prs_struct *data = &p->in_data.data;
259 prs_struct *rdata = &p->out_data.rdata;
261 ZERO_STRUCT(q_u);
262 ZERO_STRUCT(r_u);
264 if (!spoolss_io_q_deleteprinterdriver("", &q_u, data, 0)) {
265 DEBUG(0,("spoolss_io_q_deleteprinterdriver: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVER.\n"));
266 return False;
269 r_u.status = _spoolss_deleteprinterdriver(p, &q_u, &r_u);
271 if (!spoolss_io_r_deleteprinterdriver("",&r_u,rdata,0)) {
272 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
273 return False;
276 return True;
280 /********************************************************************
281 * api_spoolss_rffpcnex
282 * ReplyFindFirstPrinterChangeNotifyEx
283 ********************************************************************/
285 static BOOL api_spoolss_rffpcnex(pipes_struct *p)
287 SPOOL_Q_RFFPCNEX q_u;
288 SPOOL_R_RFFPCNEX r_u;
289 prs_struct *data = &p->in_data.data;
290 prs_struct *rdata = &p->out_data.rdata;
292 ZERO_STRUCT(q_u);
293 ZERO_STRUCT(r_u);
295 if (!spoolss_io_q_rffpcnex("", &q_u, data, 0)) {
296 DEBUG(0,("spoolss_io_q_rffpcnex: unable to unmarshall SPOOL_Q_RFFPCNEX.\n"));
297 return False;
300 r_u.status = _spoolss_rffpcnex(p, &q_u, &r_u);
302 if (!spoolss_io_r_rffpcnex("", &r_u, rdata, 0)) {
303 DEBUG(0,("spoolss_io_r_rffpcnex: unable to marshall SPOOL_R_RFFPCNEX.\n"));
304 return False;
307 return True;
311 /********************************************************************
312 * api_spoolss_rfnpcnex
313 * ReplyFindNextPrinterChangeNotifyEx
314 * called from the spoolss dispatcher
316 * Note - this is the *ONLY* function that breaks the RPC call
317 * symmetry in all the other calls. We need to do this to fix
318 * the massive memory allocation problem with thousands of jobs...
319 * JRA.
320 ********************************************************************/
322 static BOOL api_spoolss_rfnpcnex(pipes_struct *p)
324 SPOOL_Q_RFNPCNEX q_u;
325 SPOOL_R_RFNPCNEX r_u;
326 prs_struct *data = &p->in_data.data;
327 prs_struct *rdata = &p->out_data.rdata;
329 ZERO_STRUCT(q_u);
330 ZERO_STRUCT(r_u);
332 if (!spoolss_io_q_rfnpcnex("", &q_u, data, 0)) {
333 DEBUG(0,("spoolss_io_q_rfnpcnex: unable to unmarshall SPOOL_Q_RFNPCNEX.\n"));
334 return False;
337 r_u.status = _spoolss_rfnpcnex(p, &q_u, &r_u);
339 if (!spoolss_io_r_rfnpcnex("", &r_u, rdata, 0)) {
340 SAFE_FREE(r_u.info.data);
341 DEBUG(0,("spoolss_io_r_rfnpcnex: unable to marshall SPOOL_R_RFNPCNEX.\n"));
342 return False;
345 SAFE_FREE(r_u.info.data);
347 return True;
351 /********************************************************************
352 * api_spoolss_enumprinters
353 * called from the spoolss dispatcher
355 ********************************************************************/
357 static BOOL api_spoolss_enumprinters(pipes_struct *p)
359 SPOOL_Q_ENUMPRINTERS q_u;
360 SPOOL_R_ENUMPRINTERS r_u;
361 prs_struct *data = &p->in_data.data;
362 prs_struct *rdata = &p->out_data.rdata;
364 ZERO_STRUCT(q_u);
365 ZERO_STRUCT(r_u);
367 if (!spoolss_io_q_enumprinters("", &q_u, data, 0)) {
368 DEBUG(0,("spoolss_io_q_enumprinters: unable to unmarshall SPOOL_Q_ENUMPRINTERS.\n"));
369 return False;
372 r_u.status = _spoolss_enumprinters( p, &q_u, &r_u);
374 if (!spoolss_io_r_enumprinters("", &r_u, rdata, 0)) {
375 DEBUG(0,("spoolss_io_r_enumprinters: unable to marshall SPOOL_R_ENUMPRINTERS.\n"));
376 return False;
379 return True;
382 /********************************************************************
383 * api_spoolss_getprinter
384 * called from the spoolss dispatcher
386 ********************************************************************/
388 static BOOL api_spoolss_getprinter(pipes_struct *p)
390 SPOOL_Q_GETPRINTER q_u;
391 SPOOL_R_GETPRINTER r_u;
392 prs_struct *data = &p->in_data.data;
393 prs_struct *rdata = &p->out_data.rdata;
395 ZERO_STRUCT(q_u);
396 ZERO_STRUCT(r_u);
398 if(!spoolss_io_q_getprinter("", &q_u, data, 0)) {
399 DEBUG(0,("spoolss_io_q_getprinter: unable to unmarshall SPOOL_Q_GETPRINTER.\n"));
400 return False;
403 r_u.status = _spoolss_getprinter(p, &q_u, &r_u);
405 if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {
406 DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));
407 return False;
410 return True;
413 /********************************************************************
414 * api_spoolss_getprinter
415 * called from the spoolss dispatcher
417 ********************************************************************/
419 static BOOL api_spoolss_getprinterdriver2(pipes_struct *p)
421 SPOOL_Q_GETPRINTERDRIVER2 q_u;
422 SPOOL_R_GETPRINTERDRIVER2 r_u;
423 prs_struct *data = &p->in_data.data;
424 prs_struct *rdata = &p->out_data.rdata;
426 ZERO_STRUCT(q_u);
427 ZERO_STRUCT(r_u);
429 if(!spoolss_io_q_getprinterdriver2("", &q_u, data, 0)) {
430 DEBUG(0,("spoolss_io_q_getprinterdriver2: unable to unmarshall SPOOL_Q_GETPRINTERDRIVER2.\n"));
431 return False;
434 r_u.status = _spoolss_getprinterdriver2(p, &q_u, &r_u);
436 if(!spoolss_io_r_getprinterdriver2("",&r_u,rdata,0)) {
437 DEBUG(0,("spoolss_io_r_getprinterdriver2: unable to marshall SPOOL_R_GETPRINTERDRIVER2.\n"));
438 return False;
441 return True;
444 /********************************************************************
445 * api_spoolss_getprinter
446 * called from the spoolss dispatcher
448 ********************************************************************/
450 static BOOL api_spoolss_startpageprinter(pipes_struct *p)
452 SPOOL_Q_STARTPAGEPRINTER q_u;
453 SPOOL_R_STARTPAGEPRINTER r_u;
454 prs_struct *data = &p->in_data.data;
455 prs_struct *rdata = &p->out_data.rdata;
457 ZERO_STRUCT(q_u);
458 ZERO_STRUCT(r_u);
460 if(!spoolss_io_q_startpageprinter("", &q_u, data, 0)) {
461 DEBUG(0,("spoolss_io_q_startpageprinter: unable to unmarshall SPOOL_Q_STARTPAGEPRINTER.\n"));
462 return False;
465 r_u.status = _spoolss_startpageprinter(p, &q_u, &r_u);
467 if(!spoolss_io_r_startpageprinter("",&r_u,rdata,0)) {
468 DEBUG(0,("spoolss_io_r_startpageprinter: unable to marshall SPOOL_R_STARTPAGEPRINTER.\n"));
469 return False;
472 return True;
475 /********************************************************************
476 * api_spoolss_getprinter
477 * called from the spoolss dispatcher
479 ********************************************************************/
481 static BOOL api_spoolss_endpageprinter(pipes_struct *p)
483 SPOOL_Q_ENDPAGEPRINTER q_u;
484 SPOOL_R_ENDPAGEPRINTER r_u;
485 prs_struct *data = &p->in_data.data;
486 prs_struct *rdata = &p->out_data.rdata;
488 ZERO_STRUCT(q_u);
489 ZERO_STRUCT(r_u);
491 if(!spoolss_io_q_endpageprinter("", &q_u, data, 0)) {
492 DEBUG(0,("spoolss_io_q_endpageprinter: unable to unmarshall SPOOL_Q_ENDPAGEPRINTER.\n"));
493 return False;
496 r_u.status = _spoolss_endpageprinter(p, &q_u, &r_u);
498 if(!spoolss_io_r_endpageprinter("",&r_u,rdata,0)) {
499 DEBUG(0,("spoolss_io_r_endpageprinter: unable to marshall SPOOL_R_ENDPAGEPRINTER.\n"));
500 return False;
503 return True;
506 /********************************************************************
507 ********************************************************************/
509 static BOOL api_spoolss_startdocprinter(pipes_struct *p)
511 SPOOL_Q_STARTDOCPRINTER q_u;
512 SPOOL_R_STARTDOCPRINTER r_u;
513 prs_struct *data = &p->in_data.data;
514 prs_struct *rdata = &p->out_data.rdata;
516 ZERO_STRUCT(q_u);
517 ZERO_STRUCT(r_u);
519 if(!spoolss_io_q_startdocprinter("", &q_u, data, 0)) {
520 DEBUG(0,("spoolss_io_q_startdocprinter: unable to unmarshall SPOOL_Q_STARTDOCPRINTER.\n"));
521 return False;
524 r_u.status = _spoolss_startdocprinter(p, &q_u, &r_u);
526 if(!spoolss_io_r_startdocprinter("",&r_u,rdata,0)) {
527 DEBUG(0,("spoolss_io_r_startdocprinter: unable to marshall SPOOL_R_STARTDOCPRINTER.\n"));
528 return False;
531 return True;
534 /********************************************************************
535 ********************************************************************/
537 static BOOL api_spoolss_enddocprinter(pipes_struct *p)
539 SPOOL_Q_ENDDOCPRINTER q_u;
540 SPOOL_R_ENDDOCPRINTER r_u;
541 prs_struct *data = &p->in_data.data;
542 prs_struct *rdata = &p->out_data.rdata;
544 ZERO_STRUCT(q_u);
545 ZERO_STRUCT(r_u);
547 if(!spoolss_io_q_enddocprinter("", &q_u, data, 0)) {
548 DEBUG(0,("spoolss_io_q_enddocprinter: unable to unmarshall SPOOL_Q_ENDDOCPRINTER.\n"));
549 return False;
552 r_u.status = _spoolss_enddocprinter(p, &q_u, &r_u);
554 if(!spoolss_io_r_enddocprinter("",&r_u,rdata,0)) {
555 DEBUG(0,("spoolss_io_r_enddocprinter: unable to marshall SPOOL_R_ENDDOCPRINTER.\n"));
556 return False;
559 return True;
562 /********************************************************************
563 ********************************************************************/
565 static BOOL api_spoolss_writeprinter(pipes_struct *p)
567 SPOOL_Q_WRITEPRINTER q_u;
568 SPOOL_R_WRITEPRINTER r_u;
569 prs_struct *data = &p->in_data.data;
570 prs_struct *rdata = &p->out_data.rdata;
572 ZERO_STRUCT(q_u);
573 ZERO_STRUCT(r_u);
575 if(!spoolss_io_q_writeprinter("", &q_u, data, 0)) {
576 DEBUG(0,("spoolss_io_q_writeprinter: unable to unmarshall SPOOL_Q_WRITEPRINTER.\n"));
577 return False;
580 r_u.status = _spoolss_writeprinter(p, &q_u, &r_u);
582 if(!spoolss_io_r_writeprinter("",&r_u,rdata,0)) {
583 DEBUG(0,("spoolss_io_r_writeprinter: unable to marshall SPOOL_R_WRITEPRINTER.\n"));
584 return False;
587 return True;
590 /****************************************************************************
592 ****************************************************************************/
594 static BOOL api_spoolss_setprinter(pipes_struct *p)
596 SPOOL_Q_SETPRINTER q_u;
597 SPOOL_R_SETPRINTER r_u;
598 prs_struct *data = &p->in_data.data;
599 prs_struct *rdata = &p->out_data.rdata;
601 ZERO_STRUCT(q_u);
602 ZERO_STRUCT(r_u);
604 if(!spoolss_io_q_setprinter("", &q_u, data, 0)) {
605 DEBUG(0,("spoolss_io_q_setprinter: unable to unmarshall SPOOL_Q_SETPRINTER.\n"));
606 return False;
609 r_u.status = _spoolss_setprinter(p, &q_u, &r_u);
611 if(!spoolss_io_r_setprinter("",&r_u,rdata,0)) {
612 DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n"));
613 return False;
616 return True;
619 /****************************************************************************
620 ****************************************************************************/
622 static BOOL api_spoolss_fcpn(pipes_struct *p)
624 SPOOL_Q_FCPN q_u;
625 SPOOL_R_FCPN r_u;
626 prs_struct *data = &p->in_data.data;
627 prs_struct *rdata = &p->out_data.rdata;
629 ZERO_STRUCT(q_u);
630 ZERO_STRUCT(r_u);
632 if(!spoolss_io_q_fcpn("", &q_u, data, 0)) {
633 DEBUG(0,("spoolss_io_q_fcpn: unable to unmarshall SPOOL_Q_FCPN.\n"));
634 return False;
637 r_u.status = _spoolss_fcpn(p, &q_u, &r_u);
639 if(!spoolss_io_r_fcpn("",&r_u,rdata,0)) {
640 DEBUG(0,("spoolss_io_r_fcpn: unable to marshall SPOOL_R_FCPN.\n"));
641 return False;
644 return True;
647 /****************************************************************************
648 ****************************************************************************/
650 static BOOL api_spoolss_addjob(pipes_struct *p)
652 SPOOL_Q_ADDJOB q_u;
653 SPOOL_R_ADDJOB r_u;
654 prs_struct *data = &p->in_data.data;
655 prs_struct *rdata = &p->out_data.rdata;
657 ZERO_STRUCT(q_u);
658 ZERO_STRUCT(r_u);
660 if(!spoolss_io_q_addjob("", &q_u, data, 0)) {
661 DEBUG(0,("spoolss_io_q_addjob: unable to unmarshall SPOOL_Q_ADDJOB.\n"));
662 return False;
665 r_u.status = _spoolss_addjob(p, &q_u, &r_u);
667 if(!spoolss_io_r_addjob("",&r_u,rdata,0)) {
668 DEBUG(0,("spoolss_io_r_addjob: unable to marshall SPOOL_R_ADDJOB.\n"));
669 return False;
672 return True;
675 /****************************************************************************
676 ****************************************************************************/
678 static BOOL api_spoolss_enumjobs(pipes_struct *p)
680 SPOOL_Q_ENUMJOBS q_u;
681 SPOOL_R_ENUMJOBS r_u;
682 prs_struct *data = &p->in_data.data;
683 prs_struct *rdata = &p->out_data.rdata;
685 ZERO_STRUCT(q_u);
686 ZERO_STRUCT(r_u);
688 if (!spoolss_io_q_enumjobs("", &q_u, data, 0)) {
689 DEBUG(0,("spoolss_io_q_enumjobs: unable to unmarshall SPOOL_Q_ENUMJOBS.\n"));
690 return False;
693 r_u.status = _spoolss_enumjobs(p, &q_u, &r_u);
695 if (!spoolss_io_r_enumjobs("",&r_u,rdata,0)) {
696 DEBUG(0,("spoolss_io_r_enumjobs: unable to marshall SPOOL_R_ENUMJOBS.\n"));
697 return False;
700 return True;
703 /****************************************************************************
704 ****************************************************************************/
706 static BOOL api_spoolss_schedulejob(pipes_struct *p)
708 SPOOL_Q_SCHEDULEJOB q_u;
709 SPOOL_R_SCHEDULEJOB r_u;
710 prs_struct *data = &p->in_data.data;
711 prs_struct *rdata = &p->out_data.rdata;
713 ZERO_STRUCT(q_u);
714 ZERO_STRUCT(r_u);
716 if(!spoolss_io_q_schedulejob("", &q_u, data, 0)) {
717 DEBUG(0,("spoolss_io_q_schedulejob: unable to unmarshall SPOOL_Q_SCHEDULEJOB.\n"));
718 return False;
721 r_u.status = _spoolss_schedulejob(p, &q_u, &r_u);
723 if(!spoolss_io_r_schedulejob("",&r_u,rdata,0)) {
724 DEBUG(0,("spoolss_io_r_schedulejob: unable to marshall SPOOL_R_SCHEDULEJOB.\n"));
725 return False;
728 return True;
731 /****************************************************************************
732 ****************************************************************************/
734 static BOOL api_spoolss_setjob(pipes_struct *p)
736 SPOOL_Q_SETJOB q_u;
737 SPOOL_R_SETJOB r_u;
738 prs_struct *data = &p->in_data.data;
739 prs_struct *rdata = &p->out_data.rdata;
741 ZERO_STRUCT(q_u);
742 ZERO_STRUCT(r_u);
744 if(!spoolss_io_q_setjob("", &q_u, data, 0)) {
745 DEBUG(0,("spoolss_io_q_setjob: unable to unmarshall SPOOL_Q_SETJOB.\n"));
746 return False;
749 r_u.status = _spoolss_setjob(p, &q_u, &r_u);
751 if(!spoolss_io_r_setjob("",&r_u,rdata,0)) {
752 DEBUG(0,("spoolss_io_r_setjob: unable to marshall SPOOL_R_SETJOB.\n"));
753 return False;
756 return True;
759 /****************************************************************************
760 ****************************************************************************/
762 static BOOL api_spoolss_enumprinterdrivers(pipes_struct *p)
764 SPOOL_Q_ENUMPRINTERDRIVERS q_u;
765 SPOOL_R_ENUMPRINTERDRIVERS r_u;
766 prs_struct *data = &p->in_data.data;
767 prs_struct *rdata = &p->out_data.rdata;
769 ZERO_STRUCT(q_u);
770 ZERO_STRUCT(r_u);
772 if (!spoolss_io_q_enumprinterdrivers("", &q_u, data, 0)) {
773 DEBUG(0,("spoolss_io_q_enumprinterdrivers: unable to unmarshall SPOOL_Q_ENUMPRINTERDRIVERS.\n"));
774 return False;
777 r_u.status = _spoolss_enumprinterdrivers(p, &q_u, &r_u);
779 if (!spoolss_io_r_enumprinterdrivers("",&r_u,rdata,0)) {
780 DEBUG(0,("spoolss_io_r_enumprinterdrivers: unable to marshall SPOOL_R_ENUMPRINTERDRIVERS.\n"));
781 return False;
784 return True;
787 /****************************************************************************
788 ****************************************************************************/
790 static BOOL api_spoolss_getform(pipes_struct *p)
792 SPOOL_Q_GETFORM q_u;
793 SPOOL_R_GETFORM r_u;
794 prs_struct *data = &p->in_data.data;
795 prs_struct *rdata = &p->out_data.rdata;
797 ZERO_STRUCT(q_u);
798 ZERO_STRUCT(r_u);
800 if (!spoolss_io_q_getform("", &q_u, data, 0)) {
801 DEBUG(0,("spoolss_io_q_getform: unable to unmarshall SPOOL_Q_GETFORM.\n"));
802 return False;
805 r_u.status = _spoolss_getform(p, &q_u, &r_u);
807 if (!spoolss_io_r_getform("",&r_u,rdata,0)) {
808 DEBUG(0,("spoolss_io_r_getform: unable to marshall SPOOL_R_GETFORM.\n"));
809 return False;
812 return True;
815 /****************************************************************************
816 ****************************************************************************/
818 static BOOL api_spoolss_enumforms(pipes_struct *p)
820 SPOOL_Q_ENUMFORMS q_u;
821 SPOOL_R_ENUMFORMS 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_enumforms("", &q_u, data, 0)) {
829 DEBUG(0,("spoolss_io_q_enumforms: unable to unmarshall SPOOL_Q_ENUMFORMS.\n"));
830 return False;
833 r_u.status = _spoolss_enumforms(p, &q_u, &r_u);
835 if (!spoolss_io_r_enumforms("",&r_u,rdata,0)) {
836 DEBUG(0,("spoolss_io_r_enumforms: unable to marshall SPOOL_R_ENUMFORMS.\n"));
837 return False;
840 return True;
843 /****************************************************************************
844 ****************************************************************************/
846 static BOOL api_spoolss_enumports(pipes_struct *p)
848 SPOOL_Q_ENUMPORTS q_u;
849 SPOOL_R_ENUMPORTS 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_enumports("", &q_u, data, 0)) {
857 DEBUG(0,("spoolss_io_q_enumports: unable to unmarshall SPOOL_Q_ENUMPORTS.\n"));
858 return False;
861 r_u.status = _spoolss_enumports(p, &q_u, &r_u);
863 if (!spoolss_io_r_enumports("",&r_u,rdata,0)) {
864 DEBUG(0,("spoolss_io_r_enumports: unable to marshall SPOOL_R_ENUMPORTS.\n"));
865 return False;
868 return True;
871 /****************************************************************************
872 ****************************************************************************/
874 static BOOL api_spoolss_addprinterex(pipes_struct *p)
876 SPOOL_Q_ADDPRINTEREX q_u;
877 SPOOL_R_ADDPRINTEREX 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_addprinterex("", &q_u, data, 0)) {
885 DEBUG(0,("spoolss_io_q_addprinterex: unable to unmarshall SPOOL_Q_ADDPRINTEREX.\n"));
886 return False;
889 r_u.status = _spoolss_addprinterex(p, &q_u, &r_u);
891 if(!spoolss_io_r_addprinterex("", &r_u, rdata, 0)) {
892 DEBUG(0,("spoolss_io_r_addprinterex: unable to marshall SPOOL_R_ADDPRINTEREX.\n"));
893 return False;
896 return True;
899 /****************************************************************************
900 ****************************************************************************/
902 static BOOL api_spoolss_addprinterdriver(pipes_struct *p)
904 SPOOL_Q_ADDPRINTERDRIVER q_u;
905 SPOOL_R_ADDPRINTERDRIVER r_u;
906 prs_struct *data = &p->in_data.data;
907 prs_struct *rdata = &p->out_data.rdata;
909 ZERO_STRUCT(q_u);
910 ZERO_STRUCT(r_u);
912 if(!spoolss_io_q_addprinterdriver("", &q_u, data, 0)) {
913 DEBUG(0,("spoolss_io_q_addprinterdriver: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVER.\n"));
914 return False;
917 r_u.status = _spoolss_addprinterdriver(p, &q_u, &r_u);
919 if(!spoolss_io_r_addprinterdriver("", &r_u, rdata, 0)) {
920 DEBUG(0,("spoolss_io_r_addprinterdriver: unable to marshall SPOOL_R_ADDPRINTERDRIVER.\n"));
921 return False;
924 return True;
927 /****************************************************************************
928 ****************************************************************************/
930 static BOOL api_spoolss_getprinterdriverdirectory(pipes_struct *p)
932 SPOOL_Q_GETPRINTERDRIVERDIR q_u;
933 SPOOL_R_GETPRINTERDRIVERDIR r_u;
934 prs_struct *data = &p->in_data.data;
935 prs_struct *rdata = &p->out_data.rdata;
937 ZERO_STRUCT(q_u);
938 ZERO_STRUCT(r_u);
940 if(!spoolss_io_q_getprinterdriverdir("", &q_u, data, 0)) {
941 DEBUG(0,("spoolss_io_q_getprinterdriverdir: unable to unmarshall SPOOL_Q_GETPRINTERDRIVERDIR.\n"));
942 return False;
945 r_u.status = _spoolss_getprinterdriverdirectory(p, &q_u, &r_u);
947 if(!spoolss_io_r_getprinterdriverdir("", &r_u, rdata, 0)) {
948 DEBUG(0,("spoolss_io_r_getprinterdriverdir: unable to marshall SPOOL_R_GETPRINTERDRIVERDIR.\n"));
949 return False;
952 return True;
955 /****************************************************************************
956 ****************************************************************************/
958 static BOOL api_spoolss_enumprinterdata(pipes_struct *p)
960 SPOOL_Q_ENUMPRINTERDATA q_u;
961 SPOOL_R_ENUMPRINTERDATA r_u;
962 prs_struct *data = &p->in_data.data;
963 prs_struct *rdata = &p->out_data.rdata;
965 ZERO_STRUCT(q_u);
966 ZERO_STRUCT(r_u);
968 if(!spoolss_io_q_enumprinterdata("", &q_u, data, 0)) {
969 DEBUG(0,("spoolss_io_q_enumprinterdata: unable to unmarshall SPOOL_Q_ENUMPRINTERDATA.\n"));
970 return False;
973 r_u.status = _spoolss_enumprinterdata(p, &q_u, &r_u);
975 if(!spoolss_io_r_enumprinterdata("", &r_u, rdata, 0)) {
976 DEBUG(0,("spoolss_io_r_enumprinterdata: unable to marshall SPOOL_R_ENUMPRINTERDATA.\n"));
977 return False;
980 return True;
983 /****************************************************************************
984 ****************************************************************************/
986 static BOOL api_spoolss_setprinterdata(pipes_struct *p)
988 SPOOL_Q_SETPRINTERDATA q_u;
989 SPOOL_R_SETPRINTERDATA r_u;
990 prs_struct *data = &p->in_data.data;
991 prs_struct *rdata = &p->out_data.rdata;
993 ZERO_STRUCT(q_u);
994 ZERO_STRUCT(r_u);
996 if(!spoolss_io_q_setprinterdata("", &q_u, data, 0)) {
997 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
998 return False;
1001 r_u.status = _spoolss_setprinterdata(p, &q_u, &r_u);
1003 if(!spoolss_io_r_setprinterdata("", &r_u, rdata, 0)) {
1004 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_SETPRINTERDATA.\n"));
1005 return False;
1008 return True;
1011 /****************************************************************************
1012 ****************************************************************************/
1013 static BOOL api_spoolss_reset_printer(pipes_struct *p)
1015 SPOOL_Q_RESETPRINTER q_u;
1016 SPOOL_R_RESETPRINTER r_u;
1017 prs_struct *data = &p->in_data.data;
1018 prs_struct *rdata = &p->out_data.rdata;
1020 ZERO_STRUCT(q_u);
1021 ZERO_STRUCT(r_u);
1023 if(!spoolss_io_q_resetprinter("", &q_u, data, 0)) {
1024 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
1025 return False;
1028 r_u.status = _spoolss_resetprinter(p, &q_u, &r_u);
1030 if(!spoolss_io_r_resetprinter("", &r_u, rdata, 0)) {
1031 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_RESETPRINTER.\n"));
1032 return False;
1035 return True;
1038 /****************************************************************************
1039 ****************************************************************************/
1040 static BOOL api_spoolss_addform(pipes_struct *p)
1042 SPOOL_Q_ADDFORM q_u;
1043 SPOOL_R_ADDFORM 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_addform("", &q_u, data, 0)) {
1051 DEBUG(0,("spoolss_io_q_addform: unable to unmarshall SPOOL_Q_ADDFORM.\n"));
1052 return False;
1055 r_u.status = _spoolss_addform(p, &q_u, &r_u);
1057 if(!spoolss_io_r_addform("", &r_u, rdata, 0)) {
1058 DEBUG(0,("spoolss_io_r_addform: unable to marshall SPOOL_R_ADDFORM.\n"));
1059 return False;
1062 return True;
1065 /****************************************************************************
1066 ****************************************************************************/
1068 static BOOL api_spoolss_deleteform(pipes_struct *p)
1070 SPOOL_Q_DELETEFORM q_u;
1071 SPOOL_R_DELETEFORM 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_deleteform("", &q_u, data, 0)) {
1079 DEBUG(0,("spoolss_io_q_deleteform: unable to unmarshall SPOOL_Q_DELETEFORM.\n"));
1080 return False;
1083 r_u.status = _spoolss_deleteform(p, &q_u, &r_u);
1085 if(!spoolss_io_r_deleteform("", &r_u, rdata, 0)) {
1086 DEBUG(0,("spoolss_io_r_deleteform: unable to marshall SPOOL_R_DELETEFORM.\n"));
1087 return False;
1090 return True;
1093 /****************************************************************************
1094 ****************************************************************************/
1096 static BOOL api_spoolss_setform(pipes_struct *p)
1098 SPOOL_Q_SETFORM q_u;
1099 SPOOL_R_SETFORM r_u;
1100 prs_struct *data = &p->in_data.data;
1101 prs_struct *rdata = &p->out_data.rdata;
1103 ZERO_STRUCT(q_u);
1104 ZERO_STRUCT(r_u);
1106 if(!spoolss_io_q_setform("", &q_u, data, 0)) {
1107 DEBUG(0,("spoolss_io_q_setform: unable to unmarshall SPOOL_Q_SETFORM.\n"));
1108 return False;
1111 r_u.status = _spoolss_setform(p, &q_u, &r_u);
1113 if(!spoolss_io_r_setform("", &r_u, rdata, 0)) {
1114 DEBUG(0,("spoolss_io_r_setform: unable to marshall SPOOL_R_SETFORM.\n"));
1115 return False;
1118 return True;
1121 /****************************************************************************
1122 ****************************************************************************/
1124 static BOOL api_spoolss_enumprintprocessors(pipes_struct *p)
1126 SPOOL_Q_ENUMPRINTPROCESSORS q_u;
1127 SPOOL_R_ENUMPRINTPROCESSORS r_u;
1128 prs_struct *data = &p->in_data.data;
1129 prs_struct *rdata = &p->out_data.rdata;
1131 ZERO_STRUCT(q_u);
1132 ZERO_STRUCT(r_u);
1134 if(!spoolss_io_q_enumprintprocessors("", &q_u, data, 0)) {
1135 DEBUG(0,("spoolss_io_q_enumprintprocessors: unable to unmarshall SPOOL_Q_ENUMPRINTPROCESSORS.\n"));
1136 return False;
1139 r_u.status = _spoolss_enumprintprocessors(p, &q_u, &r_u);
1141 if(!spoolss_io_r_enumprintprocessors("", &r_u, rdata, 0)) {
1142 DEBUG(0,("spoolss_io_r_enumprintprocessors: unable to marshall SPOOL_R_ENUMPRINTPROCESSORS.\n"));
1143 return False;
1146 return True;
1149 /****************************************************************************
1150 ****************************************************************************/
1152 static BOOL api_spoolss_addprintprocessor(pipes_struct *p)
1154 SPOOL_Q_ADDPRINTPROCESSOR q_u;
1155 SPOOL_R_ADDPRINTPROCESSOR r_u;
1156 prs_struct *data = &p->in_data.data;
1157 prs_struct *rdata = &p->out_data.rdata;
1159 ZERO_STRUCT(q_u);
1160 ZERO_STRUCT(r_u);
1162 if(!spoolss_io_q_addprintprocessor("", &q_u, data, 0)) {
1163 DEBUG(0,("spoolss_io_q_addprintprocessor: unable to unmarshall SPOOL_Q_ADDPRINTPROCESSOR.\n"));
1164 return False;
1167 /* for now, just indicate success and ignore the add. We'll
1168 automatically set the winprint processor for printer
1169 entries later. Used to debug the LexMark Optra S 1855 PCL
1170 driver --jerry */
1171 r_u.status = WERR_OK;
1173 if(!spoolss_io_r_addprintprocessor("", &r_u, rdata, 0)) {
1174 DEBUG(0,("spoolss_io_r_addprintprocessor: unable to marshall SPOOL_R_ADDPRINTPROCESSOR.\n"));
1175 return False;
1178 return True;
1181 /****************************************************************************
1182 ****************************************************************************/
1184 static BOOL api_spoolss_enumprintprocdatatypes(pipes_struct *p)
1186 SPOOL_Q_ENUMPRINTPROCDATATYPES q_u;
1187 SPOOL_R_ENUMPRINTPROCDATATYPES r_u;
1188 prs_struct *data = &p->in_data.data;
1189 prs_struct *rdata = &p->out_data.rdata;
1191 ZERO_STRUCT(q_u);
1192 ZERO_STRUCT(r_u);
1194 if(!spoolss_io_q_enumprintprocdatatypes("", &q_u, data, 0)) {
1195 DEBUG(0,("spoolss_io_q_enumprintprocdatatypes: unable to unmarshall SPOOL_Q_ENUMPRINTPROCDATATYPES.\n"));
1196 return False;
1199 r_u.status = _spoolss_enumprintprocdatatypes(p, &q_u, &r_u);
1201 if(!spoolss_io_r_enumprintprocdatatypes("", &r_u, rdata, 0)) {
1202 DEBUG(0,("spoolss_io_r_enumprintprocdatatypes: unable to marshall SPOOL_R_ENUMPRINTPROCDATATYPES.\n"));
1203 return False;
1206 return True;
1209 /****************************************************************************
1210 ****************************************************************************/
1212 static BOOL api_spoolss_enumprintmonitors(pipes_struct *p)
1214 SPOOL_Q_ENUMPRINTMONITORS q_u;
1215 SPOOL_R_ENUMPRINTMONITORS r_u;
1216 prs_struct *data = &p->in_data.data;
1217 prs_struct *rdata = &p->out_data.rdata;
1219 ZERO_STRUCT(q_u);
1220 ZERO_STRUCT(r_u);
1222 if (!spoolss_io_q_enumprintmonitors("", &q_u, data, 0)) {
1223 DEBUG(0,("spoolss_io_q_enumprintmonitors: unable to unmarshall SPOOL_Q_ENUMPRINTMONITORS.\n"));
1224 return False;
1227 r_u.status = _spoolss_enumprintmonitors(p, &q_u, &r_u);
1229 if (!spoolss_io_r_enumprintmonitors("", &r_u, rdata, 0)) {
1230 DEBUG(0,("spoolss_io_r_enumprintmonitors: unable to marshall SPOOL_R_ENUMPRINTMONITORS.\n"));
1231 return False;
1234 return True;
1237 /****************************************************************************
1238 ****************************************************************************/
1240 static BOOL api_spoolss_getjob(pipes_struct *p)
1242 SPOOL_Q_GETJOB q_u;
1243 SPOOL_R_GETJOB r_u;
1244 prs_struct *data = &p->in_data.data;
1245 prs_struct *rdata = &p->out_data.rdata;
1247 if(!spoolss_io_q_getjob("", &q_u, data, 0)) {
1248 DEBUG(0,("spoolss_io_q_getjob: unable to unmarshall SPOOL_Q_GETJOB.\n"));
1249 return False;
1252 r_u.status = _spoolss_getjob(p, &q_u, &r_u);
1254 if(!spoolss_io_r_getjob("",&r_u,rdata,0)) {
1255 DEBUG(0,("spoolss_io_r_getjob: unable to marshall SPOOL_R_GETJOB.\n"));
1256 return False;
1259 return True;
1262 /********************************************************************
1263 * api_spoolss_getprinterdataex
1265 * called from the spoolss dispatcher
1266 ********************************************************************/
1268 static BOOL api_spoolss_getprinterdataex(pipes_struct *p)
1270 SPOOL_Q_GETPRINTERDATAEX q_u;
1271 SPOOL_R_GETPRINTERDATAEX r_u;
1272 prs_struct *data = &p->in_data.data;
1273 prs_struct *rdata = &p->out_data.rdata;
1275 ZERO_STRUCT(q_u);
1276 ZERO_STRUCT(r_u);
1278 /* read the stream and fill the struct */
1279 if (!spoolss_io_q_getprinterdataex("", &q_u, data, 0)) {
1280 DEBUG(0,("spoolss_io_q_getprinterdataex: unable to unmarshall SPOOL_Q_GETPRINTERDATAEX.\n"));
1281 return False;
1284 r_u.status = _spoolss_getprinterdataex( p, &q_u, &r_u);
1286 if (!spoolss_io_r_getprinterdataex("", &r_u, rdata, 0)) {
1287 DEBUG(0,("spoolss_io_r_getprinterdataex: unable to marshall SPOOL_R_GETPRINTERDATAEX.\n"));
1288 return False;
1291 return True;
1294 /****************************************************************************
1295 ****************************************************************************/
1297 static BOOL api_spoolss_setprinterdataex(pipes_struct *p)
1299 SPOOL_Q_SETPRINTERDATAEX q_u;
1300 SPOOL_R_SETPRINTERDATAEX 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_setprinterdataex("", &q_u, data, 0)) {
1308 DEBUG(0,("spoolss_io_q_setprinterdataex: unable to unmarshall SPOOL_Q_SETPRINTERDATAEX.\n"));
1309 return False;
1312 r_u.status = _spoolss_setprinterdataex(p, &q_u, &r_u);
1314 if(!spoolss_io_r_setprinterdataex("", &r_u, rdata, 0)) {
1315 DEBUG(0,("spoolss_io_r_setprinterdataex: unable to marshall SPOOL_R_SETPRINTERDATAEX.\n"));
1316 return False;
1319 return True;
1323 /****************************************************************************
1324 ****************************************************************************/
1326 static BOOL api_spoolss_enumprinterkey(pipes_struct *p)
1328 SPOOL_Q_ENUMPRINTERKEY q_u;
1329 SPOOL_R_ENUMPRINTERKEY r_u;
1330 prs_struct *data = &p->in_data.data;
1331 prs_struct *rdata = &p->out_data.rdata;
1333 ZERO_STRUCT(q_u);
1334 ZERO_STRUCT(r_u);
1336 if(!spoolss_io_q_enumprinterkey("", &q_u, data, 0)) {
1337 DEBUG(0,("spoolss_io_q_setprinterkey: unable to unmarshall SPOOL_Q_ENUMPRINTERKEY.\n"));
1338 return False;
1341 r_u.status = _spoolss_enumprinterkey(p, &q_u, &r_u);
1343 if(!spoolss_io_r_enumprinterkey("", &r_u, rdata, 0)) {
1344 DEBUG(0,("spoolss_io_r_enumprinterkey: unable to marshall SPOOL_R_ENUMPRINTERKEY.\n"));
1345 return False;
1348 return True;
1351 /****************************************************************************
1352 ****************************************************************************/
1354 static BOOL api_spoolss_enumprinterdataex(pipes_struct *p)
1356 SPOOL_Q_ENUMPRINTERDATAEX q_u;
1357 SPOOL_R_ENUMPRINTERDATAEX r_u;
1358 prs_struct *data = &p->in_data.data;
1359 prs_struct *rdata = &p->out_data.rdata;
1361 ZERO_STRUCT(q_u);
1362 ZERO_STRUCT(r_u);
1364 if(!spoolss_io_q_enumprinterdataex("", &q_u, data, 0)) {
1365 DEBUG(0,("spoolss_io_q_enumprinterdataex: unable to unmarshall SPOOL_Q_ENUMPRINTERDATAEX.\n"));
1366 return False;
1369 r_u.status = _spoolss_enumprinterdataex(p, &q_u, &r_u);
1371 if(!spoolss_io_r_enumprinterdataex("", &r_u, rdata, 0)) {
1372 DEBUG(0,("spoolss_io_r_enumprinterdataex: unable to marshall SPOOL_R_ENUMPRINTERDATAEX.\n"));
1373 return False;
1376 return True;
1379 /****************************************************************************
1380 ****************************************************************************/
1382 static BOOL api_spoolss_getprintprocessordirectory(pipes_struct *p)
1384 SPOOL_Q_GETPRINTPROCESSORDIRECTORY q_u;
1385 SPOOL_R_GETPRINTPROCESSORDIRECTORY r_u;
1386 prs_struct *data = &p->in_data.data;
1387 prs_struct *rdata = &p->out_data.rdata;
1389 ZERO_STRUCT(q_u);
1390 ZERO_STRUCT(r_u);
1392 if(!spoolss_io_q_getprintprocessordirectory("", &q_u, data, 0)) {
1393 DEBUG(0,("spoolss_io_q_getprintprocessordirectory: unable to unmarshall SPOOL_Q_GETPRINTPROCESSORDIRECTORY.\n"));
1394 return False;
1397 r_u.status = _spoolss_getprintprocessordirectory(p, &q_u, &r_u);
1399 if(!spoolss_io_r_getprintprocessordirectory("", &r_u, rdata, 0)) {
1400 DEBUG(0,("spoolss_io_r_getprintprocessordirectory: unable to marshall SPOOL_R_GETPRINTPROCESSORDIRECTORY.\n"));
1401 return False;
1404 return True;
1407 /****************************************************************************
1408 ****************************************************************************/
1410 static BOOL api_spoolss_deleteprinterdataex(pipes_struct *p)
1412 SPOOL_Q_DELETEPRINTERDATAEX q_u;
1413 SPOOL_R_DELETEPRINTERDATAEX r_u;
1414 prs_struct *data = &p->in_data.data;
1415 prs_struct *rdata = &p->out_data.rdata;
1417 ZERO_STRUCT(q_u);
1418 ZERO_STRUCT(r_u);
1420 if(!spoolss_io_q_deleteprinterdataex("", &q_u, data, 0)) {
1421 DEBUG(0,("spoolss_io_q_deleteprinterdataex: unable to unmarshall SPOOL_Q_DELETEPRINTERDATAEX.\n"));
1422 return False;
1425 r_u.status = _spoolss_deleteprinterdataex(p, &q_u, &r_u);
1427 if(!spoolss_io_r_deleteprinterdataex("", &r_u, rdata, 0)) {
1428 DEBUG(0,("spoolss_io_r_deleteprinterdataex: unable to marshall SPOOL_R_DELETEPRINTERDATAEX.\n"));
1429 return False;
1432 return True;
1435 /****************************************************************************
1436 ****************************************************************************/
1438 static BOOL api_spoolss_deleteprinterkey(pipes_struct *p)
1440 SPOOL_Q_DELETEPRINTERKEY q_u;
1441 SPOOL_R_DELETEPRINTERKEY r_u;
1442 prs_struct *data = &p->in_data.data;
1443 prs_struct *rdata = &p->out_data.rdata;
1445 ZERO_STRUCT(q_u);
1446 ZERO_STRUCT(r_u);
1448 if(!spoolss_io_q_deleteprinterkey("", &q_u, data, 0)) {
1449 DEBUG(0,("spoolss_io_q_deleteprinterkey: unable to unmarshall SPOOL_Q_DELETEPRINTERKEY.\n"));
1450 return False;
1453 r_u.status = _spoolss_deleteprinterkey(p, &q_u, &r_u);
1455 if(!spoolss_io_r_deleteprinterkey("", &r_u, rdata, 0)) {
1456 DEBUG(0,("spoolss_io_r_deleteprinterkey: unable to marshall SPOOL_R_DELETEPRINTERKEY.\n"));
1457 return False;
1460 return True;
1463 /****************************************************************************
1464 ****************************************************************************/
1466 static BOOL api_spoolss_addprinterdriverex(pipes_struct *p)
1468 SPOOL_Q_ADDPRINTERDRIVEREX q_u;
1469 SPOOL_R_ADDPRINTERDRIVEREX r_u;
1470 prs_struct *data = &p->in_data.data;
1471 prs_struct *rdata = &p->out_data.rdata;
1473 ZERO_STRUCT(q_u);
1474 ZERO_STRUCT(r_u);
1476 if(!spoolss_io_q_addprinterdriverex("", &q_u, data, 0)) {
1477 DEBUG(0,("spoolss_io_q_addprinterdriverex: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVEREX.\n"));
1478 return False;
1481 r_u.status = _spoolss_addprinterdriverex(p, &q_u, &r_u);
1483 if(!spoolss_io_r_addprinterdriverex("", &r_u, rdata, 0)) {
1484 DEBUG(0,("spoolss_io_r_addprinterdriverex: unable to marshall SPOOL_R_ADDPRINTERDRIVEREX.\n"));
1485 return False;
1488 return True;
1491 /****************************************************************************
1492 ****************************************************************************/
1494 static BOOL api_spoolss_deleteprinterdriverex(pipes_struct *p)
1496 SPOOL_Q_DELETEPRINTERDRIVEREX q_u;
1497 SPOOL_R_DELETEPRINTERDRIVEREX r_u;
1498 prs_struct *data = &p->in_data.data;
1499 prs_struct *rdata = &p->out_data.rdata;
1501 ZERO_STRUCT(q_u);
1502 ZERO_STRUCT(r_u);
1504 if(!spoolss_io_q_deleteprinterdriverex("", &q_u, data, 0)) {
1505 DEBUG(0,("spoolss_io_q_deleteprinterdriverex: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVEREX.\n"));
1506 return False;
1509 r_u.status = _spoolss_deleteprinterdriverex(p, &q_u, &r_u);
1511 if(!spoolss_io_r_deleteprinterdriverex("", &r_u, rdata, 0)) {
1512 DEBUG(0,("spoolss_io_r_deleteprinterdriverex: unable to marshall SPOOL_R_DELETEPRINTERDRIVEREX.\n"));
1513 return False;
1516 return True;
1519 #if 0
1521 /****************************************************************************
1522 ****************************************************************************/
1524 static BOOL api_spoolss_replyopenprinter(pipes_struct *p)
1526 SPOOL_Q_REPLYOPENPRINTER q_u;
1527 SPOOL_R_REPLYOPENPRINTER r_u;
1528 prs_struct *data = &p->in_data.data;
1529 prs_struct *rdata = &p->out_data.rdata;
1531 ZERO_STRUCT(q_u);
1532 ZERO_STRUCT(r_u);
1534 if(!spoolss_io_q_replyopenprinter("", &q_u, data, 0)) {
1535 DEBUG(0,("spoolss_io_q_replyopenprinter: unable to unmarshall SPOOL_Q_REPLYOPENPRINTER.\n"));
1536 return False;
1539 r_u.status = _spoolss_replyopenprinter(p, &q_u, &r_u);
1541 if(!spoolss_io_r_replyopenprinter("", &r_u, rdata, 0)) {
1542 DEBUG(0,("spoolss_io_r_replyopenprinter: unable to marshall SPOOL_R_REPLYOPENPRINTER.\n"));
1543 return False;
1546 return True;
1549 /****************************************************************************
1550 ****************************************************************************/
1552 static BOOL api_spoolss_replycloseprinter(pipes_struct *p)
1554 SPOOL_Q_REPLYCLOSEPRINTER q_u;
1555 SPOOL_R_REPLYCLOSEPRINTER r_u;
1556 prs_struct *data = &p->in_data.data;
1557 prs_struct *rdata = &p->out_data.rdata;
1559 ZERO_STRUCT(q_u);
1560 ZERO_STRUCT(r_u);
1562 if(!spoolss_io_q_replycloseprinter("", &q_u, data, 0)) {
1563 DEBUG(0,("spoolss_io_q_replycloseprinter: unable to unmarshall SPOOL_Q_REPLYCLOSEPRINTER.\n"));
1564 return False;
1567 r_u.status = _spoolss_replycloseprinter(p, &q_u, &r_u);
1569 if(!spoolss_io_r_replycloseprinter("", &r_u, rdata, 0)) {
1570 DEBUG(0,("spoolss_io_r_replycloseprinter: unable to marshall SPOOL_R_REPLYCLOSEPRINTER.\n"));
1571 return False;
1574 return True;
1577 #endif
1579 /*******************************************************************
1580 \pipe\spoolss commands
1581 ********************************************************************/
1583 struct api_struct api_spoolss_cmds[] =
1585 {"SPOOLSS_OPENPRINTER", SPOOLSS_OPENPRINTER, api_spoolss_open_printer },
1586 {"SPOOLSS_OPENPRINTEREX", SPOOLSS_OPENPRINTEREX, api_spoolss_open_printer_ex },
1587 {"SPOOLSS_GETPRINTERDATA", SPOOLSS_GETPRINTERDATA, api_spoolss_getprinterdata },
1588 {"SPOOLSS_CLOSEPRINTER", SPOOLSS_CLOSEPRINTER, api_spoolss_closeprinter },
1589 {"SPOOLSS_DELETEPRINTER", SPOOLSS_DELETEPRINTER, api_spoolss_deleteprinter },
1590 {"SPOOLSS_ABORTPRINTER", SPOOLSS_ABORTPRINTER, api_spoolss_abortprinter },
1591 {"SPOOLSS_RFFPCNEX", SPOOLSS_RFFPCNEX, api_spoolss_rffpcnex },
1592 {"SPOOLSS_RFNPCNEX", SPOOLSS_RFNPCNEX, api_spoolss_rfnpcnex },
1593 {"SPOOLSS_ENUMPRINTERS", SPOOLSS_ENUMPRINTERS, api_spoolss_enumprinters },
1594 {"SPOOLSS_GETPRINTER", SPOOLSS_GETPRINTER, api_spoolss_getprinter },
1595 {"SPOOLSS_GETPRINTERDRIVER2", SPOOLSS_GETPRINTERDRIVER2, api_spoolss_getprinterdriver2 },
1596 {"SPOOLSS_STARTPAGEPRINTER", SPOOLSS_STARTPAGEPRINTER, api_spoolss_startpageprinter },
1597 {"SPOOLSS_ENDPAGEPRINTER", SPOOLSS_ENDPAGEPRINTER, api_spoolss_endpageprinter },
1598 {"SPOOLSS_STARTDOCPRINTER", SPOOLSS_STARTDOCPRINTER, api_spoolss_startdocprinter },
1599 {"SPOOLSS_ENDDOCPRINTER", SPOOLSS_ENDDOCPRINTER, api_spoolss_enddocprinter },
1600 {"SPOOLSS_WRITEPRINTER", SPOOLSS_WRITEPRINTER, api_spoolss_writeprinter },
1601 {"SPOOLSS_SETPRINTER", SPOOLSS_SETPRINTER, api_spoolss_setprinter },
1602 {"SPOOLSS_FCPN", SPOOLSS_FCPN, api_spoolss_fcpn },
1603 {"SPOOLSS_ADDJOB", SPOOLSS_ADDJOB, api_spoolss_addjob },
1604 {"SPOOLSS_ENUMJOBS", SPOOLSS_ENUMJOBS, api_spoolss_enumjobs },
1605 {"SPOOLSS_SCHEDULEJOB", SPOOLSS_SCHEDULEJOB, api_spoolss_schedulejob },
1606 {"SPOOLSS_SETJOB", SPOOLSS_SETJOB, api_spoolss_setjob },
1607 {"SPOOLSS_ENUMFORMS", SPOOLSS_ENUMFORMS, api_spoolss_enumforms },
1608 {"SPOOLSS_ENUMPORTS", SPOOLSS_ENUMPORTS, api_spoolss_enumports },
1609 {"SPOOLSS_ENUMPRINTERDRIVERS", SPOOLSS_ENUMPRINTERDRIVERS, api_spoolss_enumprinterdrivers },
1610 {"SPOOLSS_ADDPRINTEREX", SPOOLSS_ADDPRINTEREX, api_spoolss_addprinterex },
1611 {"SPOOLSS_ADDPRINTERDRIVER", SPOOLSS_ADDPRINTERDRIVER, api_spoolss_addprinterdriver },
1612 {"SPOOLSS_DELETEPRINTERDRIVER", SPOOLSS_DELETEPRINTERDRIVER, api_spoolss_deleteprinterdriver },
1613 {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_getprinterdriverdirectory },
1614 {"SPOOLSS_ENUMPRINTERDATA", SPOOLSS_ENUMPRINTERDATA, api_spoolss_enumprinterdata },
1615 {"SPOOLSS_SETPRINTERDATA", SPOOLSS_SETPRINTERDATA, api_spoolss_setprinterdata },
1616 {"SPOOLSS_RESETPRINTER", SPOOLSS_RESETPRINTER, api_spoolss_reset_printer },
1617 {"SPOOLSS_DELETEPRINTERDATA", SPOOLSS_DELETEPRINTERDATA, api_spoolss_deleteprinterdata },
1618 {"SPOOLSS_ADDFORM", SPOOLSS_ADDFORM, api_spoolss_addform },
1619 {"SPOOLSS_DELETEFORM", SPOOLSS_DELETEFORM, api_spoolss_deleteform },
1620 {"SPOOLSS_GETFORM", SPOOLSS_GETFORM, api_spoolss_getform },
1621 {"SPOOLSS_SETFORM", SPOOLSS_SETFORM, api_spoolss_setform },
1622 {"SPOOLSS_ADDPRINTPROCESSOR", SPOOLSS_ADDPRINTPROCESSOR, api_spoolss_addprintprocessor },
1623 {"SPOOLSS_ENUMPRINTPROCESSORS", SPOOLSS_ENUMPRINTPROCESSORS, api_spoolss_enumprintprocessors },
1624 {"SPOOLSS_ENUMMONITORS", SPOOLSS_ENUMMONITORS, api_spoolss_enumprintmonitors },
1625 {"SPOOLSS_GETJOB", SPOOLSS_GETJOB, api_spoolss_getjob },
1626 {"SPOOLSS_ENUMPRINTPROCDATATYPES", SPOOLSS_ENUMPRINTPROCDATATYPES, api_spoolss_enumprintprocdatatypes },
1627 {"SPOOLSS_GETPRINTERDATAEX", SPOOLSS_GETPRINTERDATAEX, api_spoolss_getprinterdataex },
1628 {"SPOOLSS_SETPRINTERDATAEX", SPOOLSS_SETPRINTERDATAEX, api_spoolss_setprinterdataex },
1629 {"SPOOLSS_DELETEPRINTERDATAEX", SPOOLSS_DELETEPRINTERDATAEX, api_spoolss_deleteprinterdataex },
1630 {"SPOOLSS_ENUMPRINTERDATAEX", SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_enumprinterdataex },
1631 {"SPOOLSS_ENUMPRINTERKEY", SPOOLSS_ENUMPRINTERKEY, api_spoolss_enumprinterkey },
1632 {"SPOOLSS_DELETEPRINTERKEY", SPOOLSS_DELETEPRINTERKEY, api_spoolss_deleteprinterkey },
1633 {"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory},
1634 {"SPOOLSS_ADDPRINTERDRIVEREX", SPOOLSS_ADDPRINTERDRIVEREX, api_spoolss_addprinterdriverex },
1635 {"SPOOLSS_DELETEPRINTERDRIVEREX", SPOOLSS_DELETEPRINTERDRIVEREX, api_spoolss_deleteprinterdriverex },
1636 #if 0
1637 {"SPOOLSS_REPLYOPENPRINTER", SPOOLSS_REPLYOPENPRINTER, api_spoolss_replyopenprinter },
1638 {"SPOOLSS_REPLYCLOSEPRINTER", SPOOLSS_REPLYCLOSEPRINTER, api_spoolss_replycloseprinter }
1639 #endif
1642 void spoolss_get_pipe_fns( struct api_struct **fns, int *n_fns )
1644 *fns = api_spoolss_cmds;
1645 *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
1648 NTSTATUS rpc_spoolss_init(void)
1650 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", api_spoolss_cmds,
1651 sizeof(api_spoolss_cmds) / sizeof(struct api_struct));