added support for deleting printers into the spoolss system
[kai/samba.git] / source / rpc_server / srv_spoolss.c
1 /* 
2  *  Unix SMB/Netbios implementation.
3  *  Version 1.9.
4  *  RPC Pipe client / server routines
5  *  Copyright (C) Andrew Tridgell              1992-2000,
6  *  Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
7  *  Copyright (C) Jean François Micouleau      1998-2000.
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 extern int DEBUGLEVEL;
27
28 /********************************************************************
29  * api_spoolss_open_printer_ex
30  ********************************************************************/
31 static BOOL api_spoolss_open_printer_ex(prs_struct *data, prs_struct *rdata)
32 {
33         SPOOL_Q_OPEN_PRINTER_EX q_u;
34         SPOOL_R_OPEN_PRINTER_EX r_u;
35         UNISTR2 *printername = NULL;
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         if (q_u.printername_ptr != 0)
46                 printername = &q_u.printername;
47
48         r_u.status = _spoolss_open_printer_ex( printername,
49                                                &q_u.printer_default,
50                                                q_u.user_switch, q_u.user_ctr,
51                                                &r_u.handle);
52
53         /* we _really_ need to switch to talloc() */
54         safe_free(q_u.printer_default.devmode_cont.devmode);
55
56         if (!spoolss_io_r_open_printer_ex("",&r_u,rdata,0)){
57                 DEBUG(0,("spoolss_io_r_open_printer_ex: unable to marshall SPOOL_R_OPEN_PRINTER_EX.\n"));
58                 return False;
59         }
60
61         return True;
62 }
63
64 /********************************************************************
65  * api_spoolss_getprinterdata
66  *
67  * called from the spoolss dispatcher
68  ********************************************************************/
69 static BOOL api_spoolss_getprinterdata(prs_struct *data, prs_struct *rdata) 
70 {
71         SPOOL_Q_GETPRINTERDATA q_u;
72         SPOOL_R_GETPRINTERDATA r_u;
73
74         ZERO_STRUCT(q_u);
75         ZERO_STRUCT(r_u);
76
77         /* read the stream and fill the struct */
78         if (!spoolss_io_q_getprinterdata("", &q_u, data, 0)) {
79                 DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall SPOOL_Q_GETPRINTERDATA.\n"));
80                 return False;
81         }
82         
83         r_u.status = _spoolss_getprinterdata( &q_u.handle, &q_u.valuename,
84                                               q_u.size, &r_u.type, &r_u.size,
85                                               &r_u.data, &r_u.needed);
86
87         if (!spoolss_io_r_getprinterdata("", &r_u, rdata, 0)) {
88                 DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall SPOOL_R_GETPRINTERDATA.\n"));
89                 return False;
90         }
91
92         safe_free(r_u.data);
93
94         return True;
95 }
96
97 /********************************************************************
98  * api_spoolss_closeprinter
99  *
100  * called from the spoolss dispatcher
101  ********************************************************************/
102 static BOOL api_spoolss_closeprinter(prs_struct *data, prs_struct *rdata) 
103 {
104         SPOOL_Q_CLOSEPRINTER q_u;
105         SPOOL_R_CLOSEPRINTER r_u;
106
107         ZERO_STRUCT(q_u);
108         ZERO_STRUCT(r_u);
109
110         if (!spoolss_io_q_closeprinter("", &q_u, data, 0)) {
111                 DEBUG(0,("spoolss_io_q_closeprinter: unable to unmarshall SPOOL_Q_CLOSEPRINTER.\n"));
112                 return False;
113         }
114
115         r_u.status = _spoolss_closeprinter(&q_u.handle);
116         memcpy(&r_u.handle, &q_u.handle, sizeof(r_u.handle));
117
118         if (!spoolss_io_r_closeprinter("",&r_u,rdata,0)) {
119                 DEBUG(0,("spoolss_io_r_closeprinter: unable to marshall SPOOL_R_CLOSEPRINTER.\n"));
120                 return False;
121         }
122
123         return True;
124 }
125
126 /********************************************************************
127  * api_spoolss_deleteprinter
128  *
129  * called from the spoolss dispatcher
130  ********************************************************************/
131 static BOOL api_spoolss_deleteprinter(prs_struct *data, prs_struct *rdata) 
132 {
133         SPOOL_Q_DELETEPRINTER q_u;
134         SPOOL_R_DELETEPRINTER r_u;
135
136         ZERO_STRUCT(q_u);
137         ZERO_STRUCT(r_u);
138
139         if (!spoolss_io_q_deleteprinter("", &q_u, data, 0)) {
140                 DEBUG(0,("spoolss_io_q_deleteprinter: unable to unmarshall SPOOL_Q_DELETEPRINTER.\n"));
141                 return False;
142         }
143
144         r_u.status = _spoolss_deleteprinter(&q_u.handle);
145         memcpy(&r_u.handle, &q_u.handle, sizeof(r_u.handle));
146
147         if (!spoolss_io_r_deleteprinter("",&r_u,rdata,0)) {
148                 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
149                 return False;
150         }
151
152         return True;
153 }
154
155
156 /********************************************************************
157  * api_spoolss_rffpcnex
158  * ReplyFindFirstPrinterChangeNotifyEx
159  ********************************************************************/
160 static BOOL api_spoolss_rffpcnex(prs_struct *data, prs_struct *rdata) 
161 {
162         SPOOL_Q_RFFPCNEX q_u;
163         SPOOL_R_RFFPCNEX r_u;
164
165         ZERO_STRUCT(q_u);
166         ZERO_STRUCT(r_u);
167
168         if (!spoolss_io_q_rffpcnex("", &q_u, data, 0)) {
169                 DEBUG(0,("spoolss_io_q_rffpcnex: unable to unmarshall SPOOL_Q_RFFPCNEX.\n"));
170                 return False;
171         }
172
173         r_u.status = _spoolss_rffpcnex(&q_u.handle, q_u.flags,
174                                        q_u.options, &q_u.localmachine,
175                                        q_u.printerlocal, q_u.option);
176
177         if (!spoolss_io_r_rffpcnex("", &r_u, rdata, 0)) {
178                 DEBUG(0,("spoolss_io_r_rffpcnex: unable to marshall SPOOL_R_RFFPCNEX.\n"));
179                 return False;
180         }
181
182         return True;
183 }
184
185
186 /********************************************************************
187  * api_spoolss_rfnpcnex
188  * ReplyFindNextPrinterChangeNotifyEx
189  * called from the spoolss dispatcher
190  *
191  ********************************************************************/
192 static BOOL api_spoolss_rfnpcnex(prs_struct *data, prs_struct *rdata) 
193 {
194         SPOOL_Q_RFNPCNEX q_u;
195         SPOOL_R_RFNPCNEX r_u;
196
197         ZERO_STRUCT(q_u);
198         ZERO_STRUCT(r_u);
199
200         if (!spoolss_io_q_rfnpcnex("", &q_u, data, 0)) {
201                 DEBUG(0,("spoolss_io_q_rfnpcnex: unable to unmarshall SPOOL_Q_RFNPCNEX.\n"));
202                 return False;
203         }
204
205         r_u.status = _spoolss_rfnpcnex(&q_u.handle, q_u.change,
206                                        q_u.option, &r_u.info);
207
208         safe_free(q_u.option);
209
210         /* we always have a NOTIFY_INFO struct */
211         r_u.info_ptr=0x1;
212
213         if (!spoolss_io_r_rfnpcnex("", &r_u, rdata, 0)) {
214                 DEBUG(0,("spoolss_io_r_rfnpcnex: unable to marshall SPOOL_R_RFNPCNEX.\n"));
215                 return False;
216         }
217
218         safe_free(r_u.info.data);
219
220         return True;
221 }
222
223
224 /********************************************************************
225  * api_spoolss_enumprinters
226  * called from the spoolss dispatcher
227  *
228  ********************************************************************/
229 static BOOL api_spoolss_enumprinters(prs_struct *data, prs_struct *rdata) 
230 {
231         SPOOL_Q_ENUMPRINTERS q_u;
232         SPOOL_R_ENUMPRINTERS r_u;
233
234         ZERO_STRUCT(q_u);
235         ZERO_STRUCT(r_u);
236
237         if(!new_spoolss_allocate_buffer(&q_u.buffer))
238                 return False;
239
240         if (!spoolss_io_q_enumprinters("", &q_u, data, 0)) {
241                 DEBUG(0,("spoolss_io_q_enumprinters: unable to unmarshall SPOOL_Q_ENUMPRINTERS.\n"));
242                 return False;
243         }
244
245         /* that's an [in out] buffer */
246         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
247
248         r_u.status = _spoolss_enumprinters( q_u.flags, &q_u.servername, q_u.level,
249                                             r_u.buffer, q_u.offered,
250                                             &r_u.needed, &r_u.returned);
251
252         if (!new_spoolss_io_r_enumprinters("", &r_u, rdata, 0)) {
253                 DEBUG(0,("new_spoolss_io_r_enumprinters: unable to marshall SPOOL_R_ENUMPRINTERS.\n"));
254                 new_spoolss_free_buffer(q_u.buffer);
255                 return False;
256         }
257
258         new_spoolss_free_buffer(q_u.buffer);
259
260         return True;
261 }
262
263 /********************************************************************
264  * api_spoolss_getprinter
265  * called from the spoolss dispatcher
266  *
267  ********************************************************************/
268 static BOOL api_spoolss_getprinter(prs_struct *data, prs_struct *rdata) 
269 {
270         SPOOL_Q_GETPRINTER q_u;
271         SPOOL_R_GETPRINTER r_u;
272
273         ZERO_STRUCT(q_u);
274         ZERO_STRUCT(r_u);
275
276         if(!new_spoolss_allocate_buffer(&q_u.buffer))
277                 return False;
278
279         if(!spoolss_io_q_getprinter("", &q_u, data, 0)) {
280                 DEBUG(0,("spoolss_io_q_getprinter: unable to unmarshall SPOOL_Q_GETPRINTER.\n"));
281                 return False;
282         }
283
284         /* that's an [in out] buffer */
285         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
286
287         r_u.status = _spoolss_getprinter(&q_u.handle, q_u.level,
288                                          r_u.buffer, q_u.offered, 
289                                          &r_u.needed);
290
291         if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {
292                 DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));
293                 new_spoolss_free_buffer(q_u.buffer);
294                 return False;
295         }
296
297         new_spoolss_free_buffer(q_u.buffer);
298         return True;
299 }
300
301
302 /********************************************************************
303  * api_spoolss_getprinter
304  * called from the spoolss dispatcher
305  *
306  ********************************************************************/
307 static BOOL api_spoolss_getprinterdriver2(prs_struct *data, prs_struct *rdata)
308 {
309         SPOOL_Q_GETPRINTERDRIVER2 q_u;
310         SPOOL_R_GETPRINTERDRIVER2 r_u;
311
312         ZERO_STRUCT(q_u);
313         ZERO_STRUCT(r_u);
314
315         if(!new_spoolss_allocate_buffer(&q_u.buffer))
316                 return False;
317
318         if(!spoolss_io_q_getprinterdriver2("", &q_u, data, 0)) {
319                 DEBUG(0,("spoolss_io_q_getprinterdriver2: unable to unmarshall SPOOL_Q_GETPRINTERDRIVER2.\n"));
320                 return False;
321         }
322
323         /* that's an [in out] buffer */
324         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
325
326         r_u.status = _spoolss_getprinterdriver2(&q_u.handle, &q_u.architecture, q_u.level, 
327                                                 q_u.clientmajorversion, q_u.clientminorversion,
328                                                 r_u.buffer, q_u.offered,
329                                                 &r_u.needed, &r_u.servermajorversion, &r_u.serverminorversion);
330         
331         if(!spoolss_io_r_getprinterdriver2("",&r_u,rdata,0)) {
332                 DEBUG(0,("spoolss_io_r_getprinterdriver2: unable to marshall SPOOL_R_GETPRINTERDRIVER2.\n"));
333                 new_spoolss_free_buffer(q_u.buffer);
334                 return False;
335         }
336         
337         new_spoolss_free_buffer(q_u.buffer);
338         return True;
339 }
340
341 /********************************************************************
342  * api_spoolss_getprinter
343  * called from the spoolss dispatcher
344  *
345  ********************************************************************/
346 static BOOL api_spoolss_startpageprinter(prs_struct *data, prs_struct *rdata)
347 {
348         SPOOL_Q_STARTPAGEPRINTER q_u;
349         SPOOL_R_STARTPAGEPRINTER r_u;
350
351         ZERO_STRUCT(q_u);
352         ZERO_STRUCT(r_u);
353
354         if(!spoolss_io_q_startpageprinter("", &q_u, data, 0)) {
355                 DEBUG(0,("spoolss_io_q_startpageprinter: unable to unmarshall SPOOL_Q_STARTPAGEPRINTER.\n"));
356                 return False;
357         }
358
359         r_u.status = _spoolss_startpageprinter(&q_u.handle);
360
361         if(!spoolss_io_r_startpageprinter("",&r_u,rdata,0)) {
362                 DEBUG(0,("spoolss_io_r_startpageprinter: unable to marshall SPOOL_R_STARTPAGEPRINTER.\n"));
363                 return False;
364         }
365
366         return True;
367 }
368
369
370 /********************************************************************
371  * api_spoolss_getprinter
372  * called from the spoolss dispatcher
373  *
374  ********************************************************************/
375 static BOOL api_spoolss_endpageprinter(prs_struct *data, prs_struct *rdata)
376 {
377         SPOOL_Q_ENDPAGEPRINTER q_u;
378         SPOOL_R_ENDPAGEPRINTER r_u;
379
380         ZERO_STRUCT(q_u);
381         ZERO_STRUCT(r_u);
382
383         if(!spoolss_io_q_endpageprinter("", &q_u, data, 0)) {
384                 DEBUG(0,("spoolss_io_q_endpageprinter: unable to unmarshall SPOOL_Q_ENDPAGEPRINTER.\n"));
385                 return False;
386         }
387
388         r_u.status = _spoolss_endpageprinter(&q_u.handle);
389
390         if(!spoolss_io_r_endpageprinter("",&r_u,rdata,0)) {
391                 DEBUG(0,("spoolss_io_r_endpageprinter: unable to marshall SPOOL_R_ENDPAGEPRINTER.\n"));
392                 return False;
393         }
394
395         return True;
396 }
397
398 /********************************************************************
399 ********************************************************************/
400 static BOOL api_spoolss_startdocprinter(prs_struct *data, prs_struct *rdata)
401 {
402         SPOOL_Q_STARTDOCPRINTER q_u;
403         SPOOL_R_STARTDOCPRINTER r_u;
404
405         ZERO_STRUCT(q_u);
406         ZERO_STRUCT(r_u);
407
408         if(!spoolss_io_q_startdocprinter("", &q_u, data, 0)) {
409                 DEBUG(0,("spoolss_io_q_startdocprinter: unable to unmarshall SPOOL_Q_STARTDOCPRINTER.\n"));
410                 return False;
411         }
412
413         r_u.status = _spoolss_startdocprinter(&q_u.handle,
414                                   q_u.doc_info_container.level,
415                                   &q_u.doc_info_container.docinfo,
416                                   &r_u.jobid);
417
418         if(!spoolss_io_r_startdocprinter("",&r_u,rdata,0)) {
419                 DEBUG(0,("spoolss_io_r_startdocprinter: unable to marshall SPOOL_R_STARTDOCPRINTER.\n"));
420                 return False;
421         }
422
423         return True;
424 }
425
426
427 /********************************************************************
428 ********************************************************************/
429 static BOOL api_spoolss_enddocprinter(prs_struct *data, prs_struct *rdata)
430 {
431         SPOOL_Q_ENDDOCPRINTER q_u;
432         SPOOL_R_ENDDOCPRINTER r_u;
433
434         ZERO_STRUCT(q_u);
435         ZERO_STRUCT(r_u);
436
437         if(!spoolss_io_q_enddocprinter("", &q_u, data, 0)) {
438                 DEBUG(0,("spoolss_io_q_enddocprinter: unable to unmarshall SPOOL_Q_ENDDOCPRINTER.\n"));
439                 return False;
440         }
441
442         r_u.status = _spoolss_enddocprinter(&q_u.handle);
443
444         if(!spoolss_io_r_enddocprinter("",&r_u,rdata,0)) {
445                 DEBUG(0,("spoolss_io_r_enddocprinter: unable to marshall SPOOL_R_ENDDOCPRINTER.\n"));
446                 return False;
447         }
448
449         return True;            
450 }
451
452
453 /********************************************************************
454 ********************************************************************/
455 static BOOL api_spoolss_writeprinter(prs_struct *data, prs_struct *rdata)
456 {
457         SPOOL_Q_WRITEPRINTER q_u;
458         SPOOL_R_WRITEPRINTER r_u;
459
460         ZERO_STRUCT(q_u);
461         ZERO_STRUCT(r_u);
462
463         if(!spoolss_io_q_writeprinter("", &q_u, data, 0)) {
464                 DEBUG(0,("spoolss_io_q_writeprinter: unable to unmarshall SPOOL_Q_WRITEPRINTER.\n"));
465                 return False;
466         }
467
468         r_u.status = _spoolss_writeprinter(&q_u.handle,
469                                            q_u.buffer_size,
470                                            q_u.buffer,
471                                            &q_u.buffer_size2);
472         r_u.buffer_written = q_u.buffer_size2;
473         safe_free(q_u.buffer);
474
475         if(!spoolss_io_r_writeprinter("",&r_u,rdata,0)) {
476                 DEBUG(0,("spoolss_io_r_writeprinter: unable to marshall SPOOL_R_WRITEPRINTER.\n"));
477                 return False;
478         }
479
480         return True;
481 }
482
483 /****************************************************************************
484
485 ****************************************************************************/
486 static BOOL api_spoolss_setprinter(prs_struct *data, prs_struct *rdata)
487 {
488         SPOOL_Q_SETPRINTER q_u;
489         SPOOL_R_SETPRINTER r_u;
490
491         ZERO_STRUCT(q_u);
492         ZERO_STRUCT(r_u);
493
494         if(!spoolss_io_q_setprinter("", &q_u, data, 0)) {
495                 DEBUG(0,("spoolss_io_q_setprinter: unable to unmarshall SPOOL_Q_SETPRINTER.\n"));
496                 return False;
497         }
498         
499         r_u.status = _spoolss_setprinter(&q_u.handle, q_u.level, &q_u.info,
500                                          q_u.devmode_ctr, q_u.command);
501         
502         /* now, we can free the memory */
503         if (q_u.info.level==2 && q_u.info.info_ptr!=0)
504                 safe_free(q_u.info.info_2);
505                 
506         if (q_u.devmode_ctr.devmode_ptr!=0)
507                 safe_free(q_u.devmode_ctr.devmode);
508         
509         if(!spoolss_io_r_setprinter("",&r_u,rdata,0)) {
510                 DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n"));
511                 return False;
512         }
513
514         return True;
515 }
516
517 /****************************************************************************
518 ****************************************************************************/
519 static BOOL api_spoolss_fcpn(prs_struct *data, prs_struct *rdata)
520 {
521         SPOOL_Q_FCPN q_u;
522         SPOOL_R_FCPN r_u;
523
524         ZERO_STRUCT(q_u);
525         ZERO_STRUCT(r_u);
526
527         if(!spoolss_io_q_fcpn("", &q_u, data, 0)) {
528                 DEBUG(0,("spoolss_io_q_fcpn: unable to unmarshall SPOOL_Q_FCPN.\n"));
529                 return False;
530         }
531
532         r_u.status = _spoolss_fcpn(&q_u.handle);
533
534         if(!spoolss_io_r_fcpn("",&r_u,rdata,0)) {
535                 DEBUG(0,("spoolss_io_r_fcpn: unable to marshall SPOOL_R_FCPN.\n"));
536                 return False;
537         }
538
539         return True;
540 }
541
542
543 /****************************************************************************
544 ****************************************************************************/
545 static BOOL api_spoolss_addjob(prs_struct *data, prs_struct *rdata)
546 {
547         SPOOL_Q_ADDJOB q_u;
548         SPOOL_R_ADDJOB r_u;
549
550         ZERO_STRUCT(q_u);
551         ZERO_STRUCT(r_u);
552
553         if(!new_spoolss_allocate_buffer(&q_u.buffer))
554                 return False;
555
556         if(!spoolss_io_q_addjob("", &q_u, data, 0)) {
557                 DEBUG(0,("spoolss_io_q_addjob: unable to unmarshall SPOOL_Q_ADDJOB.\n"));
558                 return False;
559         }
560
561         /* that's only an [in] buffer ! */
562
563         r_u.status = _spoolss_addjob(&q_u.handle, q_u.level,
564                                      q_u.buffer, q_u.offered);
565                 
566         if(!spoolss_io_r_addjob("",&r_u,rdata,0)) {
567                 DEBUG(0,("spoolss_io_r_addjob: unable to marshall SPOOL_R_ADDJOB.\n"));
568                 new_spoolss_free_buffer(q_u.buffer);
569                 return False;
570         }
571
572         new_spoolss_free_buffer(q_u.buffer);
573
574         return True;            
575 }
576
577
578 /****************************************************************************
579 ****************************************************************************/
580 static BOOL api_spoolss_enumjobs(prs_struct *data, prs_struct *rdata)
581 {
582         SPOOL_Q_ENUMJOBS q_u;
583         SPOOL_R_ENUMJOBS r_u;
584
585         ZERO_STRUCT(q_u);
586         ZERO_STRUCT(r_u);
587
588         if(!new_spoolss_allocate_buffer(&q_u.buffer))
589                 return False;
590
591         if (!spoolss_io_q_enumjobs("", &q_u, data, 0)) {
592                 DEBUG(0,("spoolss_io_q_enumjobs: unable to unmarshall SPOOL_Q_ENUMJOBS.\n"));
593                 return False;
594         }
595
596         /* that's an [in out] buffer */
597         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
598
599         r_u.status = _spoolss_enumjobs(&q_u.handle, q_u.firstjob, q_u.numofjobs, q_u.level,
600                                         r_u.buffer, q_u.offered,
601                                         &r_u.needed, &r_u.returned);
602
603         if (!spoolss_io_r_enumjobs("",&r_u,rdata,0)) {
604                 DEBUG(0,("spoolss_io_r_enumjobs: unable to marshall SPOOL_R_ENUMJOBS.\n"));
605                 new_spoolss_free_buffer(q_u.buffer);
606                 return False;
607         }
608
609         new_spoolss_free_buffer(q_u.buffer);
610
611         return True;
612 }
613
614
615 /****************************************************************************
616 ****************************************************************************/
617 static BOOL api_spoolss_schedulejob(prs_struct *data, prs_struct *rdata)
618 {
619         SPOOL_Q_SCHEDULEJOB q_u;
620         SPOOL_R_SCHEDULEJOB r_u;
621
622         ZERO_STRUCT(q_u);
623         ZERO_STRUCT(r_u);
624
625         if(!spoolss_io_q_schedulejob("", &q_u, data, 0)) {
626                 DEBUG(0,("spoolss_io_q_schedulejob: unable to unmarshall SPOOL_Q_SCHEDULEJOB.\n"));
627                 return False;
628         }
629
630         r_u.status = _spoolss_schedulejob(&q_u.handle, q_u.jobid);
631
632         if(!spoolss_io_r_schedulejob("",&r_u,rdata,0)) {
633                 DEBUG(0,("spoolss_io_r_schedulejob: unable to marshall SPOOL_R_SCHEDULEJOB.\n"));
634                 return False;
635         }
636
637         return True;
638 }
639
640 /****************************************************************************
641 ****************************************************************************/
642 static BOOL api_spoolss_setjob(prs_struct *data, prs_struct *rdata)
643 {
644         SPOOL_Q_SETJOB q_u;
645         SPOOL_R_SETJOB r_u;
646
647         ZERO_STRUCT(q_u);
648         ZERO_STRUCT(r_u);
649
650         if(!spoolss_io_q_setjob("", &q_u, data, 0)) {
651                 DEBUG(0,("spoolss_io_q_setjob: unable to unmarshall SPOOL_Q_SETJOB.\n"));
652                 return False;
653         }
654
655         r_u.status = _spoolss_setjob(&q_u.handle, q_u.jobid,
656                                 q_u.level, &q_u.ctr, q_u.command);
657
658         if(!spoolss_io_r_setjob("",&r_u,rdata,0)) {
659                 DEBUG(0,("spoolss_io_r_setjob: unable to marshall SPOOL_R_SETJOB.\n"));
660                 return False;
661         }
662
663         return True;
664 }
665
666 /****************************************************************************
667 ****************************************************************************/
668
669 static BOOL api_spoolss_enumprinterdrivers(prs_struct *data, prs_struct *rdata)
670 {
671         SPOOL_Q_ENUMPRINTERDRIVERS q_u;
672         SPOOL_R_ENUMPRINTERDRIVERS r_u;
673
674         ZERO_STRUCT(q_u);
675         ZERO_STRUCT(r_u);
676
677         if(!new_spoolss_allocate_buffer(&q_u.buffer))
678                 return False;
679
680         if (!spoolss_io_q_enumprinterdrivers("", &q_u, data, 0)) {
681                 DEBUG(0,("spoolss_io_q_enumprinterdrivers: unable to unmarshall SPOOL_Q_ENUMPRINTERDRIVERS.\n"));
682                 return False;
683         }
684
685         /* that's an [in out] buffer */
686         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
687
688         r_u.status = _spoolss_enumprinterdrivers(&q_u.name, &q_u.environment, q_u.level,
689                                                  r_u.buffer, q_u.offered,
690                                                  &r_u.needed, &r_u.returned);
691
692         if (!new_spoolss_io_r_enumprinterdrivers("",&r_u,rdata,0)) {
693                 DEBUG(0,("new_spoolss_io_r_enumprinterdrivers: unable to marshall SPOOL_R_ENUMPRINTERDRIVERS.\n"));
694                 new_spoolss_free_buffer(q_u.buffer);
695                 return False;
696         }
697
698         new_spoolss_free_buffer(q_u.buffer);
699
700         return True;
701 }
702
703
704 /****************************************************************************
705 ****************************************************************************/
706 static BOOL api_spoolss_enumforms(prs_struct *data, prs_struct *rdata)
707 {
708         SPOOL_Q_ENUMFORMS q_u;
709         SPOOL_R_ENUMFORMS r_u;
710
711         ZERO_STRUCT(q_u);
712         ZERO_STRUCT(r_u);
713
714         if(!new_spoolss_allocate_buffer(&q_u.buffer))
715                 return False;
716
717         if (!spoolss_io_q_enumforms("", &q_u, data, 0)) {
718                 DEBUG(0,("spoolss_io_q_enumforms: unable to unmarshall SPOOL_Q_ENUMFORMS.\n"));
719                 return False;
720         }
721
722         /* that's an [in out] buffer */
723         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
724
725         r_u.status = _new_spoolss_enumforms(&q_u.handle, q_u.level, 
726                                 r_u.buffer, q_u.offered,
727                                 &r_u.needed, &r_u.numofforms);
728
729         if (!new_spoolss_io_r_enumforms("",&r_u,rdata,0)) {
730                 DEBUG(0,("new_spoolss_io_r_enumforms: unable to marshall SPOOL_R_ENUMFORMS.\n"));
731                 new_spoolss_free_buffer(q_u.buffer);
732                 return False;
733         }
734
735         new_spoolss_free_buffer(q_u.buffer);
736
737         return True;
738 }
739
740
741 /****************************************************************************
742 ****************************************************************************/
743 static BOOL api_spoolss_enumports(prs_struct *data, prs_struct *rdata)
744 {
745         SPOOL_Q_ENUMPORTS q_u;
746         SPOOL_R_ENUMPORTS r_u;
747
748         ZERO_STRUCT(q_u);
749         ZERO_STRUCT(r_u);
750
751         if(!new_spoolss_allocate_buffer(&q_u.buffer))
752                 return False;
753
754         if(!spoolss_io_q_enumports("", &q_u, data, 0)) {
755                 DEBUG(0,("spoolss_io_q_enumports: unable to unmarshall SPOOL_Q_ENUMPORTS.\n"));
756                 return False;
757         }
758
759         /* that's an [in out] buffer */
760         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
761
762         r_u.status = _spoolss_enumports(&q_u.name, q_u.level,
763                                         r_u.buffer, q_u.offered,
764                                         &r_u.needed, &r_u.returned);
765
766         if (!new_spoolss_io_r_enumports("",&r_u,rdata,0)) {
767                 DEBUG(0,("new_spoolss_io_r_enumports: unable to marshall SPOOL_R_ENUMPORTS.\n"));
768                 new_spoolss_free_buffer(q_u.buffer);
769                 return False;
770         }
771
772         new_spoolss_free_buffer(q_u.buffer);
773
774         return True;
775 }
776
777
778 /****************************************************************************
779 ****************************************************************************/
780 static BOOL api_spoolss_addprinterex(prs_struct *data, prs_struct *rdata)
781 {
782         SPOOL_Q_ADDPRINTEREX q_u;
783         SPOOL_R_ADDPRINTEREX r_u;
784         
785         ZERO_STRUCT(q_u);
786         ZERO_STRUCT(r_u);
787         
788         if(!spoolss_io_q_addprinterex("", &q_u, data, 0)) {
789                 DEBUG(0,("spoolss_io_q_addprinterex: unable to unmarshall SPOOL_Q_ADDPRINTEREX.\n"));
790                 return False;
791         }
792         
793         r_u.status = _spoolss_addprinterex(&q_u.server_name,
794                                 q_u.level, &q_u.info,
795                                 q_u.unk0, q_u.unk1, q_u.unk2, q_u.unk3,
796                                 q_u.user_switch, &q_u.user_ctr,
797                                 &r_u.handle);
798                                 
799         if(!spoolss_io_r_addprinterex("", &r_u, rdata, 0)) {
800                 DEBUG(0,("spoolss_io_r_addprinterex: unable to marshall SPOOL_R_ADDPRINTEREX.\n"));
801                 return False;
802         }
803         
804         if (q_u.info.info_ptr!=0) {
805                 switch (q_u.info.level) {
806                         case 1:
807                                 safe_free(q_u.info.info_1);
808                                 break;
809                         case 2:
810                                 safe_free(q_u.info.info_2);
811                                 break;
812                 }
813         }
814                 
815         return True;
816 }
817
818 /****************************************************************************
819 ****************************************************************************/
820 static BOOL api_spoolss_addprinterdriver(prs_struct *data, prs_struct *rdata)
821 {
822         SPOOL_Q_ADDPRINTERDRIVER q_u;
823         SPOOL_R_ADDPRINTERDRIVER r_u;
824         
825         ZERO_STRUCT(q_u);
826         ZERO_STRUCT(r_u);
827         
828         if(!spoolss_io_q_addprinterdriver("", &q_u, data, 0)) {
829                 DEBUG(0,("spoolss_io_q_addprinterdriver: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVER.\n"));
830                 return False;
831         }
832         
833         r_u.status = _spoolss_addprinterdriver(&q_u.server_name, q_u.level, &q_u.info);
834                                 
835         if(!spoolss_io_r_addprinterdriver("", &r_u, rdata, 0)) {
836                 DEBUG(0,("spoolss_io_r_addprinterdriver: unable to marshall SPOOL_R_ADDPRINTERDRIVER.\n"));
837                 return False;
838         }
839         
840         return True;
841 }
842
843 /****************************************************************************
844 ****************************************************************************/
845 static BOOL api_spoolss_getprinterdriverdirectory(prs_struct *data, prs_struct *rdata)
846 {
847         SPOOL_Q_GETPRINTERDRIVERDIR q_u;
848         SPOOL_R_GETPRINTERDRIVERDIR r_u;
849
850         ZERO_STRUCT(q_u);
851         ZERO_STRUCT(r_u);
852
853         if(!new_spoolss_allocate_buffer(&q_u.buffer))
854                 return False;
855
856         if(!spoolss_io_q_getprinterdriverdir("", &q_u, data, 0)) {
857                 DEBUG(0,("spoolss_io_q_getprinterdriverdir: unable to unmarshall SPOOL_Q_GETPRINTERDRIVERDIR.\n"));
858                 return False;
859         }
860
861         /* that's an [in out] buffer */
862         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
863
864         r_u.status = _spoolss_getprinterdriverdirectory(&q_u.name, &q_u.environment, q_u.level,
865                                                         r_u.buffer, q_u.offered,
866                                                         &r_u.needed);
867
868         if(!spoolss_io_r_getprinterdriverdir("", &r_u, rdata, 0)) {
869                 DEBUG(0,("spoolss_io_r_getprinterdriverdir: unable to marshall SPOOL_R_GETPRINTERDRIVERDIR.\n"));
870                 new_spoolss_free_buffer(q_u.buffer);
871                 return False;
872         }
873
874         new_spoolss_free_buffer(q_u.buffer);
875
876         return True;
877 }
878
879 /****************************************************************************
880 ****************************************************************************/
881 static BOOL api_spoolss_enumprinterdata(prs_struct *data, prs_struct *rdata)
882 {
883         SPOOL_Q_ENUMPRINTERDATA q_u;
884         SPOOL_R_ENUMPRINTERDATA r_u;
885         
886         ZERO_STRUCT(q_u);
887         ZERO_STRUCT(r_u);
888         
889         if(!spoolss_io_q_enumprinterdata("", &q_u, data, 0)) {
890                 DEBUG(0,("spoolss_io_q_enumprinterdata: unable to unmarshall SPOOL_Q_ENUMPRINTERDATA.\n"));
891                 return False;
892         }
893         
894         r_u.status = _spoolss_enumprinterdata(&q_u.handle, q_u.index, q_u.valuesize, q_u.datasize,
895                                                 &r_u.valuesize, &r_u.value, &r_u.realvaluesize,
896                                                 &r_u.type,
897                                                 &r_u.datasize, &r_u.data, &r_u.realdatasize);
898                                 
899         if(!spoolss_io_r_enumprinterdata("", &r_u, rdata, 0)) {
900                 DEBUG(0,("spoolss_io_r_enumprinterdata: unable to marshall SPOOL_R_ENUMPRINTERDATA.\n"));
901                 safe_free(r_u.value);
902                 safe_free(r_u.data);
903                 return False;
904         }
905
906         safe_free(r_u.value);
907         safe_free(r_u.data);
908
909         return True;
910 }
911
912 /****************************************************************************
913 ****************************************************************************/
914 static BOOL api_spoolss_setprinterdata(prs_struct *data, prs_struct *rdata)
915 {
916         SPOOL_Q_SETPRINTERDATA q_u;
917         SPOOL_R_SETPRINTERDATA r_u;     
918         
919         ZERO_STRUCT(q_u);
920         ZERO_STRUCT(r_u);
921         
922         if(!spoolss_io_q_setprinterdata("", &q_u, data, 0)) {
923                 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
924                 return False;
925         }
926         
927         r_u.status = _spoolss_setprinterdata(&q_u.handle,
928                                 &q_u.value, q_u.type, q_u.max_len,
929                                 q_u.data, q_u.real_len, q_u.numeric_data);
930                                 
931         if(!spoolss_io_r_setprinterdata("", &r_u, rdata, 0)) {
932                 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_SETPRINTERDATA.\n"));
933                 return False;
934         }
935
936         return True;
937 }
938
939 /****************************************************************************
940 ****************************************************************************/
941 static BOOL api_spoolss_addform(prs_struct *data, prs_struct *rdata)
942 {
943         SPOOL_Q_ADDFORM q_u;
944         SPOOL_R_ADDFORM r_u;
945
946         ZERO_STRUCT(q_u);
947         ZERO_STRUCT(r_u);
948         
949         if(!spoolss_io_q_addform("", &q_u, data, 0)) {
950                 DEBUG(0,("spoolss_io_q_addform: unable to unmarshall SPOOL_Q_ADDFORM.\n"));
951                 return False;
952         }
953         
954         r_u.status = _spoolss_addform(&q_u.handle, q_u.level, &q_u.form);
955         
956         if(!spoolss_io_r_addform("", &r_u, rdata, 0)) {
957                 DEBUG(0,("spoolss_io_r_addform: unable to marshall SPOOL_R_ADDFORM.\n"));
958                 return False;
959         }
960
961         return True;
962 }
963
964 /****************************************************************************
965 ****************************************************************************/
966 static BOOL api_spoolss_setform(prs_struct *data, prs_struct *rdata)
967 {
968         SPOOL_Q_SETFORM q_u;
969         SPOOL_R_SETFORM r_u;
970
971         ZERO_STRUCT(q_u);
972         ZERO_STRUCT(r_u);
973         
974         if(!spoolss_io_q_setform("", &q_u, data, 0)) {
975                 DEBUG(0,("spoolss_io_q_setform: unable to unmarshall SPOOL_Q_SETFORM.\n"));
976                 return False;
977         }
978         
979         r_u.status = _spoolss_setform(&q_u.handle, &q_u.name, q_u.level, &q_u.form);
980                                       
981         if(!spoolss_io_r_setform("", &r_u, rdata, 0)) {
982                 DEBUG(0,("spoolss_io_r_setform: unable to marshall SPOOL_R_SETFORM.\n"));
983                 return False;
984         }
985
986         return True;
987 }
988
989 /****************************************************************************
990 ****************************************************************************/
991 static BOOL api_spoolss_enumprintprocessors(prs_struct *data, prs_struct *rdata)
992 {
993         SPOOL_Q_ENUMPRINTPROCESSORS q_u;
994         SPOOL_R_ENUMPRINTPROCESSORS r_u;
995
996         ZERO_STRUCT(q_u);
997         ZERO_STRUCT(r_u);
998         
999         if(!new_spoolss_allocate_buffer(&q_u.buffer))
1000                 return False;
1001
1002         if(!spoolss_io_q_enumprintprocessors("", &q_u, data, 0)) {
1003                 DEBUG(0,("spoolss_io_q_enumprintprocessors: unable to unmarshall SPOOL_Q_ENUMPRINTPROCESSORS.\n"));
1004                 return False;
1005         }
1006         
1007         /* that's an [in out] buffer */
1008         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
1009         
1010         r_u.status = _spoolss_enumprintprocessors(&q_u.name, &q_u.environment, q_u.level,
1011                                                   r_u.buffer, q_u.offered,
1012                                                   &r_u.needed, &r_u.returned);
1013
1014         if(!spoolss_io_r_enumprintprocessors("", &r_u, rdata, 0)) {
1015                 DEBUG(0,("spoolss_io_r_enumprintprocessors: unable to marshall SPOOL_R_ENUMPRINTPROCESSORS.\n"));
1016                 new_spoolss_free_buffer(q_u.buffer);
1017                 return False;
1018         }
1019         
1020         new_spoolss_free_buffer(q_u.buffer);
1021         
1022         return True;
1023 }
1024
1025 /****************************************************************************
1026 ****************************************************************************/
1027 static BOOL api_spoolss_enumprintprocdatatypes(prs_struct *data, prs_struct *rdata)
1028 {
1029         SPOOL_Q_ENUMPRINTPROCDATATYPES q_u;
1030         SPOOL_R_ENUMPRINTPROCDATATYPES r_u;
1031
1032         ZERO_STRUCT(q_u);
1033         ZERO_STRUCT(r_u);
1034         
1035         if(!new_spoolss_allocate_buffer(&q_u.buffer))
1036                 return False;
1037
1038         if(!spoolss_io_q_enumprintprocdatatypes("", &q_u, data, 0)) {
1039                 DEBUG(0,("spoolss_io_q_enumprintprocdatatypes: unable to unmarshall SPOOL_Q_ENUMPRINTPROCDATATYPES.\n"));
1040                 return False;
1041         }
1042         
1043         /* that's an [in out] buffer */
1044         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
1045         
1046         r_u.status = _spoolss_enumprintprocdatatypes(&q_u.name, &q_u.processor, q_u.level,
1047                                                      r_u.buffer, q_u.offered,
1048                                                      &r_u.needed, &r_u.returned);
1049
1050         if(!spoolss_io_r_enumprintprocdatatypes("", &r_u, rdata, 0)) {
1051                 DEBUG(0,("spoolss_io_r_enumprintprocdatatypes: unable to marshall SPOOL_R_ENUMPRINTPROCDATATYPES.\n"));
1052                 new_spoolss_free_buffer(q_u.buffer);
1053                 return False;
1054         }
1055         
1056         new_spoolss_free_buffer(q_u.buffer);
1057         
1058         return True;
1059 }
1060
1061 /****************************************************************************
1062 ****************************************************************************/
1063 static BOOL api_spoolss_enumprintmonitors(prs_struct *data, prs_struct *rdata)
1064 {
1065         SPOOL_Q_ENUMPRINTMONITORS q_u;
1066         SPOOL_R_ENUMPRINTMONITORS r_u;
1067
1068         ZERO_STRUCT(q_u);
1069         ZERO_STRUCT(r_u);
1070         
1071         if(!new_spoolss_allocate_buffer(&q_u.buffer))
1072                 return False;
1073
1074         if (!spoolss_io_q_enumprintmonitors("", &q_u, data, 0)) {
1075                 DEBUG(0,("spoolss_io_q_enumprintmonitors: unable to unmarshall SPOOL_Q_ENUMPRINTMONITORS.\n"));
1076                 return False;
1077         }
1078                 
1079         /* that's an [in out] buffer */
1080         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
1081
1082         r_u.status = _spoolss_enumprintmonitors(&q_u.name, q_u.level,
1083                                                 r_u.buffer, q_u.offered,
1084                                                 &r_u.needed, &r_u.returned);
1085
1086         if (!spoolss_io_r_enumprintmonitors("", &r_u, rdata, 0)) {
1087                 DEBUG(0,("spoolss_io_r_enumprintmonitors: unable to marshall SPOOL_R_ENUMPRINTMONITORS.\n"));
1088                 new_spoolss_free_buffer(q_u.buffer);
1089                 return False;
1090         }
1091         
1092         new_spoolss_free_buffer(q_u.buffer);
1093         
1094         return True;
1095 }
1096
1097 /****************************************************************************
1098 ****************************************************************************/
1099 static BOOL api_spoolss_getjob(prs_struct *data, prs_struct *rdata)
1100 {
1101         SPOOL_Q_GETJOB q_u;
1102         SPOOL_R_GETJOB r_u;
1103         
1104         if(!new_spoolss_allocate_buffer(&q_u.buffer))
1105                 return False;
1106
1107         if(!spoolss_io_q_getjob("", &q_u, data, 0)) {
1108                 DEBUG(0,("spoolss_io_q_getjob: unable to unmarshall SPOOL_Q_GETJOB.\n"));
1109                 return False;
1110         }
1111
1112         /* that's an [in out] buffer */
1113         new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
1114
1115         r_u.status = _spoolss_getjob(&q_u.handle, q_u.jobid, q_u.level,
1116                                         r_u.buffer, q_u.offered,
1117                                         &r_u.needed);
1118         
1119         if(!spoolss_io_r_getjob("",&r_u,rdata,0)) {
1120                 DEBUG(0,("spoolss_io_r_getjob: unable to marshall SPOOL_R_GETJOB.\n"));
1121                 new_spoolss_free_buffer(q_u.buffer);
1122                 return False;
1123         }
1124                 
1125         new_spoolss_free_buffer(q_u.buffer);
1126         return True;
1127 }
1128
1129 /*******************************************************************
1130 \pipe\spoolss commands
1131 ********************************************************************/
1132 struct api_struct api_spoolss_cmds[] = 
1133 {
1134  {"SPOOLSS_OPENPRINTEREX",             SPOOLSS_OPENPRINTEREX,             api_spoolss_open_printer_ex           },
1135  {"SPOOLSS_GETPRINTERDATA",            SPOOLSS_GETPRINTERDATA,            api_spoolss_getprinterdata            },
1136  {"SPOOLSS_CLOSEPRINTER",              SPOOLSS_CLOSEPRINTER,              api_spoolss_closeprinter              },
1137  {"SPOOLSS_DELETEPRINTER",             SPOOLSS_DELETEPRINTER,             api_spoolss_deleteprinter             },
1138  {"SPOOLSS_RFFPCNEX",                  SPOOLSS_RFFPCNEX,                  api_spoolss_rffpcnex                  },
1139  {"SPOOLSS_RFNPCNEX",                  SPOOLSS_RFNPCNEX,                  api_spoolss_rfnpcnex                  },
1140  {"SPOOLSS_ENUMPRINTERS",              SPOOLSS_ENUMPRINTERS,              api_spoolss_enumprinters              },
1141  {"SPOOLSS_GETPRINTER",                SPOOLSS_GETPRINTER,                api_spoolss_getprinter                },
1142  {"SPOOLSS_GETPRINTERDRIVER2",         SPOOLSS_GETPRINTERDRIVER2,         api_spoolss_getprinterdriver2         }, 
1143  {"SPOOLSS_STARTPAGEPRINTER",          SPOOLSS_STARTPAGEPRINTER,          api_spoolss_startpageprinter          },
1144  {"SPOOLSS_ENDPAGEPRINTER",            SPOOLSS_ENDPAGEPRINTER,            api_spoolss_endpageprinter            }, 
1145  {"SPOOLSS_STARTDOCPRINTER",           SPOOLSS_STARTDOCPRINTER,           api_spoolss_startdocprinter           },
1146  {"SPOOLSS_ENDDOCPRINTER",             SPOOLSS_ENDDOCPRINTER,             api_spoolss_enddocprinter             },
1147  {"SPOOLSS_WRITEPRINTER",              SPOOLSS_WRITEPRINTER,              api_spoolss_writeprinter              },
1148  {"SPOOLSS_SETPRINTER",                SPOOLSS_SETPRINTER,                api_spoolss_setprinter                },
1149  {"SPOOLSS_FCPN",                      SPOOLSS_FCPN,                      api_spoolss_fcpn                      },
1150  {"SPOOLSS_ADDJOB",                    SPOOLSS_ADDJOB,                    api_spoolss_addjob                    },
1151  {"SPOOLSS_ENUMJOBS",                  SPOOLSS_ENUMJOBS,                  api_spoolss_enumjobs                  },
1152  {"SPOOLSS_SCHEDULEJOB",               SPOOLSS_SCHEDULEJOB,               api_spoolss_schedulejob               },
1153  {"SPOOLSS_SETJOB",                    SPOOLSS_SETJOB,                    api_spoolss_setjob                    },
1154  {"SPOOLSS_ENUMFORMS",                 SPOOLSS_ENUMFORMS,                 api_spoolss_enumforms                 },
1155  {"SPOOLSS_ENUMPORTS",                 SPOOLSS_ENUMPORTS,                 api_spoolss_enumports                 },
1156  {"SPOOLSS_ENUMPRINTERDRIVERS",        SPOOLSS_ENUMPRINTERDRIVERS,        api_spoolss_enumprinterdrivers        },
1157  {"SPOOLSS_ADDPRINTEREX",              SPOOLSS_ADDPRINTEREX,              api_spoolss_addprinterex              },
1158  {"SPOOLSS_ADDPRINTERDRIVER",          SPOOLSS_ADDPRINTERDRIVER,          api_spoolss_addprinterdriver          },
1159  {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_getprinterdriverdirectory },
1160  {"SPOOLSS_ENUMPRINTERDATA",           SPOOLSS_ENUMPRINTERDATA,           api_spoolss_enumprinterdata           },
1161  {"SPOOLSS_SETPRINTERDATA",            SPOOLSS_SETPRINTERDATA,            api_spoolss_setprinterdata            },
1162  {"SPOOLSS_ADDFORM",                   SPOOLSS_ADDFORM,                   api_spoolss_addform                   },
1163  {"SPOOLSS_SETFORM",                   SPOOLSS_SETFORM,                   api_spoolss_setform                   },
1164  {"SPOOLSS_ENUMPRINTPROCESSORS",       SPOOLSS_ENUMPRINTPROCESSORS,       api_spoolss_enumprintprocessors       },
1165  {"SPOOLSS_ENUMMONITORS",              SPOOLSS_ENUMMONITORS,              api_spoolss_enumprintmonitors         },
1166  {"SPOOLSS_GETJOB",                    SPOOLSS_GETJOB,                    api_spoolss_getjob                    },
1167  {"SPOOLSS_ENUMPRINTPROCDATATYPES",    SPOOLSS_ENUMPRINTPROCDATATYPES,    api_spoolss_enumprintprocdatatypes    },
1168  { NULL,                               0,                                 NULL                                  }
1169 };
1170
1171 /*******************************************************************
1172 receives a spoolss pipe and responds.
1173 ********************************************************************/
1174 BOOL api_spoolss_rpc(pipes_struct *p, prs_struct *data)
1175 {
1176         return api_rpcTNP(p, "api_spoolss_rpc", api_spoolss_cmds, data);
1177 }