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