2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2000,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6 * Copyright (C) Jean François Micouleau 1998-2000,
7 * Copyright (C) Jeremy Allison 2001,
8 * Copyright (C) Gerald Carter 2001-2002,
9 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <http://www.gnu.org/licenses/>.
28 #define DBGC_CLASS DBGC_RPC_SRV
30 /********************************************************************
31 * api_spoolss_open_printer_ex (rarely seen - older call)
32 ********************************************************************/
34 static bool api_spoolss_open_printer(pipes_struct
*p
)
36 SPOOL_Q_OPEN_PRINTER q_u
;
37 SPOOL_R_OPEN_PRINTER r_u
;
38 prs_struct
*data
= &p
->in_data
.data
;
39 prs_struct
*rdata
= &p
->out_data
.rdata
;
44 if (!spoolss_io_q_open_printer("", &q_u
, data
, 0)) {
45 DEBUG(0,("spoolss_io_q_open_printer: unable to unmarshall SPOOL_Q_OPEN_PRINTER.\n"));
49 r_u
.status
= _spoolss_open_printer( p
, &q_u
, &r_u
);
51 if (!spoolss_io_r_open_printer("",&r_u
,rdata
,0)){
52 DEBUG(0,("spoolss_io_r_open_printer: unable to marshall SPOOL_R_OPEN_PRINTER.\n"));
60 /********************************************************************
61 * api_spoolss_open_printer_ex
62 ********************************************************************/
64 static bool api_spoolss_open_printer_ex(pipes_struct
*p
)
66 SPOOL_Q_OPEN_PRINTER_EX q_u
;
67 SPOOL_R_OPEN_PRINTER_EX r_u
;
68 prs_struct
*data
= &p
->in_data
.data
;
69 prs_struct
*rdata
= &p
->out_data
.rdata
;
74 if (!spoolss_io_q_open_printer_ex("", &q_u
, data
, 0)) {
75 DEBUG(0,("spoolss_io_q_open_printer_ex: unable to unmarshall SPOOL_Q_OPEN_PRINTER_EX.\n"));
79 r_u
.status
= _spoolss_open_printer_ex( p
, &q_u
, &r_u
);
81 if (!spoolss_io_r_open_printer_ex("",&r_u
,rdata
,0)){
82 DEBUG(0,("spoolss_io_r_open_printer_ex: unable to marshall SPOOL_R_OPEN_PRINTER_EX.\n"));
89 /********************************************************************
90 * api_spoolss_getprinterdata
92 * called from the spoolss dispatcher
93 ********************************************************************/
95 static bool api_spoolss_getprinterdata(pipes_struct
*p
)
97 SPOOL_Q_GETPRINTERDATA q_u
;
98 SPOOL_R_GETPRINTERDATA r_u
;
99 prs_struct
*data
= &p
->in_data
.data
;
100 prs_struct
*rdata
= &p
->out_data
.rdata
;
105 /* read the stream and fill the struct */
106 if (!spoolss_io_q_getprinterdata("", &q_u
, data
, 0)) {
107 DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall SPOOL_Q_GETPRINTERDATA.\n"));
111 r_u
.status
= _spoolss_getprinterdata( p
, &q_u
, &r_u
);
113 if (!spoolss_io_r_getprinterdata("", &r_u
, rdata
, 0)) {
114 DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall SPOOL_R_GETPRINTERDATA.\n"));
121 /********************************************************************
122 * api_spoolss_deleteprinterdata
124 * called from the spoolss dispatcher
125 ********************************************************************/
127 static bool api_spoolss_deleteprinterdata(pipes_struct
*p
)
129 SPOOL_Q_DELETEPRINTERDATA q_u
;
130 SPOOL_R_DELETEPRINTERDATA r_u
;
131 prs_struct
*data
= &p
->in_data
.data
;
132 prs_struct
*rdata
= &p
->out_data
.rdata
;
137 /* read the stream and fill the struct */
138 if (!spoolss_io_q_deleteprinterdata("", &q_u
, data
, 0)) {
139 DEBUG(0,("spoolss_io_q_deleteprinterdata: unable to unmarshall SPOOL_Q_DELETEPRINTERDATA.\n"));
143 r_u
.status
= _spoolss_deleteprinterdata( p
, &q_u
, &r_u
);
145 if (!spoolss_io_r_deleteprinterdata("", &r_u
, rdata
, 0)) {
146 DEBUG(0,("spoolss_io_r_deleteprinterdata: unable to marshall SPOOL_R_DELETEPRINTERDATA.\n"));
153 /********************************************************************
154 * api_spoolss_closeprinter
156 * called from the spoolss dispatcher
157 ********************************************************************/
159 static bool api_spoolss_closeprinter(pipes_struct
*p
)
161 SPOOL_Q_CLOSEPRINTER q_u
;
162 SPOOL_R_CLOSEPRINTER r_u
;
163 prs_struct
*data
= &p
->in_data
.data
;
164 prs_struct
*rdata
= &p
->out_data
.rdata
;
169 if (!spoolss_io_q_closeprinter("", &q_u
, data
, 0)) {
170 DEBUG(0,("spoolss_io_q_closeprinter: unable to unmarshall SPOOL_Q_CLOSEPRINTER.\n"));
174 r_u
.status
= _spoolss_closeprinter(p
, &q_u
, &r_u
);
176 if (!spoolss_io_r_closeprinter("",&r_u
,rdata
,0)) {
177 DEBUG(0,("spoolss_io_r_closeprinter: unable to marshall SPOOL_R_CLOSEPRINTER.\n"));
184 /********************************************************************
185 * api_spoolss_abortprinter
187 * called from the spoolss dispatcher
188 ********************************************************************/
190 static bool api_spoolss_abortprinter(pipes_struct
*p
)
192 SPOOL_Q_ABORTPRINTER q_u
;
193 SPOOL_R_ABORTPRINTER r_u
;
194 prs_struct
*data
= &p
->in_data
.data
;
195 prs_struct
*rdata
= &p
->out_data
.rdata
;
200 if (!spoolss_io_q_abortprinter("", &q_u
, data
, 0)) {
201 DEBUG(0,("spoolss_io_q_abortprinter: unable to unmarshall SPOOL_Q_ABORTPRINTER.\n"));
205 r_u
.status
= _spoolss_abortprinter(p
, &q_u
, &r_u
);
207 if (!spoolss_io_r_abortprinter("",&r_u
,rdata
,0)) {
208 DEBUG(0,("spoolss_io_r_abortprinter: unable to marshall SPOOL_R_ABORTPRINTER.\n"));
215 /********************************************************************
216 * api_spoolss_deleteprinter
218 * called from the spoolss dispatcher
219 ********************************************************************/
221 static bool api_spoolss_deleteprinter(pipes_struct
*p
)
223 SPOOL_Q_DELETEPRINTER q_u
;
224 SPOOL_R_DELETEPRINTER r_u
;
225 prs_struct
*data
= &p
->in_data
.data
;
226 prs_struct
*rdata
= &p
->out_data
.rdata
;
231 if (!spoolss_io_q_deleteprinter("", &q_u
, data
, 0)) {
232 DEBUG(0,("spoolss_io_q_deleteprinter: unable to unmarshall SPOOL_Q_DELETEPRINTER.\n"));
236 r_u
.status
= _spoolss_deleteprinter(p
, &q_u
, &r_u
);
238 if (!spoolss_io_r_deleteprinter("",&r_u
,rdata
,0)) {
239 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
247 /********************************************************************
248 * api_spoolss_deleteprinterdriver
250 * called from the spoolss dispatcher
251 ********************************************************************/
253 static bool api_spoolss_deleteprinterdriver(pipes_struct
*p
)
255 SPOOL_Q_DELETEPRINTERDRIVER q_u
;
256 SPOOL_R_DELETEPRINTERDRIVER r_u
;
257 prs_struct
*data
= &p
->in_data
.data
;
258 prs_struct
*rdata
= &p
->out_data
.rdata
;
263 if (!spoolss_io_q_deleteprinterdriver("", &q_u
, data
, 0)) {
264 DEBUG(0,("spoolss_io_q_deleteprinterdriver: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVER.\n"));
268 r_u
.status
= _spoolss_deleteprinterdriver(p
, &q_u
, &r_u
);
270 if (!spoolss_io_r_deleteprinterdriver("",&r_u
,rdata
,0)) {
271 DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
279 /********************************************************************
280 * api_spoolss_rffpcnex
281 * ReplyFindFirstPrinterChangeNotifyEx
282 ********************************************************************/
284 static bool api_spoolss_rffpcnex(pipes_struct
*p
)
286 SPOOL_Q_RFFPCNEX q_u
;
287 SPOOL_R_RFFPCNEX r_u
;
288 prs_struct
*data
= &p
->in_data
.data
;
289 prs_struct
*rdata
= &p
->out_data
.rdata
;
294 if (!spoolss_io_q_rffpcnex("", &q_u
, data
, 0)) {
295 DEBUG(0,("spoolss_io_q_rffpcnex: unable to unmarshall SPOOL_Q_RFFPCNEX.\n"));
299 r_u
.status
= _spoolss_rffpcnex(p
, &q_u
, &r_u
);
301 if (!spoolss_io_r_rffpcnex("", &r_u
, rdata
, 0)) {
302 DEBUG(0,("spoolss_io_r_rffpcnex: unable to marshall SPOOL_R_RFFPCNEX.\n"));
310 /********************************************************************
311 * api_spoolss_rfnpcnex
312 * ReplyFindNextPrinterChangeNotifyEx
313 * called from the spoolss dispatcher
315 * Note - this is the *ONLY* function that breaks the RPC call
316 * symmetry in all the other calls. We need to do this to fix
317 * the massive memory allocation problem with thousands of jobs...
319 ********************************************************************/
321 static bool api_spoolss_rfnpcnex(pipes_struct
*p
)
323 SPOOL_Q_RFNPCNEX q_u
;
324 SPOOL_R_RFNPCNEX r_u
;
325 prs_struct
*data
= &p
->in_data
.data
;
326 prs_struct
*rdata
= &p
->out_data
.rdata
;
331 if (!spoolss_io_q_rfnpcnex("", &q_u
, data
, 0)) {
332 DEBUG(0,("spoolss_io_q_rfnpcnex: unable to unmarshall SPOOL_Q_RFNPCNEX.\n"));
336 r_u
.status
= _spoolss_rfnpcnex(p
, &q_u
, &r_u
);
338 if (!spoolss_io_r_rfnpcnex("", &r_u
, rdata
, 0)) {
339 SAFE_FREE(r_u
.info
.data
);
340 DEBUG(0,("spoolss_io_r_rfnpcnex: unable to marshall SPOOL_R_RFNPCNEX.\n"));
344 SAFE_FREE(r_u
.info
.data
);
350 /********************************************************************
351 * api_spoolss_enumprinters
352 * called from the spoolss dispatcher
354 ********************************************************************/
356 static bool api_spoolss_enumprinters(pipes_struct
*p
)
358 SPOOL_Q_ENUMPRINTERS q_u
;
359 SPOOL_R_ENUMPRINTERS r_u
;
360 prs_struct
*data
= &p
->in_data
.data
;
361 prs_struct
*rdata
= &p
->out_data
.rdata
;
366 if (!spoolss_io_q_enumprinters("", &q_u
, data
, 0)) {
367 DEBUG(0,("spoolss_io_q_enumprinters: unable to unmarshall SPOOL_Q_ENUMPRINTERS.\n"));
371 r_u
.status
= _spoolss_enumprinters( p
, &q_u
, &r_u
);
373 if (!spoolss_io_r_enumprinters("", &r_u
, rdata
, 0)) {
374 DEBUG(0,("spoolss_io_r_enumprinters: unable to marshall SPOOL_R_ENUMPRINTERS.\n"));
381 /********************************************************************
382 * api_spoolss_getprinter
383 * called from the spoolss dispatcher
385 ********************************************************************/
387 static bool api_spoolss_getprinter(pipes_struct
*p
)
389 SPOOL_Q_GETPRINTER q_u
;
390 SPOOL_R_GETPRINTER r_u
;
391 prs_struct
*data
= &p
->in_data
.data
;
392 prs_struct
*rdata
= &p
->out_data
.rdata
;
397 if(!spoolss_io_q_getprinter("", &q_u
, data
, 0)) {
398 DEBUG(0,("spoolss_io_q_getprinter: unable to unmarshall SPOOL_Q_GETPRINTER.\n"));
402 r_u
.status
= _spoolss_getprinter(p
, &q_u
, &r_u
);
404 if(!spoolss_io_r_getprinter("",&r_u
,rdata
,0)) {
405 DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));
412 /********************************************************************
413 * api_spoolss_getprinter
414 * called from the spoolss dispatcher
416 ********************************************************************/
418 static bool api_spoolss_getprinterdriver2(pipes_struct
*p
)
420 SPOOL_Q_GETPRINTERDRIVER2 q_u
;
421 SPOOL_R_GETPRINTERDRIVER2 r_u
;
422 prs_struct
*data
= &p
->in_data
.data
;
423 prs_struct
*rdata
= &p
->out_data
.rdata
;
428 if(!spoolss_io_q_getprinterdriver2("", &q_u
, data
, 0)) {
429 DEBUG(0,("spoolss_io_q_getprinterdriver2: unable to unmarshall SPOOL_Q_GETPRINTERDRIVER2.\n"));
433 r_u
.status
= _spoolss_getprinterdriver2(p
, &q_u
, &r_u
);
435 if(!spoolss_io_r_getprinterdriver2("",&r_u
,rdata
,0)) {
436 DEBUG(0,("spoolss_io_r_getprinterdriver2: unable to marshall SPOOL_R_GETPRINTERDRIVER2.\n"));
443 /********************************************************************
444 * api_spoolss_getprinter
445 * called from the spoolss dispatcher
447 ********************************************************************/
449 static bool api_spoolss_startpageprinter(pipes_struct
*p
)
451 SPOOL_Q_STARTPAGEPRINTER q_u
;
452 SPOOL_R_STARTPAGEPRINTER r_u
;
453 prs_struct
*data
= &p
->in_data
.data
;
454 prs_struct
*rdata
= &p
->out_data
.rdata
;
459 if(!spoolss_io_q_startpageprinter("", &q_u
, data
, 0)) {
460 DEBUG(0,("spoolss_io_q_startpageprinter: unable to unmarshall SPOOL_Q_STARTPAGEPRINTER.\n"));
464 r_u
.status
= _spoolss_startpageprinter(p
, &q_u
, &r_u
);
466 if(!spoolss_io_r_startpageprinter("",&r_u
,rdata
,0)) {
467 DEBUG(0,("spoolss_io_r_startpageprinter: unable to marshall SPOOL_R_STARTPAGEPRINTER.\n"));
474 /********************************************************************
475 * api_spoolss_getprinter
476 * called from the spoolss dispatcher
478 ********************************************************************/
480 static bool api_spoolss_endpageprinter(pipes_struct
*p
)
482 SPOOL_Q_ENDPAGEPRINTER q_u
;
483 SPOOL_R_ENDPAGEPRINTER r_u
;
484 prs_struct
*data
= &p
->in_data
.data
;
485 prs_struct
*rdata
= &p
->out_data
.rdata
;
490 if(!spoolss_io_q_endpageprinter("", &q_u
, data
, 0)) {
491 DEBUG(0,("spoolss_io_q_endpageprinter: unable to unmarshall SPOOL_Q_ENDPAGEPRINTER.\n"));
495 r_u
.status
= _spoolss_endpageprinter(p
, &q_u
, &r_u
);
497 if(!spoolss_io_r_endpageprinter("",&r_u
,rdata
,0)) {
498 DEBUG(0,("spoolss_io_r_endpageprinter: unable to marshall SPOOL_R_ENDPAGEPRINTER.\n"));
505 /********************************************************************
506 ********************************************************************/
508 static bool api_spoolss_startdocprinter(pipes_struct
*p
)
510 SPOOL_Q_STARTDOCPRINTER q_u
;
511 SPOOL_R_STARTDOCPRINTER r_u
;
512 prs_struct
*data
= &p
->in_data
.data
;
513 prs_struct
*rdata
= &p
->out_data
.rdata
;
518 if(!spoolss_io_q_startdocprinter("", &q_u
, data
, 0)) {
519 DEBUG(0,("spoolss_io_q_startdocprinter: unable to unmarshall SPOOL_Q_STARTDOCPRINTER.\n"));
523 r_u
.status
= _spoolss_startdocprinter(p
, &q_u
, &r_u
);
525 if(!spoolss_io_r_startdocprinter("",&r_u
,rdata
,0)) {
526 DEBUG(0,("spoolss_io_r_startdocprinter: unable to marshall SPOOL_R_STARTDOCPRINTER.\n"));
533 /********************************************************************
534 ********************************************************************/
536 static bool api_spoolss_enddocprinter(pipes_struct
*p
)
538 SPOOL_Q_ENDDOCPRINTER q_u
;
539 SPOOL_R_ENDDOCPRINTER r_u
;
540 prs_struct
*data
= &p
->in_data
.data
;
541 prs_struct
*rdata
= &p
->out_data
.rdata
;
546 if(!spoolss_io_q_enddocprinter("", &q_u
, data
, 0)) {
547 DEBUG(0,("spoolss_io_q_enddocprinter: unable to unmarshall SPOOL_Q_ENDDOCPRINTER.\n"));
551 r_u
.status
= _spoolss_enddocprinter(p
, &q_u
, &r_u
);
553 if(!spoolss_io_r_enddocprinter("",&r_u
,rdata
,0)) {
554 DEBUG(0,("spoolss_io_r_enddocprinter: unable to marshall SPOOL_R_ENDDOCPRINTER.\n"));
561 /********************************************************************
562 ********************************************************************/
564 static bool api_spoolss_writeprinter(pipes_struct
*p
)
566 SPOOL_Q_WRITEPRINTER q_u
;
567 SPOOL_R_WRITEPRINTER r_u
;
568 prs_struct
*data
= &p
->in_data
.data
;
569 prs_struct
*rdata
= &p
->out_data
.rdata
;
574 if(!spoolss_io_q_writeprinter("", &q_u
, data
, 0)) {
575 DEBUG(0,("spoolss_io_q_writeprinter: unable to unmarshall SPOOL_Q_WRITEPRINTER.\n"));
579 r_u
.status
= _spoolss_writeprinter(p
, &q_u
, &r_u
);
581 if(!spoolss_io_r_writeprinter("",&r_u
,rdata
,0)) {
582 DEBUG(0,("spoolss_io_r_writeprinter: unable to marshall SPOOL_R_WRITEPRINTER.\n"));
589 /****************************************************************************
591 ****************************************************************************/
593 static bool api_spoolss_setprinter(pipes_struct
*p
)
595 SPOOL_Q_SETPRINTER q_u
;
596 SPOOL_R_SETPRINTER r_u
;
597 prs_struct
*data
= &p
->in_data
.data
;
598 prs_struct
*rdata
= &p
->out_data
.rdata
;
603 if(!spoolss_io_q_setprinter("", &q_u
, data
, 0)) {
604 DEBUG(0,("spoolss_io_q_setprinter: unable to unmarshall SPOOL_Q_SETPRINTER.\n"));
608 r_u
.status
= _spoolss_setprinter(p
, &q_u
, &r_u
);
610 if(!spoolss_io_r_setprinter("",&r_u
,rdata
,0)) {
611 DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n"));
618 /****************************************************************************
619 ****************************************************************************/
621 static bool api_spoolss_fcpn(pipes_struct
*p
)
625 prs_struct
*data
= &p
->in_data
.data
;
626 prs_struct
*rdata
= &p
->out_data
.rdata
;
631 if(!spoolss_io_q_fcpn("", &q_u
, data
, 0)) {
632 DEBUG(0,("spoolss_io_q_fcpn: unable to unmarshall SPOOL_Q_FCPN.\n"));
636 r_u
.status
= _spoolss_fcpn(p
, &q_u
, &r_u
);
638 if(!spoolss_io_r_fcpn("",&r_u
,rdata
,0)) {
639 DEBUG(0,("spoolss_io_r_fcpn: unable to marshall SPOOL_R_FCPN.\n"));
646 /****************************************************************************
647 ****************************************************************************/
649 static bool api_spoolss_addjob(pipes_struct
*p
)
653 prs_struct
*data
= &p
->in_data
.data
;
654 prs_struct
*rdata
= &p
->out_data
.rdata
;
659 if(!spoolss_io_q_addjob("", &q_u
, data
, 0)) {
660 DEBUG(0,("spoolss_io_q_addjob: unable to unmarshall SPOOL_Q_ADDJOB.\n"));
664 r_u
.status
= _spoolss_addjob(p
, &q_u
, &r_u
);
666 if(!spoolss_io_r_addjob("",&r_u
,rdata
,0)) {
667 DEBUG(0,("spoolss_io_r_addjob: unable to marshall SPOOL_R_ADDJOB.\n"));
674 /****************************************************************************
675 ****************************************************************************/
677 static bool api_spoolss_enumjobs(pipes_struct
*p
)
679 SPOOL_Q_ENUMJOBS q_u
;
680 SPOOL_R_ENUMJOBS r_u
;
681 prs_struct
*data
= &p
->in_data
.data
;
682 prs_struct
*rdata
= &p
->out_data
.rdata
;
687 if (!spoolss_io_q_enumjobs("", &q_u
, data
, 0)) {
688 DEBUG(0,("spoolss_io_q_enumjobs: unable to unmarshall SPOOL_Q_ENUMJOBS.\n"));
692 r_u
.status
= _spoolss_enumjobs(p
, &q_u
, &r_u
);
694 if (!spoolss_io_r_enumjobs("",&r_u
,rdata
,0)) {
695 DEBUG(0,("spoolss_io_r_enumjobs: unable to marshall SPOOL_R_ENUMJOBS.\n"));
702 /****************************************************************************
703 ****************************************************************************/
705 static bool api_spoolss_schedulejob(pipes_struct
*p
)
707 SPOOL_Q_SCHEDULEJOB q_u
;
708 SPOOL_R_SCHEDULEJOB r_u
;
709 prs_struct
*data
= &p
->in_data
.data
;
710 prs_struct
*rdata
= &p
->out_data
.rdata
;
715 if(!spoolss_io_q_schedulejob("", &q_u
, data
, 0)) {
716 DEBUG(0,("spoolss_io_q_schedulejob: unable to unmarshall SPOOL_Q_SCHEDULEJOB.\n"));
720 r_u
.status
= _spoolss_schedulejob(p
, &q_u
, &r_u
);
722 if(!spoolss_io_r_schedulejob("",&r_u
,rdata
,0)) {
723 DEBUG(0,("spoolss_io_r_schedulejob: unable to marshall SPOOL_R_SCHEDULEJOB.\n"));
730 /****************************************************************************
731 ****************************************************************************/
733 static bool api_spoolss_setjob(pipes_struct
*p
)
737 prs_struct
*data
= &p
->in_data
.data
;
738 prs_struct
*rdata
= &p
->out_data
.rdata
;
743 if(!spoolss_io_q_setjob("", &q_u
, data
, 0)) {
744 DEBUG(0,("spoolss_io_q_setjob: unable to unmarshall SPOOL_Q_SETJOB.\n"));
748 r_u
.status
= _spoolss_setjob(p
, &q_u
, &r_u
);
750 if(!spoolss_io_r_setjob("",&r_u
,rdata
,0)) {
751 DEBUG(0,("spoolss_io_r_setjob: unable to marshall SPOOL_R_SETJOB.\n"));
758 /****************************************************************************
759 ****************************************************************************/
761 static bool api_spoolss_enumprinterdrivers(pipes_struct
*p
)
763 SPOOL_Q_ENUMPRINTERDRIVERS q_u
;
764 SPOOL_R_ENUMPRINTERDRIVERS r_u
;
765 prs_struct
*data
= &p
->in_data
.data
;
766 prs_struct
*rdata
= &p
->out_data
.rdata
;
771 if (!spoolss_io_q_enumprinterdrivers("", &q_u
, data
, 0)) {
772 DEBUG(0,("spoolss_io_q_enumprinterdrivers: unable to unmarshall SPOOL_Q_ENUMPRINTERDRIVERS.\n"));
776 r_u
.status
= _spoolss_enumprinterdrivers(p
, &q_u
, &r_u
);
778 if (!spoolss_io_r_enumprinterdrivers("",&r_u
,rdata
,0)) {
779 DEBUG(0,("spoolss_io_r_enumprinterdrivers: unable to marshall SPOOL_R_ENUMPRINTERDRIVERS.\n"));
786 /****************************************************************************
787 ****************************************************************************/
789 static bool api_spoolss_getform(pipes_struct
*p
)
793 prs_struct
*data
= &p
->in_data
.data
;
794 prs_struct
*rdata
= &p
->out_data
.rdata
;
799 if (!spoolss_io_q_getform("", &q_u
, data
, 0)) {
800 DEBUG(0,("spoolss_io_q_getform: unable to unmarshall SPOOL_Q_GETFORM.\n"));
804 r_u
.status
= _spoolss_getform(p
, &q_u
, &r_u
);
806 if (!spoolss_io_r_getform("",&r_u
,rdata
,0)) {
807 DEBUG(0,("spoolss_io_r_getform: unable to marshall SPOOL_R_GETFORM.\n"));
814 /****************************************************************************
815 ****************************************************************************/
817 static bool api_spoolss_enumforms(pipes_struct
*p
)
819 SPOOL_Q_ENUMFORMS q_u
;
820 SPOOL_R_ENUMFORMS r_u
;
821 prs_struct
*data
= &p
->in_data
.data
;
822 prs_struct
*rdata
= &p
->out_data
.rdata
;
827 if (!spoolss_io_q_enumforms("", &q_u
, data
, 0)) {
828 DEBUG(0,("spoolss_io_q_enumforms: unable to unmarshall SPOOL_Q_ENUMFORMS.\n"));
832 r_u
.status
= _spoolss_enumforms(p
, &q_u
, &r_u
);
834 if (!spoolss_io_r_enumforms("",&r_u
,rdata
,0)) {
835 DEBUG(0,("spoolss_io_r_enumforms: unable to marshall SPOOL_R_ENUMFORMS.\n"));
842 /****************************************************************************
843 ****************************************************************************/
845 static bool api_spoolss_enumports(pipes_struct
*p
)
847 SPOOL_Q_ENUMPORTS q_u
;
848 SPOOL_R_ENUMPORTS r_u
;
849 prs_struct
*data
= &p
->in_data
.data
;
850 prs_struct
*rdata
= &p
->out_data
.rdata
;
855 if(!spoolss_io_q_enumports("", &q_u
, data
, 0)) {
856 DEBUG(0,("spoolss_io_q_enumports: unable to unmarshall SPOOL_Q_ENUMPORTS.\n"));
860 r_u
.status
= _spoolss_enumports(p
, &q_u
, &r_u
);
862 if (!spoolss_io_r_enumports("",&r_u
,rdata
,0)) {
863 DEBUG(0,("spoolss_io_r_enumports: unable to marshall SPOOL_R_ENUMPORTS.\n"));
870 /****************************************************************************
871 ****************************************************************************/
873 static bool api_spoolss_addprinterex(pipes_struct
*p
)
875 SPOOL_Q_ADDPRINTEREX q_u
;
876 SPOOL_R_ADDPRINTEREX r_u
;
877 prs_struct
*data
= &p
->in_data
.data
;
878 prs_struct
*rdata
= &p
->out_data
.rdata
;
883 if(!spoolss_io_q_addprinterex("", &q_u
, data
, 0)) {
884 DEBUG(0,("spoolss_io_q_addprinterex: unable to unmarshall SPOOL_Q_ADDPRINTEREX.\n"));
888 r_u
.status
= _spoolss_addprinterex(p
, &q_u
, &r_u
);
890 if(!spoolss_io_r_addprinterex("", &r_u
, rdata
, 0)) {
891 DEBUG(0,("spoolss_io_r_addprinterex: unable to marshall SPOOL_R_ADDPRINTEREX.\n"));
898 /****************************************************************************
899 ****************************************************************************/
901 static bool api_spoolss_addprinterdriver(pipes_struct
*p
)
903 SPOOL_Q_ADDPRINTERDRIVER q_u
;
904 SPOOL_R_ADDPRINTERDRIVER r_u
;
905 prs_struct
*data
= &p
->in_data
.data
;
906 prs_struct
*rdata
= &p
->out_data
.rdata
;
911 if(!spoolss_io_q_addprinterdriver("", &q_u
, data
, 0)) {
912 if (q_u
.level
!= 3 && q_u
.level
!= 6) {
913 /* Clever hack from Martin Zielinski <mz@seh.de>
914 * to allow downgrade from level 8 (Vista).
916 DEBUG(3,("api_spoolss_addprinterdriver: unknown SPOOL_Q_ADDPRINTERDRIVER level %u.\n",
917 (unsigned int)q_u
.level
));
918 setup_fault_pdu(p
, NT_STATUS(DCERPC_FAULT_INVALID_TAG
));
921 DEBUG(0,("spoolss_io_q_addprinterdriver: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVER.\n"));
925 r_u
.status
= _spoolss_addprinterdriver(p
, &q_u
, &r_u
);
927 if(!spoolss_io_r_addprinterdriver("", &r_u
, rdata
, 0)) {
928 DEBUG(0,("spoolss_io_r_addprinterdriver: unable to marshall SPOOL_R_ADDPRINTERDRIVER.\n"));
935 /****************************************************************************
936 ****************************************************************************/
938 static bool api_spoolss_getprinterdriverdirectory(pipes_struct
*p
)
940 SPOOL_Q_GETPRINTERDRIVERDIR q_u
;
941 SPOOL_R_GETPRINTERDRIVERDIR r_u
;
942 prs_struct
*data
= &p
->in_data
.data
;
943 prs_struct
*rdata
= &p
->out_data
.rdata
;
948 if(!spoolss_io_q_getprinterdriverdir("", &q_u
, data
, 0)) {
949 DEBUG(0,("spoolss_io_q_getprinterdriverdir: unable to unmarshall SPOOL_Q_GETPRINTERDRIVERDIR.\n"));
953 r_u
.status
= _spoolss_getprinterdriverdirectory(p
, &q_u
, &r_u
);
955 if(!spoolss_io_r_getprinterdriverdir("", &r_u
, rdata
, 0)) {
956 DEBUG(0,("spoolss_io_r_getprinterdriverdir: unable to marshall SPOOL_R_GETPRINTERDRIVERDIR.\n"));
963 /****************************************************************************
964 ****************************************************************************/
966 static bool api_spoolss_enumprinterdata(pipes_struct
*p
)
968 SPOOL_Q_ENUMPRINTERDATA q_u
;
969 SPOOL_R_ENUMPRINTERDATA r_u
;
970 prs_struct
*data
= &p
->in_data
.data
;
971 prs_struct
*rdata
= &p
->out_data
.rdata
;
976 if(!spoolss_io_q_enumprinterdata("", &q_u
, data
, 0)) {
977 DEBUG(0,("spoolss_io_q_enumprinterdata: unable to unmarshall SPOOL_Q_ENUMPRINTERDATA.\n"));
981 r_u
.status
= _spoolss_enumprinterdata(p
, &q_u
, &r_u
);
983 if(!spoolss_io_r_enumprinterdata("", &r_u
, rdata
, 0)) {
984 DEBUG(0,("spoolss_io_r_enumprinterdata: unable to marshall SPOOL_R_ENUMPRINTERDATA.\n"));
991 /****************************************************************************
992 ****************************************************************************/
994 static bool api_spoolss_setprinterdata(pipes_struct
*p
)
996 SPOOL_Q_SETPRINTERDATA q_u
;
997 SPOOL_R_SETPRINTERDATA r_u
;
998 prs_struct
*data
= &p
->in_data
.data
;
999 prs_struct
*rdata
= &p
->out_data
.rdata
;
1004 if(!spoolss_io_q_setprinterdata("", &q_u
, data
, 0)) {
1005 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
1009 r_u
.status
= _spoolss_setprinterdata(p
, &q_u
, &r_u
);
1011 if(!spoolss_io_r_setprinterdata("", &r_u
, rdata
, 0)) {
1012 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_SETPRINTERDATA.\n"));
1019 /****************************************************************************
1020 ****************************************************************************/
1021 static bool api_spoolss_reset_printer(pipes_struct
*p
)
1023 SPOOL_Q_RESETPRINTER q_u
;
1024 SPOOL_R_RESETPRINTER r_u
;
1025 prs_struct
*data
= &p
->in_data
.data
;
1026 prs_struct
*rdata
= &p
->out_data
.rdata
;
1031 if(!spoolss_io_q_resetprinter("", &q_u
, data
, 0)) {
1032 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
1036 r_u
.status
= _spoolss_resetprinter(p
, &q_u
, &r_u
);
1038 if(!spoolss_io_r_resetprinter("", &r_u
, rdata
, 0)) {
1039 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_RESETPRINTER.\n"));
1046 /****************************************************************************
1047 ****************************************************************************/
1048 static bool api_spoolss_addform(pipes_struct
*p
)
1050 SPOOL_Q_ADDFORM q_u
;
1051 SPOOL_R_ADDFORM r_u
;
1052 prs_struct
*data
= &p
->in_data
.data
;
1053 prs_struct
*rdata
= &p
->out_data
.rdata
;
1058 if(!spoolss_io_q_addform("", &q_u
, data
, 0)) {
1059 DEBUG(0,("spoolss_io_q_addform: unable to unmarshall SPOOL_Q_ADDFORM.\n"));
1063 r_u
.status
= _spoolss_addform(p
, &q_u
, &r_u
);
1065 if(!spoolss_io_r_addform("", &r_u
, rdata
, 0)) {
1066 DEBUG(0,("spoolss_io_r_addform: unable to marshall SPOOL_R_ADDFORM.\n"));
1073 /****************************************************************************
1074 ****************************************************************************/
1076 static bool api_spoolss_deleteform(pipes_struct
*p
)
1078 SPOOL_Q_DELETEFORM q_u
;
1079 SPOOL_R_DELETEFORM r_u
;
1080 prs_struct
*data
= &p
->in_data
.data
;
1081 prs_struct
*rdata
= &p
->out_data
.rdata
;
1086 if(!spoolss_io_q_deleteform("", &q_u
, data
, 0)) {
1087 DEBUG(0,("spoolss_io_q_deleteform: unable to unmarshall SPOOL_Q_DELETEFORM.\n"));
1091 r_u
.status
= _spoolss_deleteform(p
, &q_u
, &r_u
);
1093 if(!spoolss_io_r_deleteform("", &r_u
, rdata
, 0)) {
1094 DEBUG(0,("spoolss_io_r_deleteform: unable to marshall SPOOL_R_DELETEFORM.\n"));
1101 /****************************************************************************
1102 ****************************************************************************/
1104 static bool api_spoolss_setform(pipes_struct
*p
)
1106 SPOOL_Q_SETFORM q_u
;
1107 SPOOL_R_SETFORM r_u
;
1108 prs_struct
*data
= &p
->in_data
.data
;
1109 prs_struct
*rdata
= &p
->out_data
.rdata
;
1114 if(!spoolss_io_q_setform("", &q_u
, data
, 0)) {
1115 DEBUG(0,("spoolss_io_q_setform: unable to unmarshall SPOOL_Q_SETFORM.\n"));
1119 r_u
.status
= _spoolss_setform(p
, &q_u
, &r_u
);
1121 if(!spoolss_io_r_setform("", &r_u
, rdata
, 0)) {
1122 DEBUG(0,("spoolss_io_r_setform: unable to marshall SPOOL_R_SETFORM.\n"));
1129 /****************************************************************************
1130 ****************************************************************************/
1132 static bool api_spoolss_enumprintprocessors(pipes_struct
*p
)
1134 SPOOL_Q_ENUMPRINTPROCESSORS q_u
;
1135 SPOOL_R_ENUMPRINTPROCESSORS r_u
;
1136 prs_struct
*data
= &p
->in_data
.data
;
1137 prs_struct
*rdata
= &p
->out_data
.rdata
;
1142 if(!spoolss_io_q_enumprintprocessors("", &q_u
, data
, 0)) {
1143 DEBUG(0,("spoolss_io_q_enumprintprocessors: unable to unmarshall SPOOL_Q_ENUMPRINTPROCESSORS.\n"));
1147 r_u
.status
= _spoolss_enumprintprocessors(p
, &q_u
, &r_u
);
1149 if(!spoolss_io_r_enumprintprocessors("", &r_u
, rdata
, 0)) {
1150 DEBUG(0,("spoolss_io_r_enumprintprocessors: unable to marshall SPOOL_R_ENUMPRINTPROCESSORS.\n"));
1157 /****************************************************************************
1158 ****************************************************************************/
1160 static bool api_spoolss_addprintprocessor(pipes_struct
*p
)
1162 SPOOL_Q_ADDPRINTPROCESSOR q_u
;
1163 SPOOL_R_ADDPRINTPROCESSOR r_u
;
1164 prs_struct
*data
= &p
->in_data
.data
;
1165 prs_struct
*rdata
= &p
->out_data
.rdata
;
1170 if(!spoolss_io_q_addprintprocessor("", &q_u
, data
, 0)) {
1171 DEBUG(0,("spoolss_io_q_addprintprocessor: unable to unmarshall SPOOL_Q_ADDPRINTPROCESSOR.\n"));
1175 /* for now, just indicate success and ignore the add. We'll
1176 automatically set the winprint processor for printer
1177 entries later. Used to debug the LexMark Optra S 1855 PCL
1179 r_u
.status
= WERR_OK
;
1181 if(!spoolss_io_r_addprintprocessor("", &r_u
, rdata
, 0)) {
1182 DEBUG(0,("spoolss_io_r_addprintprocessor: unable to marshall SPOOL_R_ADDPRINTPROCESSOR.\n"));
1189 /****************************************************************************
1190 ****************************************************************************/
1192 static bool api_spoolss_enumprintprocdatatypes(pipes_struct
*p
)
1194 SPOOL_Q_ENUMPRINTPROCDATATYPES q_u
;
1195 SPOOL_R_ENUMPRINTPROCDATATYPES r_u
;
1196 prs_struct
*data
= &p
->in_data
.data
;
1197 prs_struct
*rdata
= &p
->out_data
.rdata
;
1202 if(!spoolss_io_q_enumprintprocdatatypes("", &q_u
, data
, 0)) {
1203 DEBUG(0,("spoolss_io_q_enumprintprocdatatypes: unable to unmarshall SPOOL_Q_ENUMPRINTPROCDATATYPES.\n"));
1207 r_u
.status
= _spoolss_enumprintprocdatatypes(p
, &q_u
, &r_u
);
1209 if(!spoolss_io_r_enumprintprocdatatypes("", &r_u
, rdata
, 0)) {
1210 DEBUG(0,("spoolss_io_r_enumprintprocdatatypes: unable to marshall SPOOL_R_ENUMPRINTPROCDATATYPES.\n"));
1217 /****************************************************************************
1218 ****************************************************************************/
1220 static bool api_spoolss_enumprintmonitors(pipes_struct
*p
)
1222 SPOOL_Q_ENUMPRINTMONITORS q_u
;
1223 SPOOL_R_ENUMPRINTMONITORS r_u
;
1224 prs_struct
*data
= &p
->in_data
.data
;
1225 prs_struct
*rdata
= &p
->out_data
.rdata
;
1230 if (!spoolss_io_q_enumprintmonitors("", &q_u
, data
, 0)) {
1231 DEBUG(0,("spoolss_io_q_enumprintmonitors: unable to unmarshall SPOOL_Q_ENUMPRINTMONITORS.\n"));
1235 r_u
.status
= _spoolss_enumprintmonitors(p
, &q_u
, &r_u
);
1237 if (!spoolss_io_r_enumprintmonitors("", &r_u
, rdata
, 0)) {
1238 DEBUG(0,("spoolss_io_r_enumprintmonitors: unable to marshall SPOOL_R_ENUMPRINTMONITORS.\n"));
1245 /****************************************************************************
1246 ****************************************************************************/
1248 static bool api_spoolss_getjob(pipes_struct
*p
)
1252 prs_struct
*data
= &p
->in_data
.data
;
1253 prs_struct
*rdata
= &p
->out_data
.rdata
;
1258 if(!spoolss_io_q_getjob("", &q_u
, data
, 0)) {
1259 DEBUG(0,("spoolss_io_q_getjob: unable to unmarshall SPOOL_Q_GETJOB.\n"));
1263 r_u
.status
= _spoolss_getjob(p
, &q_u
, &r_u
);
1265 if(!spoolss_io_r_getjob("",&r_u
,rdata
,0)) {
1266 DEBUG(0,("spoolss_io_r_getjob: unable to marshall SPOOL_R_GETJOB.\n"));
1273 /********************************************************************
1274 * api_spoolss_getprinterdataex
1276 * called from the spoolss dispatcher
1277 ********************************************************************/
1279 static bool api_spoolss_getprinterdataex(pipes_struct
*p
)
1281 SPOOL_Q_GETPRINTERDATAEX q_u
;
1282 SPOOL_R_GETPRINTERDATAEX r_u
;
1283 prs_struct
*data
= &p
->in_data
.data
;
1284 prs_struct
*rdata
= &p
->out_data
.rdata
;
1289 /* read the stream and fill the struct */
1290 if (!spoolss_io_q_getprinterdataex("", &q_u
, data
, 0)) {
1291 DEBUG(0,("spoolss_io_q_getprinterdataex: unable to unmarshall SPOOL_Q_GETPRINTERDATAEX.\n"));
1295 r_u
.status
= _spoolss_getprinterdataex( p
, &q_u
, &r_u
);
1297 if (!spoolss_io_r_getprinterdataex("", &r_u
, rdata
, 0)) {
1298 DEBUG(0,("spoolss_io_r_getprinterdataex: unable to marshall SPOOL_R_GETPRINTERDATAEX.\n"));
1305 /****************************************************************************
1306 ****************************************************************************/
1308 static bool api_spoolss_setprinterdataex(pipes_struct
*p
)
1310 SPOOL_Q_SETPRINTERDATAEX q_u
;
1311 SPOOL_R_SETPRINTERDATAEX r_u
;
1312 prs_struct
*data
= &p
->in_data
.data
;
1313 prs_struct
*rdata
= &p
->out_data
.rdata
;
1318 if(!spoolss_io_q_setprinterdataex("", &q_u
, data
, 0)) {
1319 DEBUG(0,("spoolss_io_q_setprinterdataex: unable to unmarshall SPOOL_Q_SETPRINTERDATAEX.\n"));
1323 r_u
.status
= _spoolss_setprinterdataex(p
, &q_u
, &r_u
);
1325 if(!spoolss_io_r_setprinterdataex("", &r_u
, rdata
, 0)) {
1326 DEBUG(0,("spoolss_io_r_setprinterdataex: unable to marshall SPOOL_R_SETPRINTERDATAEX.\n"));
1334 /****************************************************************************
1335 ****************************************************************************/
1337 static bool api_spoolss_enumprinterkey(pipes_struct
*p
)
1339 SPOOL_Q_ENUMPRINTERKEY q_u
;
1340 SPOOL_R_ENUMPRINTERKEY r_u
;
1341 prs_struct
*data
= &p
->in_data
.data
;
1342 prs_struct
*rdata
= &p
->out_data
.rdata
;
1347 if(!spoolss_io_q_enumprinterkey("", &q_u
, data
, 0)) {
1348 DEBUG(0,("spoolss_io_q_setprinterkey: unable to unmarshall SPOOL_Q_ENUMPRINTERKEY.\n"));
1352 r_u
.status
= _spoolss_enumprinterkey(p
, &q_u
, &r_u
);
1354 if(!spoolss_io_r_enumprinterkey("", &r_u
, rdata
, 0)) {
1355 DEBUG(0,("spoolss_io_r_enumprinterkey: unable to marshall SPOOL_R_ENUMPRINTERKEY.\n"));
1362 /****************************************************************************
1363 ****************************************************************************/
1365 static bool api_spoolss_enumprinterdataex(pipes_struct
*p
)
1367 SPOOL_Q_ENUMPRINTERDATAEX q_u
;
1368 SPOOL_R_ENUMPRINTERDATAEX r_u
;
1369 prs_struct
*data
= &p
->in_data
.data
;
1370 prs_struct
*rdata
= &p
->out_data
.rdata
;
1375 if(!spoolss_io_q_enumprinterdataex("", &q_u
, data
, 0)) {
1376 DEBUG(0,("spoolss_io_q_enumprinterdataex: unable to unmarshall SPOOL_Q_ENUMPRINTERDATAEX.\n"));
1380 r_u
.status
= _spoolss_enumprinterdataex(p
, &q_u
, &r_u
);
1382 if(!spoolss_io_r_enumprinterdataex("", &r_u
, rdata
, 0)) {
1383 DEBUG(0,("spoolss_io_r_enumprinterdataex: unable to marshall SPOOL_R_ENUMPRINTERDATAEX.\n"));
1390 /****************************************************************************
1391 ****************************************************************************/
1393 static bool api_spoolss_getprintprocessordirectory(pipes_struct
*p
)
1395 SPOOL_Q_GETPRINTPROCESSORDIRECTORY q_u
;
1396 SPOOL_R_GETPRINTPROCESSORDIRECTORY r_u
;
1397 prs_struct
*data
= &p
->in_data
.data
;
1398 prs_struct
*rdata
= &p
->out_data
.rdata
;
1403 if(!spoolss_io_q_getprintprocessordirectory("", &q_u
, data
, 0)) {
1404 DEBUG(0,("spoolss_io_q_getprintprocessordirectory: unable to unmarshall SPOOL_Q_GETPRINTPROCESSORDIRECTORY.\n"));
1408 r_u
.status
= _spoolss_getprintprocessordirectory(p
, &q_u
, &r_u
);
1410 if(!spoolss_io_r_getprintprocessordirectory("", &r_u
, rdata
, 0)) {
1411 DEBUG(0,("spoolss_io_r_getprintprocessordirectory: unable to marshall SPOOL_R_GETPRINTPROCESSORDIRECTORY.\n"));
1418 /****************************************************************************
1419 ****************************************************************************/
1421 static bool api_spoolss_deleteprinterdataex(pipes_struct
*p
)
1423 SPOOL_Q_DELETEPRINTERDATAEX q_u
;
1424 SPOOL_R_DELETEPRINTERDATAEX r_u
;
1425 prs_struct
*data
= &p
->in_data
.data
;
1426 prs_struct
*rdata
= &p
->out_data
.rdata
;
1431 if(!spoolss_io_q_deleteprinterdataex("", &q_u
, data
, 0)) {
1432 DEBUG(0,("spoolss_io_q_deleteprinterdataex: unable to unmarshall SPOOL_Q_DELETEPRINTERDATAEX.\n"));
1436 r_u
.status
= _spoolss_deleteprinterdataex(p
, &q_u
, &r_u
);
1438 if(!spoolss_io_r_deleteprinterdataex("", &r_u
, rdata
, 0)) {
1439 DEBUG(0,("spoolss_io_r_deleteprinterdataex: unable to marshall SPOOL_R_DELETEPRINTERDATAEX.\n"));
1446 /****************************************************************************
1447 ****************************************************************************/
1449 static bool api_spoolss_deleteprinterkey(pipes_struct
*p
)
1451 SPOOL_Q_DELETEPRINTERKEY q_u
;
1452 SPOOL_R_DELETEPRINTERKEY r_u
;
1453 prs_struct
*data
= &p
->in_data
.data
;
1454 prs_struct
*rdata
= &p
->out_data
.rdata
;
1459 if(!spoolss_io_q_deleteprinterkey("", &q_u
, data
, 0)) {
1460 DEBUG(0,("spoolss_io_q_deleteprinterkey: unable to unmarshall SPOOL_Q_DELETEPRINTERKEY.\n"));
1464 r_u
.status
= _spoolss_deleteprinterkey(p
, &q_u
, &r_u
);
1466 if(!spoolss_io_r_deleteprinterkey("", &r_u
, rdata
, 0)) {
1467 DEBUG(0,("spoolss_io_r_deleteprinterkey: unable to marshall SPOOL_R_DELETEPRINTERKEY.\n"));
1474 /****************************************************************************
1475 ****************************************************************************/
1477 static bool api_spoolss_addprinterdriverex(pipes_struct
*p
)
1479 SPOOL_Q_ADDPRINTERDRIVEREX q_u
;
1480 SPOOL_R_ADDPRINTERDRIVEREX r_u
;
1481 prs_struct
*data
= &p
->in_data
.data
;
1482 prs_struct
*rdata
= &p
->out_data
.rdata
;
1487 if(!spoolss_io_q_addprinterdriverex("", &q_u
, data
, 0)) {
1488 if (q_u
.level
!= 3 && q_u
.level
!= 6) {
1489 /* Clever hack from Martin Zielinski <mz@seh.de>
1490 * to allow downgrade from level 8 (Vista).
1492 DEBUG(3,("api_spoolss_addprinterdriverex: unknown SPOOL_Q_ADDPRINTERDRIVEREX level %u.\n",
1493 (unsigned int)q_u
.level
));
1494 setup_fault_pdu(p
, NT_STATUS(DCERPC_FAULT_INVALID_TAG
));
1497 DEBUG(0,("spoolss_io_q_addprinterdriverex: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVEREX.\n"));
1501 r_u
.status
= _spoolss_addprinterdriverex(p
, &q_u
, &r_u
);
1503 if(!spoolss_io_r_addprinterdriverex("", &r_u
, rdata
, 0)) {
1504 DEBUG(0,("spoolss_io_r_addprinterdriverex: unable to marshall SPOOL_R_ADDPRINTERDRIVEREX.\n"));
1511 /****************************************************************************
1512 ****************************************************************************/
1514 static bool api_spoolss_deleteprinterdriverex(pipes_struct
*p
)
1516 SPOOL_Q_DELETEPRINTERDRIVEREX q_u
;
1517 SPOOL_R_DELETEPRINTERDRIVEREX r_u
;
1518 prs_struct
*data
= &p
->in_data
.data
;
1519 prs_struct
*rdata
= &p
->out_data
.rdata
;
1524 if(!spoolss_io_q_deleteprinterdriverex("", &q_u
, data
, 0)) {
1525 DEBUG(0,("spoolss_io_q_deleteprinterdriverex: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVEREX.\n"));
1529 r_u
.status
= _spoolss_deleteprinterdriverex(p
, &q_u
, &r_u
);
1531 if(!spoolss_io_r_deleteprinterdriverex("", &r_u
, rdata
, 0)) {
1532 DEBUG(0,("spoolss_io_r_deleteprinterdriverex: unable to marshall SPOOL_R_DELETEPRINTERDRIVEREX.\n"));
1539 /****************************************************************************
1540 ****************************************************************************/
1542 static bool api_spoolss_xcvdataport(pipes_struct
*p
)
1544 SPOOL_Q_XCVDATAPORT q_u
;
1545 SPOOL_R_XCVDATAPORT r_u
;
1546 prs_struct
*data
= &p
->in_data
.data
;
1547 prs_struct
*rdata
= &p
->out_data
.rdata
;
1552 if(!spoolss_io_q_xcvdataport("", &q_u
, data
, 0)) {
1553 DEBUG(0,("spoolss_io_q_replyopenprinter: unable to unmarshall SPOOL_Q_XCVDATAPORT.\n"));
1557 r_u
.status
= _spoolss_xcvdataport(p
, &q_u
, &r_u
);
1559 if(!spoolss_io_r_xcvdataport("", &r_u
, rdata
, 0)) {
1560 DEBUG(0,("spoolss_io_r_replyopenprinter: unable to marshall SPOOL_R_XCVDATAPORT.\n"));
1567 /*******************************************************************
1568 \pipe\spoolss commands
1569 ********************************************************************/
1571 struct api_struct api_spoolss_cmds
[] =
1573 {"SPOOLSS_OPENPRINTER", SPOOLSS_OPENPRINTER
, api_spoolss_open_printer
},
1574 {"SPOOLSS_OPENPRINTEREX", SPOOLSS_OPENPRINTEREX
, api_spoolss_open_printer_ex
},
1575 {"SPOOLSS_GETPRINTERDATA", SPOOLSS_GETPRINTERDATA
, api_spoolss_getprinterdata
},
1576 {"SPOOLSS_CLOSEPRINTER", SPOOLSS_CLOSEPRINTER
, api_spoolss_closeprinter
},
1577 {"SPOOLSS_DELETEPRINTER", SPOOLSS_DELETEPRINTER
, api_spoolss_deleteprinter
},
1578 {"SPOOLSS_ABORTPRINTER", SPOOLSS_ABORTPRINTER
, api_spoolss_abortprinter
},
1579 {"SPOOLSS_RFFPCNEX", SPOOLSS_RFFPCNEX
, api_spoolss_rffpcnex
},
1580 {"SPOOLSS_RFNPCNEX", SPOOLSS_RFNPCNEX
, api_spoolss_rfnpcnex
},
1581 {"SPOOLSS_ENUMPRINTERS", SPOOLSS_ENUMPRINTERS
, api_spoolss_enumprinters
},
1582 {"SPOOLSS_GETPRINTER", SPOOLSS_GETPRINTER
, api_spoolss_getprinter
},
1583 {"SPOOLSS_GETPRINTERDRIVER2", SPOOLSS_GETPRINTERDRIVER2
, api_spoolss_getprinterdriver2
},
1584 {"SPOOLSS_STARTPAGEPRINTER", SPOOLSS_STARTPAGEPRINTER
, api_spoolss_startpageprinter
},
1585 {"SPOOLSS_ENDPAGEPRINTER", SPOOLSS_ENDPAGEPRINTER
, api_spoolss_endpageprinter
},
1586 {"SPOOLSS_STARTDOCPRINTER", SPOOLSS_STARTDOCPRINTER
, api_spoolss_startdocprinter
},
1587 {"SPOOLSS_ENDDOCPRINTER", SPOOLSS_ENDDOCPRINTER
, api_spoolss_enddocprinter
},
1588 {"SPOOLSS_WRITEPRINTER", SPOOLSS_WRITEPRINTER
, api_spoolss_writeprinter
},
1589 {"SPOOLSS_SETPRINTER", SPOOLSS_SETPRINTER
, api_spoolss_setprinter
},
1590 {"SPOOLSS_FCPN", SPOOLSS_FCPN
, api_spoolss_fcpn
},
1591 {"SPOOLSS_ADDJOB", SPOOLSS_ADDJOB
, api_spoolss_addjob
},
1592 {"SPOOLSS_ENUMJOBS", SPOOLSS_ENUMJOBS
, api_spoolss_enumjobs
},
1593 {"SPOOLSS_SCHEDULEJOB", SPOOLSS_SCHEDULEJOB
, api_spoolss_schedulejob
},
1594 {"SPOOLSS_SETJOB", SPOOLSS_SETJOB
, api_spoolss_setjob
},
1595 {"SPOOLSS_ENUMFORMS", SPOOLSS_ENUMFORMS
, api_spoolss_enumforms
},
1596 {"SPOOLSS_ENUMPORTS", SPOOLSS_ENUMPORTS
, api_spoolss_enumports
},
1597 {"SPOOLSS_ENUMPRINTERDRIVERS", SPOOLSS_ENUMPRINTERDRIVERS
, api_spoolss_enumprinterdrivers
},
1598 {"SPOOLSS_ADDPRINTEREX", SPOOLSS_ADDPRINTEREX
, api_spoolss_addprinterex
},
1599 {"SPOOLSS_ADDPRINTERDRIVER", SPOOLSS_ADDPRINTERDRIVER
, api_spoolss_addprinterdriver
},
1600 {"SPOOLSS_DELETEPRINTERDRIVER", SPOOLSS_DELETEPRINTERDRIVER
, api_spoolss_deleteprinterdriver
},
1601 {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", SPOOLSS_GETPRINTERDRIVERDIRECTORY
, api_spoolss_getprinterdriverdirectory
},
1602 {"SPOOLSS_ENUMPRINTERDATA", SPOOLSS_ENUMPRINTERDATA
, api_spoolss_enumprinterdata
},
1603 {"SPOOLSS_SETPRINTERDATA", SPOOLSS_SETPRINTERDATA
, api_spoolss_setprinterdata
},
1604 {"SPOOLSS_RESETPRINTER", SPOOLSS_RESETPRINTER
, api_spoolss_reset_printer
},
1605 {"SPOOLSS_DELETEPRINTERDATA", SPOOLSS_DELETEPRINTERDATA
, api_spoolss_deleteprinterdata
},
1606 {"SPOOLSS_ADDFORM", SPOOLSS_ADDFORM
, api_spoolss_addform
},
1607 {"SPOOLSS_DELETEFORM", SPOOLSS_DELETEFORM
, api_spoolss_deleteform
},
1608 {"SPOOLSS_GETFORM", SPOOLSS_GETFORM
, api_spoolss_getform
},
1609 {"SPOOLSS_SETFORM", SPOOLSS_SETFORM
, api_spoolss_setform
},
1610 {"SPOOLSS_ADDPRINTPROCESSOR", SPOOLSS_ADDPRINTPROCESSOR
, api_spoolss_addprintprocessor
},
1611 {"SPOOLSS_ENUMPRINTPROCESSORS", SPOOLSS_ENUMPRINTPROCESSORS
, api_spoolss_enumprintprocessors
},
1612 {"SPOOLSS_ENUMMONITORS", SPOOLSS_ENUMMONITORS
, api_spoolss_enumprintmonitors
},
1613 {"SPOOLSS_GETJOB", SPOOLSS_GETJOB
, api_spoolss_getjob
},
1614 {"SPOOLSS_ENUMPRINTPROCDATATYPES", SPOOLSS_ENUMPRINTPROCDATATYPES
, api_spoolss_enumprintprocdatatypes
},
1615 {"SPOOLSS_GETPRINTERDATAEX", SPOOLSS_GETPRINTERDATAEX
, api_spoolss_getprinterdataex
},
1616 {"SPOOLSS_SETPRINTERDATAEX", SPOOLSS_SETPRINTERDATAEX
, api_spoolss_setprinterdataex
},
1617 {"SPOOLSS_DELETEPRINTERDATAEX", SPOOLSS_DELETEPRINTERDATAEX
, api_spoolss_deleteprinterdataex
},
1618 {"SPOOLSS_ENUMPRINTERDATAEX", SPOOLSS_ENUMPRINTERDATAEX
, api_spoolss_enumprinterdataex
},
1619 {"SPOOLSS_ENUMPRINTERKEY", SPOOLSS_ENUMPRINTERKEY
, api_spoolss_enumprinterkey
},
1620 {"SPOOLSS_DELETEPRINTERKEY", SPOOLSS_DELETEPRINTERKEY
, api_spoolss_deleteprinterkey
},
1621 {"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY
,api_spoolss_getprintprocessordirectory
},
1622 {"SPOOLSS_ADDPRINTERDRIVEREX", SPOOLSS_ADDPRINTERDRIVEREX
, api_spoolss_addprinterdriverex
},
1623 {"SPOOLSS_DELETEPRINTERDRIVEREX", SPOOLSS_DELETEPRINTERDRIVEREX
, api_spoolss_deleteprinterdriverex
},
1624 {"SPOOLSS_XCVDATAPORT", SPOOLSS_XCVDATAPORT
, api_spoolss_xcvdataport
},
1627 void spoolss_get_pipe_fns( struct api_struct
**fns
, int *n_fns
)
1629 *fns
= api_spoolss_cmds
;
1630 *n_fns
= sizeof(api_spoolss_cmds
) / sizeof(struct api_struct
);
1633 NTSTATUS
rpc_spoolss_init(void)
1635 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION
,
1636 "spoolss", "spoolss", &syntax_spoolss
,
1638 sizeof(api_spoolss_cmds
) / sizeof(struct api_struct
));