added parsing routines for SPOOLSS_ADDPRINTERDRIVEREX and
[abartlet/samba.git/.git] / source3 / rpc_server / srv_spoolss.c
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  *  
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *  
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *  
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23
24 #include "includes.h"
25
26 #undef DBGC_CLASS
27 #define DBGC_CLASS DBGC_RPC_SRV
28
29 /********************************************************************
30  * api_spoolss_open_printer_ex (rarely seen - older call)
31  ********************************************************************/
32
33 static BOOL api_spoolss_open_printer(pipes_struct *p)
34 {
35         SPOOL_Q_OPEN_PRINTER q_u;
36         SPOOL_R_OPEN_PRINTER r_u;
37         prs_struct *data = &p->in_data.data;
38         prs_struct *rdata = &p->out_data.rdata;
39
40         ZERO_STRUCT(q_u);
41         ZERO_STRUCT(r_u);
42
43         if (!spoolss_io_q_open_printer("", &q_u, data, 0)) {
44                 DEBUG(0,("spoolss_io_q_open_printer: unable to unmarshall SPOOL_Q_OPEN_PRINTER.\n"));
45                 return False;
46         }
47
48         r_u.status = _spoolss_open_printer( p, &q_u, &r_u);
49         
50         if (!spoolss_io_r_open_printer("",&r_u,rdata,0)){
51                 DEBUG(0,("spoolss_io_r_open_printer: unable to marshall SPOOL_R_OPEN_PRINTER.\n"));
52                 return False;
53         }
54
55         return True;
56 }
57
58
59 /********************************************************************
60  * api_spoolss_open_printer_ex
61  ********************************************************************/
62
63 static BOOL api_spoolss_open_printer_ex(pipes_struct *p)
64 {
65         SPOOL_Q_OPEN_PRINTER_EX q_u;
66         SPOOL_R_OPEN_PRINTER_EX r_u;
67         prs_struct *data = &p->in_data.data;
68         prs_struct *rdata = &p->out_data.rdata;
69
70         ZERO_STRUCT(q_u);
71         ZERO_STRUCT(r_u);
72
73         if (!spoolss_io_q_open_printer_ex("", &q_u, data, 0)) {
74                 DEBUG(0,("spoolss_io_q_open_printer_ex: unable to unmarshall SPOOL_Q_OPEN_PRINTER_EX.\n"));
75                 return False;
76         }
77
78         r_u.status = _spoolss_open_printer_ex( p, &q_u, &r_u);
79
80         if (!spoolss_io_r_open_printer_ex("",&r_u,rdata,0)){
81                 DEBUG(0,("spoolss_io_r_open_printer_ex: unable to marshall SPOOL_R_OPEN_PRINTER_EX.\n"));
82                 return False;
83         }
84
85         return True;
86 }
87
88 /********************************************************************
89  * api_spoolss_getprinterdata
90  *
91  * called from the spoolss dispatcher
92  ********************************************************************/
93
94 static BOOL api_spoolss_getprinterdata(pipes_struct *p)
95 {
96         SPOOL_Q_GETPRINTERDATA q_u;
97         SPOOL_R_GETPRINTERDATA r_u;
98         prs_struct *data = &p->in_data.data;
99         prs_struct *rdata = &p->out_data.rdata;
100
101         ZERO_STRUCT(q_u);
102         ZERO_STRUCT(r_u);
103
104         /* read the stream and fill the struct */
105         if (!spoolss_io_q_getprinterdata("", &q_u, data, 0)) {
106                 DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall SPOOL_Q_GETPRINTERDATA.\n"));
107                 return False;
108         }
109         
110         r_u.status = _spoolss_getprinterdata( p, &q_u, &r_u);
111
112         if (!spoolss_io_r_getprinterdata("", &r_u, rdata, 0)) {
113                 DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall SPOOL_R_GETPRINTERDATA.\n"));
114                 return False;
115         }
116
117         return True;
118 }
119
120 /********************************************************************
121  * api_spoolss_deleteprinterdata
122  *
123  * called from the spoolss dispatcher
124  ********************************************************************/
125
126 static BOOL api_spoolss_deleteprinterdata(pipes_struct *p)
127 {
128         SPOOL_Q_DELETEPRINTERDATA q_u;
129         SPOOL_R_DELETEPRINTERDATA r_u;
130         prs_struct *data = &p->in_data.data;
131         prs_struct *rdata = &p->out_data.rdata;
132
133         ZERO_STRUCT(q_u);
134         ZERO_STRUCT(r_u);
135
136         /* read the stream and fill the struct */
137         if (!spoolss_io_q_deleteprinterdata("", &q_u, data, 0)) {
138                 DEBUG(0,("spoolss_io_q_deleteprinterdata: unable to unmarshall SPOOL_Q_DELETEPRINTERDATA.\n"));
139                 return False;
140         }
141         
142         r_u.status = _spoolss_deleteprinterdata( p, &q_u, &r_u);
143
144         if (!spoolss_io_r_deleteprinterdata("", &r_u, rdata, 0)) {
145                 DEBUG(0,("spoolss_io_r_deleteprinterdata: unable to marshall SPOOL_R_DELETEPRINTERDATA.\n"));
146                 return False;
147         }
148
149         return True;
150 }
151
152 /********************************************************************
153  * api_spoolss_closeprinter
154  *
155  * called from the spoolss dispatcher
156  ********************************************************************/
157
158 static BOOL api_spoolss_closeprinter(pipes_struct *p)
159 {
160         SPOOL_Q_CLOSEPRINTER q_u;
161         SPOOL_R_CLOSEPRINTER r_u;
162         prs_struct *data = &p->in_data.data;
163         prs_struct *rdata = &p->out_data.rdata;
164
165         ZERO_STRUCT(q_u);
166         ZERO_STRUCT(r_u);
167
168         if (!spoolss_io_q_closeprinter("", &q_u, data, 0)) {
169                 DEBUG(0,("spoolss_io_q_closeprinter: unable to unmarshall SPOOL_Q_CLOSEPRINTER.\n"));
170                 return False;
171         }
172
173         r_u.status = _spoolss_closeprinter(p, &q_u, &r_u);
174
175         if (!spoolss_io_r_closeprinter("",&r_u,rdata,0)) {
176                 DEBUG(0,("spoolss_io_r_closeprinter: unable to marshall SPOOL_R_CLOSEPRINTER.\n"));
177                 return False;
178         }
179
180         return True;
181 }
182
183 /********************************************************************
184  * api_spoolss_abortprinter
185  *
186  * called from the spoolss dispatcher
187  ********************************************************************/
188
189 static BOOL api_spoolss_abortprinter(pipes_struct *p)
190 {
191         SPOOL_Q_ABORTPRINTER q_u;
192         SPOOL_R_ABORTPRINTER r_u;
193         prs_struct *data = &p->in_data.data;
194         prs_struct *rdata = &p->out_data.rdata;
195
196         ZERO_STRUCT(q_u);
197         ZERO_STRUCT(r_u);
198
199         if (!spoolss_io_q_abortprinter("", &q_u, data, 0)) {
200                 DEBUG(0,("spoolss_io_q_abortprinter: unable to unmarshall SPOOL_Q_ABORTPRINTER.\n"));
201                 return False;
202         }
203
204         r_u.status = _spoolss_abortprinter(p, &q_u, &r_u);
205
206         if (!spoolss_io_r_abortprinter("",&r_u,rdata,0)) {
207                 DEBUG(0,("spoolss_io_r_abortprinter: unable to marshall SPOOL_R_ABORTPRINTER.\n"));
208                 return False;
209         }
210
211         return True;
212 }
213
214 /********************************************************************
215  * api_spoolss_deleteprinter
216  *
217  * called from the spoolss dispatcher
218  ********************************************************************/
219
220 static BOOL api_spoolss_deleteprinter(pipes_struct *p)
221 {
222         SPOOL_Q_DELETEPRINTER q_u;
223         SPOOL_R_DELETEPRINTER r_u;
224         prs_struct *data = &p->in_data.data;
225         prs_struct *rdata = &p->out_data.rdata;
226
227         ZERO_STRUCT(q_u);
228         ZERO_STRUCT(r_u);
229
230         if (!spoolss_io_q_deleteprinter("", &q_u, data, 0)) {
231                 DEBUG(0,("spoolss_io_q_deleteprinter: unable to unmarshall SPOOL_Q_DELETEPRINTER.\n"));
232                 return False;
233         }
234
235         r_u.status = _spoolss_deleteprinter(p, &q_u, &r_u);
236
237         if (!spoolss_io_r_deleteprinter("",&r_u,rdata,0)) {
238                 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
239                 return False;
240         }
241
242         return True;
243 }
244
245
246 /********************************************************************
247  * api_spoolss_deleteprinterdriver
248  *
249  * called from the spoolss dispatcher
250  ********************************************************************/
251
252 static BOOL api_spoolss_deleteprinterdriver(pipes_struct *p)
253 {
254         SPOOL_Q_DELETEPRINTERDRIVER q_u;
255         SPOOL_R_DELETEPRINTERDRIVER r_u;
256         prs_struct *data = &p->in_data.data;
257         prs_struct *rdata = &p->out_data.rdata;
258
259         ZERO_STRUCT(q_u);
260         ZERO_STRUCT(r_u);
261
262         if (!spoolss_io_q_deleteprinterdriver("", &q_u, data, 0)) {
263                 DEBUG(0,("spoolss_io_q_deleteprinterdriver: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVER.\n"));
264                 return False;
265         }
266
267         r_u.status = _spoolss_deleteprinterdriver(p, &q_u, &r_u);
268
269         if (!spoolss_io_r_deleteprinterdriver("",&r_u,rdata,0)) {
270                 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
271                 return False;
272         }
273
274         return True;
275 }
276
277
278 /********************************************************************
279  * api_spoolss_rffpcnex
280  * ReplyFindFirstPrinterChangeNotifyEx
281  ********************************************************************/
282
283 static BOOL api_spoolss_rffpcnex(pipes_struct *p)
284 {
285         SPOOL_Q_RFFPCNEX q_u;
286         SPOOL_R_RFFPCNEX r_u;
287         prs_struct *data = &p->in_data.data;
288         prs_struct *rdata = &p->out_data.rdata;
289
290         ZERO_STRUCT(q_u);
291         ZERO_STRUCT(r_u);
292
293         if (!spoolss_io_q_rffpcnex("", &q_u, data, 0)) {
294                 DEBUG(0,("spoolss_io_q_rffpcnex: unable to unmarshall SPOOL_Q_RFFPCNEX.\n"));
295                 return False;
296         }
297
298         r_u.status = _spoolss_rffpcnex(p, &q_u, &r_u);
299
300         if (!spoolss_io_r_rffpcnex("", &r_u, rdata, 0)) {
301                 DEBUG(0,("spoolss_io_r_rffpcnex: unable to marshall SPOOL_R_RFFPCNEX.\n"));
302                 return False;
303         }
304
305         return True;
306 }
307
308
309 /********************************************************************
310  * api_spoolss_rfnpcnex
311  * ReplyFindNextPrinterChangeNotifyEx
312  * called from the spoolss dispatcher
313
314  * Note - this is the *ONLY* function that breaks the RPC call
315  * symmetry in all the other calls. We need to do this to fix
316  * the massive memory allocation problem with thousands of jobs...
317  * JRA.
318  ********************************************************************/
319
320 static BOOL api_spoolss_rfnpcnex(pipes_struct *p)
321 {
322         SPOOL_Q_RFNPCNEX q_u;
323         SPOOL_R_RFNPCNEX r_u;
324         prs_struct *data = &p->in_data.data;
325         prs_struct *rdata = &p->out_data.rdata;
326
327         ZERO_STRUCT(q_u);
328         ZERO_STRUCT(r_u);
329
330         if (!spoolss_io_q_rfnpcnex("", &q_u, data, 0)) {
331                 DEBUG(0,("spoolss_io_q_rfnpcnex: unable to unmarshall SPOOL_Q_RFNPCNEX.\n"));
332                 return False;
333         }
334
335         r_u.status = _spoolss_rfnpcnex(p, &q_u, &r_u);
336
337         if (!spoolss_io_r_rfnpcnex("", &r_u, rdata, 0)) {
338                 SAFE_FREE(r_u.info.data);
339                 DEBUG(0,("spoolss_io_r_rfnpcnex: unable to marshall SPOOL_R_RFNPCNEX.\n"));
340                 return False;
341         }
342
343         SAFE_FREE(r_u.info.data);
344
345         return True;
346 }
347
348
349 /********************************************************************
350  * api_spoolss_enumprinters
351  * called from the spoolss dispatcher
352  *
353  ********************************************************************/
354
355 static BOOL api_spoolss_enumprinters(pipes_struct *p)
356 {
357         SPOOL_Q_ENUMPRINTERS q_u;
358         SPOOL_R_ENUMPRINTERS r_u;
359         prs_struct *data = &p->in_data.data;
360         prs_struct *rdata = &p->out_data.rdata;
361
362         ZERO_STRUCT(q_u);
363         ZERO_STRUCT(r_u);
364
365         if (!spoolss_io_q_enumprinters("", &q_u, data, 0)) {
366                 DEBUG(0,("spoolss_io_q_enumprinters: unable to unmarshall SPOOL_Q_ENUMPRINTERS.\n"));
367                 return False;
368         }
369
370         r_u.status = _spoolss_enumprinters( p, &q_u, &r_u);
371
372         if (!spoolss_io_r_enumprinters("", &r_u, rdata, 0)) {
373                 DEBUG(0,("spoolss_io_r_enumprinters: unable to marshall SPOOL_R_ENUMPRINTERS.\n"));
374                 return False;
375         }
376
377         return True;
378 }
379
380 /********************************************************************
381  * api_spoolss_getprinter
382  * called from the spoolss dispatcher
383  *
384  ********************************************************************/
385
386 static BOOL api_spoolss_getprinter(pipes_struct *p)
387 {
388         SPOOL_Q_GETPRINTER q_u;
389         SPOOL_R_GETPRINTER r_u;
390         prs_struct *data = &p->in_data.data;
391         prs_struct *rdata = &p->out_data.rdata;
392
393         ZERO_STRUCT(q_u);
394         ZERO_STRUCT(r_u);
395
396         if(!spoolss_io_q_getprinter("", &q_u, data, 0)) {
397                 DEBUG(0,("spoolss_io_q_getprinter: unable to unmarshall SPOOL_Q_GETPRINTER.\n"));
398                 return False;
399         }
400
401         r_u.status = _spoolss_getprinter(p, &q_u, &r_u);
402
403         if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {
404                 DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));
405                 return False;
406         }
407
408         return True;
409 }
410
411 /********************************************************************
412  * api_spoolss_getprinter
413  * called from the spoolss dispatcher
414  *
415  ********************************************************************/
416
417 static BOOL api_spoolss_getprinterdriver2(pipes_struct *p)
418 {
419         SPOOL_Q_GETPRINTERDRIVER2 q_u;
420         SPOOL_R_GETPRINTERDRIVER2 r_u;
421         prs_struct *data = &p->in_data.data;
422         prs_struct *rdata = &p->out_data.rdata;
423
424         ZERO_STRUCT(q_u);
425         ZERO_STRUCT(r_u);
426
427         if(!spoolss_io_q_getprinterdriver2("", &q_u, data, 0)) {
428                 DEBUG(0,("spoolss_io_q_getprinterdriver2: unable to unmarshall SPOOL_Q_GETPRINTERDRIVER2.\n"));
429                 return False;
430         }
431
432         r_u.status = _spoolss_getprinterdriver2(p, &q_u, &r_u);
433         
434         if(!spoolss_io_r_getprinterdriver2("",&r_u,rdata,0)) {
435                 DEBUG(0,("spoolss_io_r_getprinterdriver2: unable to marshall SPOOL_R_GETPRINTERDRIVER2.\n"));
436                 return False;
437         }
438         
439         return True;
440 }
441
442 /********************************************************************
443  * api_spoolss_getprinter
444  * called from the spoolss dispatcher
445  *
446  ********************************************************************/
447
448 static BOOL api_spoolss_startpageprinter(pipes_struct *p)
449 {
450         SPOOL_Q_STARTPAGEPRINTER q_u;
451         SPOOL_R_STARTPAGEPRINTER r_u;
452         prs_struct *data = &p->in_data.data;
453         prs_struct *rdata = &p->out_data.rdata;
454
455         ZERO_STRUCT(q_u);
456         ZERO_STRUCT(r_u);
457
458         if(!spoolss_io_q_startpageprinter("", &q_u, data, 0)) {
459                 DEBUG(0,("spoolss_io_q_startpageprinter: unable to unmarshall SPOOL_Q_STARTPAGEPRINTER.\n"));
460                 return False;
461         }
462
463         r_u.status = _spoolss_startpageprinter(p, &q_u, &r_u);
464
465         if(!spoolss_io_r_startpageprinter("",&r_u,rdata,0)) {
466                 DEBUG(0,("spoolss_io_r_startpageprinter: unable to marshall SPOOL_R_STARTPAGEPRINTER.\n"));
467                 return False;
468         }
469
470         return True;
471 }
472
473 /********************************************************************
474  * api_spoolss_getprinter
475  * called from the spoolss dispatcher
476  *
477  ********************************************************************/
478
479 static BOOL api_spoolss_endpageprinter(pipes_struct *p)
480 {
481         SPOOL_Q_ENDPAGEPRINTER q_u;
482         SPOOL_R_ENDPAGEPRINTER r_u;
483         prs_struct *data = &p->in_data.data;
484         prs_struct *rdata = &p->out_data.rdata;
485
486         ZERO_STRUCT(q_u);
487         ZERO_STRUCT(r_u);
488
489         if(!spoolss_io_q_endpageprinter("", &q_u, data, 0)) {
490                 DEBUG(0,("spoolss_io_q_endpageprinter: unable to unmarshall SPOOL_Q_ENDPAGEPRINTER.\n"));
491                 return False;
492         }
493
494         r_u.status = _spoolss_endpageprinter(p, &q_u, &r_u);
495
496         if(!spoolss_io_r_endpageprinter("",&r_u,rdata,0)) {
497                 DEBUG(0,("spoolss_io_r_endpageprinter: unable to marshall SPOOL_R_ENDPAGEPRINTER.\n"));
498                 return False;
499         }
500
501         return True;
502 }
503
504 /********************************************************************
505 ********************************************************************/
506
507 static BOOL api_spoolss_startdocprinter(pipes_struct *p)
508 {
509         SPOOL_Q_STARTDOCPRINTER q_u;
510         SPOOL_R_STARTDOCPRINTER r_u;
511         prs_struct *data = &p->in_data.data;
512         prs_struct *rdata = &p->out_data.rdata;
513
514         ZERO_STRUCT(q_u);
515         ZERO_STRUCT(r_u);
516
517         if(!spoolss_io_q_startdocprinter("", &q_u, data, 0)) {
518                 DEBUG(0,("spoolss_io_q_startdocprinter: unable to unmarshall SPOOL_Q_STARTDOCPRINTER.\n"));
519                 return False;
520         }
521
522         r_u.status = _spoolss_startdocprinter(p, &q_u, &r_u);
523
524         if(!spoolss_io_r_startdocprinter("",&r_u,rdata,0)) {
525                 DEBUG(0,("spoolss_io_r_startdocprinter: unable to marshall SPOOL_R_STARTDOCPRINTER.\n"));
526                 return False;
527         }
528
529         return True;
530 }
531
532 /********************************************************************
533 ********************************************************************/
534
535 static BOOL api_spoolss_enddocprinter(pipes_struct *p)
536 {
537         SPOOL_Q_ENDDOCPRINTER q_u;
538         SPOOL_R_ENDDOCPRINTER r_u;
539         prs_struct *data = &p->in_data.data;
540         prs_struct *rdata = &p->out_data.rdata;
541
542         ZERO_STRUCT(q_u);
543         ZERO_STRUCT(r_u);
544
545         if(!spoolss_io_q_enddocprinter("", &q_u, data, 0)) {
546                 DEBUG(0,("spoolss_io_q_enddocprinter: unable to unmarshall SPOOL_Q_ENDDOCPRINTER.\n"));
547                 return False;
548         }
549
550         r_u.status = _spoolss_enddocprinter(p, &q_u, &r_u);
551
552         if(!spoolss_io_r_enddocprinter("",&r_u,rdata,0)) {
553                 DEBUG(0,("spoolss_io_r_enddocprinter: unable to marshall SPOOL_R_ENDDOCPRINTER.\n"));
554                 return False;
555         }
556
557         return True;            
558 }
559
560 /********************************************************************
561 ********************************************************************/
562
563 static BOOL api_spoolss_writeprinter(pipes_struct *p)
564 {
565         SPOOL_Q_WRITEPRINTER q_u;
566         SPOOL_R_WRITEPRINTER r_u;
567         prs_struct *data = &p->in_data.data;
568         prs_struct *rdata = &p->out_data.rdata;
569
570         ZERO_STRUCT(q_u);
571         ZERO_STRUCT(r_u);
572
573         if(!spoolss_io_q_writeprinter("", &q_u, data, 0)) {
574                 DEBUG(0,("spoolss_io_q_writeprinter: unable to unmarshall SPOOL_Q_WRITEPRINTER.\n"));
575                 return False;
576         }
577
578         r_u.status = _spoolss_writeprinter(p, &q_u, &r_u);
579
580         if(!spoolss_io_r_writeprinter("",&r_u,rdata,0)) {
581                 DEBUG(0,("spoolss_io_r_writeprinter: unable to marshall SPOOL_R_WRITEPRINTER.\n"));
582                 return False;
583         }
584
585         return True;
586 }
587
588 /****************************************************************************
589
590 ****************************************************************************/
591
592 static BOOL api_spoolss_setprinter(pipes_struct *p)
593 {
594         SPOOL_Q_SETPRINTER q_u;
595         SPOOL_R_SETPRINTER r_u;
596         prs_struct *data = &p->in_data.data;
597         prs_struct *rdata = &p->out_data.rdata;
598
599         ZERO_STRUCT(q_u);
600         ZERO_STRUCT(r_u);
601
602         if(!spoolss_io_q_setprinter("", &q_u, data, 0)) {
603                 DEBUG(0,("spoolss_io_q_setprinter: unable to unmarshall SPOOL_Q_SETPRINTER.\n"));
604                 return False;
605         }
606         
607         r_u.status = _spoolss_setprinter(p, &q_u, &r_u);
608         
609         if(!spoolss_io_r_setprinter("",&r_u,rdata,0)) {
610                 DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n"));
611                 return False;
612         }
613
614         return True;
615 }
616
617 /****************************************************************************
618 ****************************************************************************/
619
620 static BOOL api_spoolss_fcpn(pipes_struct *p)
621 {
622         SPOOL_Q_FCPN q_u;
623         SPOOL_R_FCPN r_u;
624         prs_struct *data = &p->in_data.data;
625         prs_struct *rdata = &p->out_data.rdata;
626
627         ZERO_STRUCT(q_u);
628         ZERO_STRUCT(r_u);
629
630         if(!spoolss_io_q_fcpn("", &q_u, data, 0)) {
631                 DEBUG(0,("spoolss_io_q_fcpn: unable to unmarshall SPOOL_Q_FCPN.\n"));
632                 return False;
633         }
634
635         r_u.status = _spoolss_fcpn(p, &q_u, &r_u);
636
637         if(!spoolss_io_r_fcpn("",&r_u,rdata,0)) {
638                 DEBUG(0,("spoolss_io_r_fcpn: unable to marshall SPOOL_R_FCPN.\n"));
639                 return False;
640         }
641
642         return True;
643 }
644
645 /****************************************************************************
646 ****************************************************************************/
647
648 static BOOL api_spoolss_addjob(pipes_struct *p)
649 {
650         SPOOL_Q_ADDJOB q_u;
651         SPOOL_R_ADDJOB r_u;
652         prs_struct *data = &p->in_data.data;
653         prs_struct *rdata = &p->out_data.rdata;
654
655         ZERO_STRUCT(q_u);
656         ZERO_STRUCT(r_u);
657
658         if(!spoolss_io_q_addjob("", &q_u, data, 0)) {
659                 DEBUG(0,("spoolss_io_q_addjob: unable to unmarshall SPOOL_Q_ADDJOB.\n"));
660                 return False;
661         }
662
663         r_u.status = _spoolss_addjob(p, &q_u, &r_u);
664                 
665         if(!spoolss_io_r_addjob("",&r_u,rdata,0)) {
666                 DEBUG(0,("spoolss_io_r_addjob: unable to marshall SPOOL_R_ADDJOB.\n"));
667                 return False;
668         }
669
670         return True;            
671 }
672
673 /****************************************************************************
674 ****************************************************************************/
675
676 static BOOL api_spoolss_enumjobs(pipes_struct *p)
677 {
678         SPOOL_Q_ENUMJOBS q_u;
679         SPOOL_R_ENUMJOBS r_u;
680         prs_struct *data = &p->in_data.data;
681         prs_struct *rdata = &p->out_data.rdata;
682
683         ZERO_STRUCT(q_u);
684         ZERO_STRUCT(r_u);
685
686         if (!spoolss_io_q_enumjobs("", &q_u, data, 0)) {
687                 DEBUG(0,("spoolss_io_q_enumjobs: unable to unmarshall SPOOL_Q_ENUMJOBS.\n"));
688                 return False;
689         }
690
691         r_u.status = _spoolss_enumjobs(p, &q_u, &r_u);
692
693         if (!spoolss_io_r_enumjobs("",&r_u,rdata,0)) {
694                 DEBUG(0,("spoolss_io_r_enumjobs: unable to marshall SPOOL_R_ENUMJOBS.\n"));
695                 return False;
696         }
697
698         return True;
699 }
700
701 /****************************************************************************
702 ****************************************************************************/
703
704 static BOOL api_spoolss_schedulejob(pipes_struct *p)
705 {
706         SPOOL_Q_SCHEDULEJOB q_u;
707         SPOOL_R_SCHEDULEJOB r_u;
708         prs_struct *data = &p->in_data.data;
709         prs_struct *rdata = &p->out_data.rdata;
710
711         ZERO_STRUCT(q_u);
712         ZERO_STRUCT(r_u);
713
714         if(!spoolss_io_q_schedulejob("", &q_u, data, 0)) {
715                 DEBUG(0,("spoolss_io_q_schedulejob: unable to unmarshall SPOOL_Q_SCHEDULEJOB.\n"));
716                 return False;
717         }
718
719         r_u.status = _spoolss_schedulejob(p, &q_u, &r_u);
720
721         if(!spoolss_io_r_schedulejob("",&r_u,rdata,0)) {
722                 DEBUG(0,("spoolss_io_r_schedulejob: unable to marshall SPOOL_R_SCHEDULEJOB.\n"));
723                 return False;
724         }
725
726         return True;
727 }
728
729 /****************************************************************************
730 ****************************************************************************/
731
732 static BOOL api_spoolss_setjob(pipes_struct *p)
733 {
734         SPOOL_Q_SETJOB q_u;
735         SPOOL_R_SETJOB r_u;
736         prs_struct *data = &p->in_data.data;
737         prs_struct *rdata = &p->out_data.rdata;
738
739         ZERO_STRUCT(q_u);
740         ZERO_STRUCT(r_u);
741
742         if(!spoolss_io_q_setjob("", &q_u, data, 0)) {
743                 DEBUG(0,("spoolss_io_q_setjob: unable to unmarshall SPOOL_Q_SETJOB.\n"));
744                 return False;
745         }
746
747         r_u.status = _spoolss_setjob(p, &q_u, &r_u);
748
749         if(!spoolss_io_r_setjob("",&r_u,rdata,0)) {
750                 DEBUG(0,("spoolss_io_r_setjob: unable to marshall SPOOL_R_SETJOB.\n"));
751                 return False;
752         }
753
754         return True;
755 }
756
757 /****************************************************************************
758 ****************************************************************************/
759
760 static BOOL api_spoolss_enumprinterdrivers(pipes_struct *p)
761 {
762         SPOOL_Q_ENUMPRINTERDRIVERS q_u;
763         SPOOL_R_ENUMPRINTERDRIVERS r_u;
764         prs_struct *data = &p->in_data.data;
765         prs_struct *rdata = &p->out_data.rdata;
766
767         ZERO_STRUCT(q_u);
768         ZERO_STRUCT(r_u);
769
770         if (!spoolss_io_q_enumprinterdrivers("", &q_u, data, 0)) {
771                 DEBUG(0,("spoolss_io_q_enumprinterdrivers: unable to unmarshall SPOOL_Q_ENUMPRINTERDRIVERS.\n"));
772                 return False;
773         }
774
775         r_u.status = _spoolss_enumprinterdrivers(p, &q_u, &r_u);
776
777         if (!spoolss_io_r_enumprinterdrivers("",&r_u,rdata,0)) {
778                 DEBUG(0,("spoolss_io_r_enumprinterdrivers: unable to marshall SPOOL_R_ENUMPRINTERDRIVERS.\n"));
779                 return False;
780         }
781
782         return True;
783 }
784
785 /****************************************************************************
786 ****************************************************************************/
787
788 static BOOL api_spoolss_getform(pipes_struct *p)
789 {
790         SPOOL_Q_GETFORM q_u;
791         SPOOL_R_GETFORM r_u;
792         prs_struct *data = &p->in_data.data;
793         prs_struct *rdata = &p->out_data.rdata;
794
795         ZERO_STRUCT(q_u);
796         ZERO_STRUCT(r_u);
797
798         if (!spoolss_io_q_getform("", &q_u, data, 0)) {
799                 DEBUG(0,("spoolss_io_q_getform: unable to unmarshall SPOOL_Q_GETFORM.\n"));
800                 return False;
801         }
802
803         r_u.status = _spoolss_getform(p, &q_u, &r_u);
804
805         if (!spoolss_io_r_getform("",&r_u,rdata,0)) {
806                 DEBUG(0,("spoolss_io_r_getform: unable to marshall SPOOL_R_GETFORM.\n"));
807                 return False;
808         }
809
810         return True;
811 }
812
813 /****************************************************************************
814 ****************************************************************************/
815
816 static BOOL api_spoolss_enumforms(pipes_struct *p)
817 {
818         SPOOL_Q_ENUMFORMS q_u;
819         SPOOL_R_ENUMFORMS r_u;
820         prs_struct *data = &p->in_data.data;
821         prs_struct *rdata = &p->out_data.rdata;
822
823         ZERO_STRUCT(q_u);
824         ZERO_STRUCT(r_u);
825
826         if (!spoolss_io_q_enumforms("", &q_u, data, 0)) {
827                 DEBUG(0,("spoolss_io_q_enumforms: unable to unmarshall SPOOL_Q_ENUMFORMS.\n"));
828                 return False;
829         }
830
831         r_u.status = _spoolss_enumforms(p, &q_u, &r_u);
832
833         if (!spoolss_io_r_enumforms("",&r_u,rdata,0)) {
834                 DEBUG(0,("spoolss_io_r_enumforms: unable to marshall SPOOL_R_ENUMFORMS.\n"));
835                 return False;
836         }
837
838         return True;
839 }
840
841 /****************************************************************************
842 ****************************************************************************/
843
844 static BOOL api_spoolss_enumports(pipes_struct *p)
845 {
846         SPOOL_Q_ENUMPORTS q_u;
847         SPOOL_R_ENUMPORTS r_u;
848         prs_struct *data = &p->in_data.data;
849         prs_struct *rdata = &p->out_data.rdata;
850
851         ZERO_STRUCT(q_u);
852         ZERO_STRUCT(r_u);
853
854         if(!spoolss_io_q_enumports("", &q_u, data, 0)) {
855                 DEBUG(0,("spoolss_io_q_enumports: unable to unmarshall SPOOL_Q_ENUMPORTS.\n"));
856                 return False;
857         }
858
859         r_u.status = _spoolss_enumports(p, &q_u, &r_u);
860
861         if (!spoolss_io_r_enumports("",&r_u,rdata,0)) {
862                 DEBUG(0,("spoolss_io_r_enumports: unable to marshall SPOOL_R_ENUMPORTS.\n"));
863                 return False;
864         }
865
866         return True;
867 }
868
869 /****************************************************************************
870 ****************************************************************************/
871
872 static BOOL api_spoolss_addprinterex(pipes_struct *p)
873 {
874         SPOOL_Q_ADDPRINTEREX q_u;
875         SPOOL_R_ADDPRINTEREX r_u;
876         prs_struct *data = &p->in_data.data;
877         prs_struct *rdata = &p->out_data.rdata;
878         
879         ZERO_STRUCT(q_u);
880         ZERO_STRUCT(r_u);
881         
882         if(!spoolss_io_q_addprinterex("", &q_u, data, 0)) {
883                 DEBUG(0,("spoolss_io_q_addprinterex: unable to unmarshall SPOOL_Q_ADDPRINTEREX.\n"));
884                 return False;
885         }
886         
887         r_u.status = _spoolss_addprinterex(p, &q_u, &r_u);
888                                 
889         if(!spoolss_io_r_addprinterex("", &r_u, rdata, 0)) {
890                 DEBUG(0,("spoolss_io_r_addprinterex: unable to marshall SPOOL_R_ADDPRINTEREX.\n"));
891                 return False;
892         }
893         
894         return True;
895 }
896
897 /****************************************************************************
898 ****************************************************************************/
899
900 static BOOL api_spoolss_addprinterdriver(pipes_struct *p)
901 {
902         SPOOL_Q_ADDPRINTERDRIVER q_u;
903         SPOOL_R_ADDPRINTERDRIVER r_u;
904         prs_struct *data = &p->in_data.data;
905         prs_struct *rdata = &p->out_data.rdata;
906         
907         ZERO_STRUCT(q_u);
908         ZERO_STRUCT(r_u);
909         
910         if(!spoolss_io_q_addprinterdriver("", &q_u, data, 0)) {
911                 DEBUG(0,("spoolss_io_q_addprinterdriver: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVER.\n"));
912                 return False;
913         }
914         
915         r_u.status = _spoolss_addprinterdriver(p, &q_u, &r_u);
916                                 
917         if(!spoolss_io_r_addprinterdriver("", &r_u, rdata, 0)) {
918                 DEBUG(0,("spoolss_io_r_addprinterdriver: unable to marshall SPOOL_R_ADDPRINTERDRIVER.\n"));
919                 return False;
920         }
921         
922         return True;
923 }
924
925 /****************************************************************************
926 ****************************************************************************/
927
928 static BOOL api_spoolss_getprinterdriverdirectory(pipes_struct *p)
929 {
930         SPOOL_Q_GETPRINTERDRIVERDIR q_u;
931         SPOOL_R_GETPRINTERDRIVERDIR r_u;
932         prs_struct *data = &p->in_data.data;
933         prs_struct *rdata = &p->out_data.rdata;
934
935         ZERO_STRUCT(q_u);
936         ZERO_STRUCT(r_u);
937
938         if(!spoolss_io_q_getprinterdriverdir("", &q_u, data, 0)) {
939                 DEBUG(0,("spoolss_io_q_getprinterdriverdir: unable to unmarshall SPOOL_Q_GETPRINTERDRIVERDIR.\n"));
940                 return False;
941         }
942
943         r_u.status = _spoolss_getprinterdriverdirectory(p, &q_u, &r_u);
944
945         if(!spoolss_io_r_getprinterdriverdir("", &r_u, rdata, 0)) {
946                 DEBUG(0,("spoolss_io_r_getprinterdriverdir: unable to marshall SPOOL_R_GETPRINTERDRIVERDIR.\n"));
947                 return False;
948         }
949
950         return True;
951 }
952
953 /****************************************************************************
954 ****************************************************************************/
955
956 static BOOL api_spoolss_enumprinterdata(pipes_struct *p)
957 {
958         SPOOL_Q_ENUMPRINTERDATA q_u;
959         SPOOL_R_ENUMPRINTERDATA r_u;
960         prs_struct *data = &p->in_data.data;
961         prs_struct *rdata = &p->out_data.rdata;
962         
963         ZERO_STRUCT(q_u);
964         ZERO_STRUCT(r_u);
965         
966         if(!spoolss_io_q_enumprinterdata("", &q_u, data, 0)) {
967                 DEBUG(0,("spoolss_io_q_enumprinterdata: unable to unmarshall SPOOL_Q_ENUMPRINTERDATA.\n"));
968                 return False;
969         }
970         
971         r_u.status = _spoolss_enumprinterdata(p, &q_u, &r_u);
972                                 
973         if(!spoolss_io_r_enumprinterdata("", &r_u, rdata, 0)) {
974                 DEBUG(0,("spoolss_io_r_enumprinterdata: unable to marshall SPOOL_R_ENUMPRINTERDATA.\n"));
975                 return False;
976         }
977
978         return True;
979 }
980
981 /****************************************************************************
982 ****************************************************************************/
983
984 static BOOL api_spoolss_setprinterdata(pipes_struct *p)
985 {
986         SPOOL_Q_SETPRINTERDATA q_u;
987         SPOOL_R_SETPRINTERDATA r_u;
988         prs_struct *data = &p->in_data.data;
989         prs_struct *rdata = &p->out_data.rdata;
990         
991         ZERO_STRUCT(q_u);
992         ZERO_STRUCT(r_u);
993         
994         if(!spoolss_io_q_setprinterdata("", &q_u, data, 0)) {
995                 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
996                 return False;
997         }
998         
999         r_u.status = _spoolss_setprinterdata(p, &q_u, &r_u);
1000                                 
1001         if(!spoolss_io_r_setprinterdata("", &r_u, rdata, 0)) {
1002                 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_SETPRINTERDATA.\n"));
1003                 return False;
1004         }
1005
1006         return True;
1007 }
1008
1009 /****************************************************************************
1010 ****************************************************************************/
1011 static BOOL api_spoolss_reset_printer(pipes_struct *p)
1012 {
1013         SPOOL_Q_RESETPRINTER q_u;
1014         SPOOL_R_RESETPRINTER r_u;
1015         prs_struct *data = &p->in_data.data;
1016         prs_struct *rdata = &p->out_data.rdata;
1017
1018         ZERO_STRUCT(q_u);
1019         ZERO_STRUCT(r_u);
1020
1021         if(!spoolss_io_q_resetprinter("", &q_u, data, 0)) {
1022                 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
1023                 return False;
1024         }
1025         
1026         r_u.status = _spoolss_resetprinter(p, &q_u, &r_u);
1027
1028         if(!spoolss_io_r_resetprinter("", &r_u, rdata, 0)) {
1029                 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_RESETPRINTER.\n"));
1030                 return False;
1031         }
1032
1033         return True;
1034 }
1035
1036 /****************************************************************************
1037 ****************************************************************************/
1038 static BOOL api_spoolss_addform(pipes_struct *p)
1039 {
1040         SPOOL_Q_ADDFORM q_u;
1041         SPOOL_R_ADDFORM r_u;
1042         prs_struct *data = &p->in_data.data;
1043         prs_struct *rdata = &p->out_data.rdata;
1044
1045         ZERO_STRUCT(q_u);
1046         ZERO_STRUCT(r_u);
1047         
1048         if(!spoolss_io_q_addform("", &q_u, data, 0)) {
1049                 DEBUG(0,("spoolss_io_q_addform: unable to unmarshall SPOOL_Q_ADDFORM.\n"));
1050                 return False;
1051         }
1052         
1053         r_u.status = _spoolss_addform(p, &q_u, &r_u);
1054         
1055         if(!spoolss_io_r_addform("", &r_u, rdata, 0)) {
1056                 DEBUG(0,("spoolss_io_r_addform: unable to marshall SPOOL_R_ADDFORM.\n"));
1057                 return False;
1058         }
1059
1060         return True;
1061 }
1062
1063 /****************************************************************************
1064 ****************************************************************************/
1065
1066 static BOOL api_spoolss_deleteform(pipes_struct *p)
1067 {
1068         SPOOL_Q_DELETEFORM q_u;
1069         SPOOL_R_DELETEFORM r_u;
1070         prs_struct *data = &p->in_data.data;
1071         prs_struct *rdata = &p->out_data.rdata;
1072
1073         ZERO_STRUCT(q_u);
1074         ZERO_STRUCT(r_u);
1075         
1076         if(!spoolss_io_q_deleteform("", &q_u, data, 0)) {
1077                 DEBUG(0,("spoolss_io_q_deleteform: unable to unmarshall SPOOL_Q_DELETEFORM.\n"));
1078                 return False;
1079         }
1080         
1081         r_u.status = _spoolss_deleteform(p, &q_u, &r_u);
1082         
1083         if(!spoolss_io_r_deleteform("", &r_u, rdata, 0)) {
1084                 DEBUG(0,("spoolss_io_r_deleteform: unable to marshall SPOOL_R_DELETEFORM.\n"));
1085                 return False;
1086         }
1087
1088         return True;
1089 }
1090
1091 /****************************************************************************
1092 ****************************************************************************/
1093
1094 static BOOL api_spoolss_setform(pipes_struct *p)
1095 {
1096         SPOOL_Q_SETFORM q_u;
1097         SPOOL_R_SETFORM r_u;
1098         prs_struct *data = &p->in_data.data;
1099         prs_struct *rdata = &p->out_data.rdata;
1100
1101         ZERO_STRUCT(q_u);
1102         ZERO_STRUCT(r_u);
1103         
1104         if(!spoolss_io_q_setform("", &q_u, data, 0)) {
1105                 DEBUG(0,("spoolss_io_q_setform: unable to unmarshall SPOOL_Q_SETFORM.\n"));
1106                 return False;
1107         }
1108         
1109         r_u.status = _spoolss_setform(p, &q_u, &r_u);
1110                                       
1111         if(!spoolss_io_r_setform("", &r_u, rdata, 0)) {
1112                 DEBUG(0,("spoolss_io_r_setform: unable to marshall SPOOL_R_SETFORM.\n"));
1113                 return False;
1114         }
1115
1116         return True;
1117 }
1118
1119 /****************************************************************************
1120 ****************************************************************************/
1121
1122 static BOOL api_spoolss_enumprintprocessors(pipes_struct *p)
1123 {
1124         SPOOL_Q_ENUMPRINTPROCESSORS q_u;
1125         SPOOL_R_ENUMPRINTPROCESSORS r_u;
1126         prs_struct *data = &p->in_data.data;
1127         prs_struct *rdata = &p->out_data.rdata;
1128
1129         ZERO_STRUCT(q_u);
1130         ZERO_STRUCT(r_u);
1131         
1132         if(!spoolss_io_q_enumprintprocessors("", &q_u, data, 0)) {
1133                 DEBUG(0,("spoolss_io_q_enumprintprocessors: unable to unmarshall SPOOL_Q_ENUMPRINTPROCESSORS.\n"));
1134                 return False;
1135         }
1136         
1137         r_u.status = _spoolss_enumprintprocessors(p, &q_u, &r_u);
1138
1139         if(!spoolss_io_r_enumprintprocessors("", &r_u, rdata, 0)) {
1140                 DEBUG(0,("spoolss_io_r_enumprintprocessors: unable to marshall SPOOL_R_ENUMPRINTPROCESSORS.\n"));
1141                 return False;
1142         }
1143         
1144         return True;
1145 }
1146
1147 /****************************************************************************
1148 ****************************************************************************/
1149
1150 static BOOL api_spoolss_addprintprocessor(pipes_struct *p)
1151 {
1152         SPOOL_Q_ADDPRINTPROCESSOR q_u;
1153         SPOOL_R_ADDPRINTPROCESSOR r_u;
1154         prs_struct *data = &p->in_data.data;
1155         prs_struct *rdata = &p->out_data.rdata;
1156
1157         ZERO_STRUCT(q_u);
1158         ZERO_STRUCT(r_u);
1159         
1160         if(!spoolss_io_q_addprintprocessor("", &q_u, data, 0)) {
1161                 DEBUG(0,("spoolss_io_q_addprintprocessor: unable to unmarshall SPOOL_Q_ADDPRINTPROCESSOR.\n"));
1162                 return False;
1163         }
1164         
1165         /* for now, just indicate success and ignore the add.  We'll
1166            automatically set the winprint processor for printer
1167            entries later.  Used to debug the LexMark Optra S 1855 PCL
1168            driver --jerry */
1169         r_u.status = WERR_OK;
1170
1171         if(!spoolss_io_r_addprintprocessor("", &r_u, rdata, 0)) {
1172                 DEBUG(0,("spoolss_io_r_addprintprocessor: unable to marshall SPOOL_R_ADDPRINTPROCESSOR.\n"));
1173                 return False;
1174         }
1175         
1176         return True;
1177 }
1178
1179 /****************************************************************************
1180 ****************************************************************************/
1181
1182 static BOOL api_spoolss_enumprintprocdatatypes(pipes_struct *p)
1183 {
1184         SPOOL_Q_ENUMPRINTPROCDATATYPES q_u;
1185         SPOOL_R_ENUMPRINTPROCDATATYPES r_u;
1186         prs_struct *data = &p->in_data.data;
1187         prs_struct *rdata = &p->out_data.rdata;
1188
1189         ZERO_STRUCT(q_u);
1190         ZERO_STRUCT(r_u);
1191         
1192         if(!spoolss_io_q_enumprintprocdatatypes("", &q_u, data, 0)) {
1193                 DEBUG(0,("spoolss_io_q_enumprintprocdatatypes: unable to unmarshall SPOOL_Q_ENUMPRINTPROCDATATYPES.\n"));
1194                 return False;
1195         }
1196         
1197         r_u.status = _spoolss_enumprintprocdatatypes(p, &q_u, &r_u);
1198
1199         if(!spoolss_io_r_enumprintprocdatatypes("", &r_u, rdata, 0)) {
1200                 DEBUG(0,("spoolss_io_r_enumprintprocdatatypes: unable to marshall SPOOL_R_ENUMPRINTPROCDATATYPES.\n"));
1201                 return False;
1202         }
1203         
1204         return True;
1205 }
1206
1207 /****************************************************************************
1208 ****************************************************************************/
1209
1210 static BOOL api_spoolss_enumprintmonitors(pipes_struct *p)
1211 {
1212         SPOOL_Q_ENUMPRINTMONITORS q_u;
1213         SPOOL_R_ENUMPRINTMONITORS r_u;
1214         prs_struct *data = &p->in_data.data;
1215         prs_struct *rdata = &p->out_data.rdata;
1216
1217         ZERO_STRUCT(q_u);
1218         ZERO_STRUCT(r_u);
1219         
1220         if (!spoolss_io_q_enumprintmonitors("", &q_u, data, 0)) {
1221                 DEBUG(0,("spoolss_io_q_enumprintmonitors: unable to unmarshall SPOOL_Q_ENUMPRINTMONITORS.\n"));
1222                 return False;
1223         }
1224                 
1225         r_u.status = _spoolss_enumprintmonitors(p, &q_u, &r_u);
1226
1227         if (!spoolss_io_r_enumprintmonitors("", &r_u, rdata, 0)) {
1228                 DEBUG(0,("spoolss_io_r_enumprintmonitors: unable to marshall SPOOL_R_ENUMPRINTMONITORS.\n"));
1229                 return False;
1230         }
1231         
1232         return True;
1233 }
1234
1235 /****************************************************************************
1236 ****************************************************************************/
1237
1238 static BOOL api_spoolss_getjob(pipes_struct *p)
1239 {
1240         SPOOL_Q_GETJOB q_u;
1241         SPOOL_R_GETJOB r_u;
1242         prs_struct *data = &p->in_data.data;
1243         prs_struct *rdata = &p->out_data.rdata;
1244         
1245         if(!spoolss_io_q_getjob("", &q_u, data, 0)) {
1246                 DEBUG(0,("spoolss_io_q_getjob: unable to unmarshall SPOOL_Q_GETJOB.\n"));
1247                 return False;
1248         }
1249
1250         r_u.status = _spoolss_getjob(p, &q_u, &r_u);
1251         
1252         if(!spoolss_io_r_getjob("",&r_u,rdata,0)) {
1253                 DEBUG(0,("spoolss_io_r_getjob: unable to marshall SPOOL_R_GETJOB.\n"));
1254                 return False;
1255         }
1256                 
1257         return True;
1258 }
1259
1260 /********************************************************************
1261  * api_spoolss_getprinterdataex
1262  *
1263  * called from the spoolss dispatcher
1264  ********************************************************************/
1265
1266 static BOOL api_spoolss_getprinterdataex(pipes_struct *p)
1267 {
1268         SPOOL_Q_GETPRINTERDATAEX q_u;
1269         SPOOL_R_GETPRINTERDATAEX r_u;
1270         prs_struct *data = &p->in_data.data;
1271         prs_struct *rdata = &p->out_data.rdata;
1272
1273         ZERO_STRUCT(q_u);
1274         ZERO_STRUCT(r_u);
1275
1276         /* read the stream and fill the struct */
1277         if (!spoolss_io_q_getprinterdataex("", &q_u, data, 0)) {
1278                 DEBUG(0,("spoolss_io_q_getprinterdataex: unable to unmarshall SPOOL_Q_GETPRINTERDATAEX.\n"));
1279                 return False;
1280         }
1281         
1282         r_u.status = _spoolss_getprinterdataex( p, &q_u, &r_u);
1283
1284         if (!spoolss_io_r_getprinterdataex("", &r_u, rdata, 0)) {
1285                 DEBUG(0,("spoolss_io_r_getprinterdataex: unable to marshall SPOOL_R_GETPRINTERDATAEX.\n"));
1286                 return False;
1287         }
1288
1289         return True;
1290 }
1291
1292 /****************************************************************************
1293 ****************************************************************************/
1294
1295 static BOOL api_spoolss_setprinterdataex(pipes_struct *p)
1296 {
1297         SPOOL_Q_SETPRINTERDATAEX q_u;
1298         SPOOL_R_SETPRINTERDATAEX r_u;
1299         prs_struct *data = &p->in_data.data;
1300         prs_struct *rdata = &p->out_data.rdata;
1301         
1302         ZERO_STRUCT(q_u);
1303         ZERO_STRUCT(r_u);
1304         
1305         if(!spoolss_io_q_setprinterdataex("", &q_u, data, 0)) {
1306                 DEBUG(0,("spoolss_io_q_setprinterdataex: unable to unmarshall SPOOL_Q_SETPRINTERDATAEX.\n"));
1307                 return False;
1308         }
1309         
1310         r_u.status = _spoolss_setprinterdataex(p, &q_u, &r_u);
1311                                 
1312         if(!spoolss_io_r_setprinterdataex("", &r_u, rdata, 0)) {
1313                 DEBUG(0,("spoolss_io_r_setprinterdataex: unable to marshall SPOOL_R_SETPRINTERDATAEX.\n"));
1314                 return False;
1315         }
1316
1317         return True;
1318 }
1319
1320
1321 /****************************************************************************
1322 ****************************************************************************/
1323
1324 static BOOL api_spoolss_enumprinterkey(pipes_struct *p)
1325 {
1326         SPOOL_Q_ENUMPRINTERKEY q_u;
1327         SPOOL_R_ENUMPRINTERKEY r_u;
1328         prs_struct *data = &p->in_data.data;
1329         prs_struct *rdata = &p->out_data.rdata;
1330         
1331         ZERO_STRUCT(q_u);
1332         ZERO_STRUCT(r_u);
1333         
1334         if(!spoolss_io_q_enumprinterkey("", &q_u, data, 0)) {
1335                 DEBUG(0,("spoolss_io_q_setprinterkey: unable to unmarshall SPOOL_Q_ENUMPRINTERKEY.\n"));
1336                 return False;
1337         }
1338         
1339         r_u.status = _spoolss_enumprinterkey(p, &q_u, &r_u);
1340                                 
1341         if(!spoolss_io_r_enumprinterkey("", &r_u, rdata, 0)) {
1342                 DEBUG(0,("spoolss_io_r_enumprinterkey: unable to marshall SPOOL_R_ENUMPRINTERKEY.\n"));
1343                 return False;
1344         }
1345
1346         return True;
1347 }
1348
1349 /****************************************************************************
1350 ****************************************************************************/
1351
1352 static BOOL api_spoolss_enumprinterdataex(pipes_struct *p)
1353 {
1354         SPOOL_Q_ENUMPRINTERDATAEX q_u;
1355         SPOOL_R_ENUMPRINTERDATAEX r_u;
1356         prs_struct *data = &p->in_data.data;
1357         prs_struct *rdata = &p->out_data.rdata;
1358         
1359         ZERO_STRUCT(q_u);
1360         ZERO_STRUCT(r_u);
1361         
1362         if(!spoolss_io_q_enumprinterdataex("", &q_u, data, 0)) {
1363                 DEBUG(0,("spoolss_io_q_enumprinterdataex: unable to unmarshall SPOOL_Q_ENUMPRINTERDATAEX.\n"));
1364                 return False;
1365         }
1366         
1367         r_u.status = _spoolss_enumprinterdataex(p, &q_u, &r_u);
1368                                 
1369         if(!spoolss_io_r_enumprinterdataex("", &r_u, rdata, 0)) {
1370                 DEBUG(0,("spoolss_io_r_enumprinterdataex: unable to marshall SPOOL_R_ENUMPRINTERDATAEX.\n"));
1371                 return False;
1372         }
1373
1374         return True;
1375 }
1376
1377 /****************************************************************************
1378 ****************************************************************************/
1379
1380 static BOOL api_spoolss_getprintprocessordirectory(pipes_struct *p)
1381 {
1382         SPOOL_Q_GETPRINTPROCESSORDIRECTORY q_u;
1383         SPOOL_R_GETPRINTPROCESSORDIRECTORY r_u;
1384         prs_struct *data = &p->in_data.data;
1385         prs_struct *rdata = &p->out_data.rdata;
1386         
1387         ZERO_STRUCT(q_u);
1388         ZERO_STRUCT(r_u);
1389         
1390         if(!spoolss_io_q_getprintprocessordirectory("", &q_u, data, 0)) {
1391                 DEBUG(0,("spoolss_io_q_getprintprocessordirectory: unable to unmarshall SPOOL_Q_GETPRINTPROCESSORDIRECTORY.\n"));
1392                 return False;
1393         }
1394         
1395         r_u.status = _spoolss_getprintprocessordirectory(p, &q_u, &r_u);
1396                                 
1397         if(!spoolss_io_r_getprintprocessordirectory("", &r_u, rdata, 0)) {
1398                 DEBUG(0,("spoolss_io_r_getprintprocessordirectory: unable to marshall SPOOL_R_GETPRINTPROCESSORDIRECTORY.\n"));
1399                 return False;
1400         }
1401         
1402         return True;
1403 }
1404
1405 /****************************************************************************
1406 ****************************************************************************/
1407
1408 static BOOL api_spoolss_deleteprinterdataex(pipes_struct *p)
1409 {
1410         SPOOL_Q_DELETEPRINTERDATAEX q_u;
1411         SPOOL_R_DELETEPRINTERDATAEX r_u;
1412         prs_struct *data = &p->in_data.data;
1413         prs_struct *rdata = &p->out_data.rdata;
1414         
1415         ZERO_STRUCT(q_u);
1416         ZERO_STRUCT(r_u);
1417         
1418         if(!spoolss_io_q_deleteprinterdataex("", &q_u, data, 0)) {
1419                 DEBUG(0,("spoolss_io_q_deleteprinterdataex: unable to unmarshall SPOOL_Q_DELETEPRINTERDATAEX.\n"));
1420                 return False;
1421         }
1422         
1423         r_u.status = _spoolss_deleteprinterdataex(p, &q_u, &r_u);
1424                                 
1425         if(!spoolss_io_r_deleteprinterdataex("", &r_u, rdata, 0)) {
1426                 DEBUG(0,("spoolss_io_r_deleteprinterdataex: unable to marshall SPOOL_R_DELETEPRINTERDATAEX.\n"));
1427                 return False;
1428         }
1429         
1430         return True;
1431 }
1432
1433 /****************************************************************************
1434 ****************************************************************************/
1435
1436 static BOOL api_spoolss_deleteprinterkey(pipes_struct *p)
1437 {
1438         SPOOL_Q_DELETEPRINTERKEY q_u;
1439         SPOOL_R_DELETEPRINTERKEY r_u;
1440         prs_struct *data = &p->in_data.data;
1441         prs_struct *rdata = &p->out_data.rdata;
1442         
1443         ZERO_STRUCT(q_u);
1444         ZERO_STRUCT(r_u);
1445         
1446         if(!spoolss_io_q_deleteprinterkey("", &q_u, data, 0)) {
1447                 DEBUG(0,("spoolss_io_q_deleteprinterkey: unable to unmarshall SPOOL_Q_DELETEPRINTERKEY.\n"));
1448                 return False;
1449         }
1450         
1451         r_u.status = _spoolss_deleteprinterkey(p, &q_u, &r_u);
1452                                 
1453         if(!spoolss_io_r_deleteprinterkey("", &r_u, rdata, 0)) {
1454                 DEBUG(0,("spoolss_io_r_deleteprinterkey: unable to marshall SPOOL_R_DELETEPRINTERKEY.\n"));
1455                 return False;
1456         }
1457         
1458         return True;
1459 }
1460
1461 /****************************************************************************
1462 ****************************************************************************/
1463
1464 static BOOL api_spoolss_addprinterdriverex(pipes_struct *p)
1465 {
1466         SPOOL_Q_ADDPRINTERDRIVEREX q_u;
1467         SPOOL_R_ADDPRINTERDRIVEREX r_u;
1468         prs_struct *data = &p->in_data.data;
1469         prs_struct *rdata = &p->out_data.rdata;
1470         
1471         ZERO_STRUCT(q_u);
1472         ZERO_STRUCT(r_u);
1473         
1474         if(!spoolss_io_q_addprinterdriverex("", &q_u, data, 0)) {
1475                 DEBUG(0,("spoolss_io_q_addprinterdriverex: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVEREX.\n"));
1476                 return False;
1477         }
1478         
1479         r_u.status = _spoolss_addprinterdriverex(p, &q_u, &r_u);
1480                                 
1481         if(!spoolss_io_r_addprinterdriverex("", &r_u, rdata, 0)) {
1482                 DEBUG(0,("spoolss_io_r_addprinterdriverex: unable to marshall SPOOL_R_ADDPRINTERDRIVEREX.\n"));
1483                 return False;
1484         }
1485         
1486         return True;
1487 }
1488
1489 /****************************************************************************
1490 ****************************************************************************/
1491
1492 static BOOL api_spoolss_deleteprinterdriverex(pipes_struct *p)
1493 {
1494         SPOOL_Q_DELETEPRINTERDRIVEREX q_u;
1495         SPOOL_R_DELETEPRINTERDRIVEREX r_u;
1496         prs_struct *data = &p->in_data.data;
1497         prs_struct *rdata = &p->out_data.rdata;
1498         
1499         ZERO_STRUCT(q_u);
1500         ZERO_STRUCT(r_u);
1501         
1502         if(!spoolss_io_q_deleteprinterdriverex("", &q_u, data, 0)) {
1503                 DEBUG(0,("spoolss_io_q_deleteprinterdriverex: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVEREX.\n"));
1504                 return False;
1505         }
1506         
1507         r_u.status = _spoolss_deleteprinterdriverex(p, &q_u, &r_u);
1508                                 
1509         if(!spoolss_io_r_deleteprinterdriverex("", &r_u, rdata, 0)) {
1510                 DEBUG(0,("spoolss_io_r_deleteprinterdriverex: unable to marshall SPOOL_R_DELETEPRINTERDRIVEREX.\n"));
1511                 return False;
1512         }
1513         
1514         return True;
1515 }
1516
1517
1518 /*******************************************************************
1519 \pipe\spoolss commands
1520 ********************************************************************/
1521
1522 struct api_struct api_spoolss_cmds[] = 
1523 {
1524  {"SPOOLSS_OPENPRINTER",               SPOOLSS_OPENPRINTER,               api_spoolss_open_printer              },
1525  {"SPOOLSS_OPENPRINTEREX",             SPOOLSS_OPENPRINTEREX,             api_spoolss_open_printer_ex           },
1526  {"SPOOLSS_GETPRINTERDATA",            SPOOLSS_GETPRINTERDATA,            api_spoolss_getprinterdata            },
1527  {"SPOOLSS_CLOSEPRINTER",              SPOOLSS_CLOSEPRINTER,              api_spoolss_closeprinter              },
1528  {"SPOOLSS_DELETEPRINTER",             SPOOLSS_DELETEPRINTER,             api_spoolss_deleteprinter             },
1529  {"SPOOLSS_ABORTPRINTER",              SPOOLSS_ABORTPRINTER,              api_spoolss_abortprinter              },
1530  {"SPOOLSS_RFFPCNEX",                  SPOOLSS_RFFPCNEX,                  api_spoolss_rffpcnex                  },
1531  {"SPOOLSS_RFNPCNEX",                  SPOOLSS_RFNPCNEX,                  api_spoolss_rfnpcnex                  },
1532  {"SPOOLSS_ENUMPRINTERS",              SPOOLSS_ENUMPRINTERS,              api_spoolss_enumprinters              },
1533  {"SPOOLSS_GETPRINTER",                SPOOLSS_GETPRINTER,                api_spoolss_getprinter                },
1534  {"SPOOLSS_GETPRINTERDRIVER2",         SPOOLSS_GETPRINTERDRIVER2,         api_spoolss_getprinterdriver2         }, 
1535  {"SPOOLSS_STARTPAGEPRINTER",          SPOOLSS_STARTPAGEPRINTER,          api_spoolss_startpageprinter          },
1536  {"SPOOLSS_ENDPAGEPRINTER",            SPOOLSS_ENDPAGEPRINTER,            api_spoolss_endpageprinter            }, 
1537  {"SPOOLSS_STARTDOCPRINTER",           SPOOLSS_STARTDOCPRINTER,           api_spoolss_startdocprinter           },
1538  {"SPOOLSS_ENDDOCPRINTER",             SPOOLSS_ENDDOCPRINTER,             api_spoolss_enddocprinter             },
1539  {"SPOOLSS_WRITEPRINTER",              SPOOLSS_WRITEPRINTER,              api_spoolss_writeprinter              },
1540  {"SPOOLSS_SETPRINTER",                SPOOLSS_SETPRINTER,                api_spoolss_setprinter                },
1541  {"SPOOLSS_FCPN",                      SPOOLSS_FCPN,                      api_spoolss_fcpn                      },
1542  {"SPOOLSS_ADDJOB",                    SPOOLSS_ADDJOB,                    api_spoolss_addjob                    },
1543  {"SPOOLSS_ENUMJOBS",                  SPOOLSS_ENUMJOBS,                  api_spoolss_enumjobs                  },
1544  {"SPOOLSS_SCHEDULEJOB",               SPOOLSS_SCHEDULEJOB,               api_spoolss_schedulejob               },
1545  {"SPOOLSS_SETJOB",                    SPOOLSS_SETJOB,                    api_spoolss_setjob                    },
1546  {"SPOOLSS_ENUMFORMS",                 SPOOLSS_ENUMFORMS,                 api_spoolss_enumforms                 },
1547  {"SPOOLSS_ENUMPORTS",                 SPOOLSS_ENUMPORTS,                 api_spoolss_enumports                 },
1548  {"SPOOLSS_ENUMPRINTERDRIVERS",        SPOOLSS_ENUMPRINTERDRIVERS,        api_spoolss_enumprinterdrivers        },
1549  {"SPOOLSS_ADDPRINTEREX",              SPOOLSS_ADDPRINTEREX,              api_spoolss_addprinterex              },
1550  {"SPOOLSS_ADDPRINTERDRIVER",          SPOOLSS_ADDPRINTERDRIVER,          api_spoolss_addprinterdriver          },
1551  {"SPOOLSS_DELETEPRINTERDRIVER",       SPOOLSS_DELETEPRINTERDRIVER,       api_spoolss_deleteprinterdriver       },
1552  {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_getprinterdriverdirectory },
1553  {"SPOOLSS_ENUMPRINTERDATA",           SPOOLSS_ENUMPRINTERDATA,           api_spoolss_enumprinterdata           },
1554  {"SPOOLSS_SETPRINTERDATA",            SPOOLSS_SETPRINTERDATA,            api_spoolss_setprinterdata            },
1555  {"SPOOLSS_RESETPRINTER",              SPOOLSS_RESETPRINTER,              api_spoolss_reset_printer             },
1556  {"SPOOLSS_DELETEPRINTERDATA",         SPOOLSS_DELETEPRINTERDATA,         api_spoolss_deleteprinterdata         },
1557  {"SPOOLSS_ADDFORM",                   SPOOLSS_ADDFORM,                   api_spoolss_addform                   },
1558  {"SPOOLSS_DELETEFORM",                SPOOLSS_DELETEFORM,                api_spoolss_deleteform                },
1559  {"SPOOLSS_GETFORM",                   SPOOLSS_GETFORM,                   api_spoolss_getform                   },
1560  {"SPOOLSS_SETFORM",                   SPOOLSS_SETFORM,                   api_spoolss_setform                   },
1561  {"SPOOLSS_ADDPRINTPROCESSOR",         SPOOLSS_ADDPRINTPROCESSOR,         api_spoolss_addprintprocessor         },
1562  {"SPOOLSS_ENUMPRINTPROCESSORS",       SPOOLSS_ENUMPRINTPROCESSORS,       api_spoolss_enumprintprocessors       },
1563  {"SPOOLSS_ENUMMONITORS",              SPOOLSS_ENUMMONITORS,              api_spoolss_enumprintmonitors         },
1564  {"SPOOLSS_GETJOB",                    SPOOLSS_GETJOB,                    api_spoolss_getjob                    },
1565  {"SPOOLSS_ENUMPRINTPROCDATATYPES",    SPOOLSS_ENUMPRINTPROCDATATYPES,    api_spoolss_enumprintprocdatatypes    },
1566  {"SPOOLSS_GETPRINTERDATAEX",          SPOOLSS_GETPRINTERDATAEX,          api_spoolss_getprinterdataex          },
1567  {"SPOOLSS_SETPRINTERDATAEX",          SPOOLSS_SETPRINTERDATAEX,          api_spoolss_setprinterdataex          },
1568  {"SPOOLSS_DELETEPRINTERDATAEX",       SPOOLSS_DELETEPRINTERDATAEX,       api_spoolss_deleteprinterdataex       },
1569  {"SPOOLSS_ENUMPRINTERDATAEX",         SPOOLSS_ENUMPRINTERDATAEX,         api_spoolss_enumprinterdataex         },
1570  {"SPOOLSS_ENUMPRINTERKEY",            SPOOLSS_ENUMPRINTERKEY,            api_spoolss_enumprinterkey            },
1571  {"SPOOLSS_DELETEPRINTERKEY",          SPOOLSS_DELETEPRINTERKEY,          api_spoolss_deleteprinterkey          },
1572  {"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory},
1573  {"SPOOLSS_ADDPRINTERDRIVEREX",        SPOOLSS_ADDPRINTERDRIVEREX,        api_spoolss_addprinterdriverex        },
1574  {"SPOOLSS_DELETEPRINTERDRIVEREX",     SPOOLSS_DELETEPRINTERDRIVEREX,     api_spoolss_deleteprinterdriverex     },
1575  { NULL,                               0,                                 NULL                                  }
1576 };
1577
1578 /*******************************************************************
1579 receives a spoolss pipe and responds.
1580 ********************************************************************/
1581 BOOL api_spoolss_rpc(pipes_struct *p)
1582 {
1583         return api_rpcTNP(p, "api_spoolss_rpc", api_spoolss_cmds);
1584 }