source: branches/samba-3.0/source/rpc_server/srv_spoolss.c

Last change on this file was 1, checked in by Paul Smedley, 19 years ago

Initial code import

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