spoolss: fill in spoolss_AddPrinter IDL.
[samba.git] / librpc / gen_ndr / srv_spoolss.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/srv_spoolss.h"
8
9 static bool api_spoolss_EnumPrinters(pipes_struct *p)
10 {
11         const struct ndr_interface_call *call;
12         struct ndr_pull *pull;
13         struct ndr_push *push;
14         enum ndr_err_code ndr_err;
15         DATA_BLOB blob;
16         struct spoolss_EnumPrinters *r;
17
18         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERS];
19
20         r = talloc(talloc_tos(), struct spoolss_EnumPrinters);
21         if (r == NULL) {
22                 return false;
23         }
24
25         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26                 talloc_free(r);
27                 return false;
28         }
29
30         pull = ndr_pull_init_blob(&blob, r, NULL);
31         if (pull == NULL) {
32                 talloc_free(r);
33                 return false;
34         }
35
36         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37         ndr_err = call->ndr_pull(pull, NDR_IN, r);
38         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39                 talloc_free(r);
40                 return false;
41         }
42
43         if (DEBUGLEVEL >= 10) {
44                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinters, r);
45         }
46
47         ZERO_STRUCT(r->out);
48         r->out.count = talloc_zero(r, uint32_t);
49         if (r->out.count == NULL) {
50                 talloc_free(r);
51                 return false;
52         }
53
54         r->out.info = talloc_zero(r, union spoolss_PrinterInfo *);
55         if (r->out.info == NULL) {
56                 talloc_free(r);
57                 return false;
58         }
59
60         r->out.needed = talloc_zero(r, uint32_t);
61         if (r->out.needed == NULL) {
62                 talloc_free(r);
63                 return false;
64         }
65
66         r->out.result = _spoolss_EnumPrinters(p, r);
67
68         if (p->rng_fault_state) {
69                 talloc_free(r);
70                 /* Return true here, srv_pipe_hnd.c will take care */
71                 return true;
72         }
73
74         if (DEBUGLEVEL >= 10) {
75                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinters, r);
76         }
77
78         push = ndr_push_init_ctx(r, NULL);
79         if (push == NULL) {
80                 talloc_free(r);
81                 return false;
82         }
83
84         ndr_err = call->ndr_push(push, NDR_OUT, r);
85         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
86                 talloc_free(r);
87                 return false;
88         }
89
90         blob = ndr_push_blob(push);
91         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
92                 talloc_free(r);
93                 return false;
94         }
95
96         talloc_free(r);
97
98         return true;
99 }
100
101 static bool api_spoolss_OpenPrinter(pipes_struct *p)
102 {
103         const struct ndr_interface_call *call;
104         struct ndr_pull *pull;
105         struct ndr_push *push;
106         enum ndr_err_code ndr_err;
107         DATA_BLOB blob;
108         struct spoolss_OpenPrinter *r;
109
110         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_OPENPRINTER];
111
112         r = talloc(talloc_tos(), struct spoolss_OpenPrinter);
113         if (r == NULL) {
114                 return false;
115         }
116
117         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
118                 talloc_free(r);
119                 return false;
120         }
121
122         pull = ndr_pull_init_blob(&blob, r, NULL);
123         if (pull == NULL) {
124                 talloc_free(r);
125                 return false;
126         }
127
128         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
129         ndr_err = call->ndr_pull(pull, NDR_IN, r);
130         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
131                 talloc_free(r);
132                 return false;
133         }
134
135         if (DEBUGLEVEL >= 10) {
136                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinter, r);
137         }
138
139         ZERO_STRUCT(r->out);
140         r->out.handle = talloc_zero(r, struct policy_handle);
141         if (r->out.handle == NULL) {
142                 talloc_free(r);
143                 return false;
144         }
145
146         r->out.result = _spoolss_OpenPrinter(p, r);
147
148         if (p->rng_fault_state) {
149                 talloc_free(r);
150                 /* Return true here, srv_pipe_hnd.c will take care */
151                 return true;
152         }
153
154         if (DEBUGLEVEL >= 10) {
155                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinter, r);
156         }
157
158         push = ndr_push_init_ctx(r, NULL);
159         if (push == NULL) {
160                 talloc_free(r);
161                 return false;
162         }
163
164         ndr_err = call->ndr_push(push, NDR_OUT, r);
165         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
166                 talloc_free(r);
167                 return false;
168         }
169
170         blob = ndr_push_blob(push);
171         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
172                 talloc_free(r);
173                 return false;
174         }
175
176         talloc_free(r);
177
178         return true;
179 }
180
181 static bool api_spoolss_SetJob(pipes_struct *p)
182 {
183         const struct ndr_interface_call *call;
184         struct ndr_pull *pull;
185         struct ndr_push *push;
186         enum ndr_err_code ndr_err;
187         DATA_BLOB blob;
188         struct spoolss_SetJob *r;
189
190         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETJOB];
191
192         r = talloc(talloc_tos(), struct spoolss_SetJob);
193         if (r == NULL) {
194                 return false;
195         }
196
197         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
198                 talloc_free(r);
199                 return false;
200         }
201
202         pull = ndr_pull_init_blob(&blob, r, NULL);
203         if (pull == NULL) {
204                 talloc_free(r);
205                 return false;
206         }
207
208         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
209         ndr_err = call->ndr_pull(pull, NDR_IN, r);
210         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
211                 talloc_free(r);
212                 return false;
213         }
214
215         if (DEBUGLEVEL >= 10) {
216                 NDR_PRINT_IN_DEBUG(spoolss_SetJob, r);
217         }
218
219         r->out.result = _spoolss_SetJob(p, r);
220
221         if (p->rng_fault_state) {
222                 talloc_free(r);
223                 /* Return true here, srv_pipe_hnd.c will take care */
224                 return true;
225         }
226
227         if (DEBUGLEVEL >= 10) {
228                 NDR_PRINT_OUT_DEBUG(spoolss_SetJob, r);
229         }
230
231         push = ndr_push_init_ctx(r, NULL);
232         if (push == NULL) {
233                 talloc_free(r);
234                 return false;
235         }
236
237         ndr_err = call->ndr_push(push, NDR_OUT, r);
238         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
239                 talloc_free(r);
240                 return false;
241         }
242
243         blob = ndr_push_blob(push);
244         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
245                 talloc_free(r);
246                 return false;
247         }
248
249         talloc_free(r);
250
251         return true;
252 }
253
254 static bool api_spoolss_GetJob(pipes_struct *p)
255 {
256         const struct ndr_interface_call *call;
257         struct ndr_pull *pull;
258         struct ndr_push *push;
259         enum ndr_err_code ndr_err;
260         DATA_BLOB blob;
261         struct spoolss_GetJob *r;
262
263         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETJOB];
264
265         r = talloc(talloc_tos(), struct spoolss_GetJob);
266         if (r == NULL) {
267                 return false;
268         }
269
270         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
271                 talloc_free(r);
272                 return false;
273         }
274
275         pull = ndr_pull_init_blob(&blob, r, NULL);
276         if (pull == NULL) {
277                 talloc_free(r);
278                 return false;
279         }
280
281         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
282         ndr_err = call->ndr_pull(pull, NDR_IN, r);
283         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
284                 talloc_free(r);
285                 return false;
286         }
287
288         if (DEBUGLEVEL >= 10) {
289                 NDR_PRINT_IN_DEBUG(spoolss_GetJob, r);
290         }
291
292         ZERO_STRUCT(r->out);
293         r->out.info = talloc_zero(r, union spoolss_JobInfo);
294         if (r->out.info == NULL) {
295                 talloc_free(r);
296                 return false;
297         }
298
299         r->out.needed = talloc_zero(r, uint32_t);
300         if (r->out.needed == NULL) {
301                 talloc_free(r);
302                 return false;
303         }
304
305         r->out.result = _spoolss_GetJob(p, r);
306
307         if (p->rng_fault_state) {
308                 talloc_free(r);
309                 /* Return true here, srv_pipe_hnd.c will take care */
310                 return true;
311         }
312
313         if (DEBUGLEVEL >= 10) {
314                 NDR_PRINT_OUT_DEBUG(spoolss_GetJob, r);
315         }
316
317         push = ndr_push_init_ctx(r, NULL);
318         if (push == NULL) {
319                 talloc_free(r);
320                 return false;
321         }
322
323         ndr_err = call->ndr_push(push, NDR_OUT, r);
324         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
325                 talloc_free(r);
326                 return false;
327         }
328
329         blob = ndr_push_blob(push);
330         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
331                 talloc_free(r);
332                 return false;
333         }
334
335         talloc_free(r);
336
337         return true;
338 }
339
340 static bool api_spoolss_EnumJobs(pipes_struct *p)
341 {
342         const struct ndr_interface_call *call;
343         struct ndr_pull *pull;
344         struct ndr_push *push;
345         enum ndr_err_code ndr_err;
346         DATA_BLOB blob;
347         struct spoolss_EnumJobs *r;
348
349         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMJOBS];
350
351         r = talloc(talloc_tos(), struct spoolss_EnumJobs);
352         if (r == NULL) {
353                 return false;
354         }
355
356         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
357                 talloc_free(r);
358                 return false;
359         }
360
361         pull = ndr_pull_init_blob(&blob, r, NULL);
362         if (pull == NULL) {
363                 talloc_free(r);
364                 return false;
365         }
366
367         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
368         ndr_err = call->ndr_pull(pull, NDR_IN, r);
369         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
370                 talloc_free(r);
371                 return false;
372         }
373
374         if (DEBUGLEVEL >= 10) {
375                 NDR_PRINT_IN_DEBUG(spoolss_EnumJobs, r);
376         }
377
378         ZERO_STRUCT(r->out);
379         r->out.count = talloc_zero(r, uint32_t);
380         if (r->out.count == NULL) {
381                 talloc_free(r);
382                 return false;
383         }
384
385         r->out.info = talloc_zero(r, union spoolss_JobInfo *);
386         if (r->out.info == NULL) {
387                 talloc_free(r);
388                 return false;
389         }
390
391         r->out.needed = talloc_zero(r, uint32_t);
392         if (r->out.needed == NULL) {
393                 talloc_free(r);
394                 return false;
395         }
396
397         r->out.result = _spoolss_EnumJobs(p, r);
398
399         if (p->rng_fault_state) {
400                 talloc_free(r);
401                 /* Return true here, srv_pipe_hnd.c will take care */
402                 return true;
403         }
404
405         if (DEBUGLEVEL >= 10) {
406                 NDR_PRINT_OUT_DEBUG(spoolss_EnumJobs, r);
407         }
408
409         push = ndr_push_init_ctx(r, NULL);
410         if (push == NULL) {
411                 talloc_free(r);
412                 return false;
413         }
414
415         ndr_err = call->ndr_push(push, NDR_OUT, r);
416         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
417                 talloc_free(r);
418                 return false;
419         }
420
421         blob = ndr_push_blob(push);
422         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
423                 talloc_free(r);
424                 return false;
425         }
426
427         talloc_free(r);
428
429         return true;
430 }
431
432 static bool api_spoolss_AddPrinter(pipes_struct *p)
433 {
434         const struct ndr_interface_call *call;
435         struct ndr_pull *pull;
436         struct ndr_push *push;
437         enum ndr_err_code ndr_err;
438         DATA_BLOB blob;
439         struct spoolss_AddPrinter *r;
440
441         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTER];
442
443         r = talloc(talloc_tos(), struct spoolss_AddPrinter);
444         if (r == NULL) {
445                 return false;
446         }
447
448         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
449                 talloc_free(r);
450                 return false;
451         }
452
453         pull = ndr_pull_init_blob(&blob, r, NULL);
454         if (pull == NULL) {
455                 talloc_free(r);
456                 return false;
457         }
458
459         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
460         ndr_err = call->ndr_pull(pull, NDR_IN, r);
461         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
462                 talloc_free(r);
463                 return false;
464         }
465
466         if (DEBUGLEVEL >= 10) {
467                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinter, r);
468         }
469
470         ZERO_STRUCT(r->out);
471         r->out.handle = talloc_zero(r, struct policy_handle);
472         if (r->out.handle == NULL) {
473                 talloc_free(r);
474                 return false;
475         }
476
477         r->out.result = _spoolss_AddPrinter(p, r);
478
479         if (p->rng_fault_state) {
480                 talloc_free(r);
481                 /* Return true here, srv_pipe_hnd.c will take care */
482                 return true;
483         }
484
485         if (DEBUGLEVEL >= 10) {
486                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinter, r);
487         }
488
489         push = ndr_push_init_ctx(r, NULL);
490         if (push == NULL) {
491                 talloc_free(r);
492                 return false;
493         }
494
495         ndr_err = call->ndr_push(push, NDR_OUT, r);
496         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
497                 talloc_free(r);
498                 return false;
499         }
500
501         blob = ndr_push_blob(push);
502         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
503                 talloc_free(r);
504                 return false;
505         }
506
507         talloc_free(r);
508
509         return true;
510 }
511
512 static bool api_spoolss_DeletePrinter(pipes_struct *p)
513 {
514         const struct ndr_interface_call *call;
515         struct ndr_pull *pull;
516         struct ndr_push *push;
517         enum ndr_err_code ndr_err;
518         DATA_BLOB blob;
519         struct spoolss_DeletePrinter *r;
520
521         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTER];
522
523         r = talloc(talloc_tos(), struct spoolss_DeletePrinter);
524         if (r == NULL) {
525                 return false;
526         }
527
528         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
529                 talloc_free(r);
530                 return false;
531         }
532
533         pull = ndr_pull_init_blob(&blob, r, NULL);
534         if (pull == NULL) {
535                 talloc_free(r);
536                 return false;
537         }
538
539         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
540         ndr_err = call->ndr_pull(pull, NDR_IN, r);
541         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
542                 talloc_free(r);
543                 return false;
544         }
545
546         if (DEBUGLEVEL >= 10) {
547                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinter, r);
548         }
549
550         r->out.result = _spoolss_DeletePrinter(p, r);
551
552         if (p->rng_fault_state) {
553                 talloc_free(r);
554                 /* Return true here, srv_pipe_hnd.c will take care */
555                 return true;
556         }
557
558         if (DEBUGLEVEL >= 10) {
559                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinter, r);
560         }
561
562         push = ndr_push_init_ctx(r, NULL);
563         if (push == NULL) {
564                 talloc_free(r);
565                 return false;
566         }
567
568         ndr_err = call->ndr_push(push, NDR_OUT, r);
569         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
570                 talloc_free(r);
571                 return false;
572         }
573
574         blob = ndr_push_blob(push);
575         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
576                 talloc_free(r);
577                 return false;
578         }
579
580         talloc_free(r);
581
582         return true;
583 }
584
585 static bool api_spoolss_SetPrinter(pipes_struct *p)
586 {
587         const struct ndr_interface_call *call;
588         struct ndr_pull *pull;
589         struct ndr_push *push;
590         enum ndr_err_code ndr_err;
591         DATA_BLOB blob;
592         struct spoolss_SetPrinter *r;
593
594         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTER];
595
596         r = talloc(talloc_tos(), struct spoolss_SetPrinter);
597         if (r == NULL) {
598                 return false;
599         }
600
601         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
602                 talloc_free(r);
603                 return false;
604         }
605
606         pull = ndr_pull_init_blob(&blob, r, NULL);
607         if (pull == NULL) {
608                 talloc_free(r);
609                 return false;
610         }
611
612         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
613         ndr_err = call->ndr_pull(pull, NDR_IN, r);
614         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
615                 talloc_free(r);
616                 return false;
617         }
618
619         if (DEBUGLEVEL >= 10) {
620                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinter, r);
621         }
622
623         r->out.result = _spoolss_SetPrinter(p, r);
624
625         if (p->rng_fault_state) {
626                 talloc_free(r);
627                 /* Return true here, srv_pipe_hnd.c will take care */
628                 return true;
629         }
630
631         if (DEBUGLEVEL >= 10) {
632                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinter, r);
633         }
634
635         push = ndr_push_init_ctx(r, NULL);
636         if (push == NULL) {
637                 talloc_free(r);
638                 return false;
639         }
640
641         ndr_err = call->ndr_push(push, NDR_OUT, r);
642         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
643                 talloc_free(r);
644                 return false;
645         }
646
647         blob = ndr_push_blob(push);
648         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
649                 talloc_free(r);
650                 return false;
651         }
652
653         talloc_free(r);
654
655         return true;
656 }
657
658 static bool api_spoolss_GetPrinter(pipes_struct *p)
659 {
660         const struct ndr_interface_call *call;
661         struct ndr_pull *pull;
662         struct ndr_push *push;
663         enum ndr_err_code ndr_err;
664         DATA_BLOB blob;
665         struct spoolss_GetPrinter *r;
666
667         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTER];
668
669         r = talloc(talloc_tos(), struct spoolss_GetPrinter);
670         if (r == NULL) {
671                 return false;
672         }
673
674         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
675                 talloc_free(r);
676                 return false;
677         }
678
679         pull = ndr_pull_init_blob(&blob, r, NULL);
680         if (pull == NULL) {
681                 talloc_free(r);
682                 return false;
683         }
684
685         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
686         ndr_err = call->ndr_pull(pull, NDR_IN, r);
687         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
688                 talloc_free(r);
689                 return false;
690         }
691
692         if (DEBUGLEVEL >= 10) {
693                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinter, r);
694         }
695
696         ZERO_STRUCT(r->out);
697         r->out.info = talloc_zero(r, union spoolss_PrinterInfo);
698         if (r->out.info == NULL) {
699                 talloc_free(r);
700                 return false;
701         }
702
703         r->out.needed = talloc_zero(r, uint32_t);
704         if (r->out.needed == NULL) {
705                 talloc_free(r);
706                 return false;
707         }
708
709         r->out.result = _spoolss_GetPrinter(p, r);
710
711         if (p->rng_fault_state) {
712                 talloc_free(r);
713                 /* Return true here, srv_pipe_hnd.c will take care */
714                 return true;
715         }
716
717         if (DEBUGLEVEL >= 10) {
718                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinter, r);
719         }
720
721         push = ndr_push_init_ctx(r, NULL);
722         if (push == NULL) {
723                 talloc_free(r);
724                 return false;
725         }
726
727         ndr_err = call->ndr_push(push, NDR_OUT, r);
728         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
729                 talloc_free(r);
730                 return false;
731         }
732
733         blob = ndr_push_blob(push);
734         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
735                 talloc_free(r);
736                 return false;
737         }
738
739         talloc_free(r);
740
741         return true;
742 }
743
744 static bool api_spoolss_AddPrinterDriver(pipes_struct *p)
745 {
746         const struct ndr_interface_call *call;
747         struct ndr_pull *pull;
748         struct ndr_push *push;
749         enum ndr_err_code ndr_err;
750         DATA_BLOB blob;
751         struct spoolss_AddPrinterDriver *r;
752
753         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERDRIVER];
754
755         r = talloc(talloc_tos(), struct spoolss_AddPrinterDriver);
756         if (r == NULL) {
757                 return false;
758         }
759
760         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
761                 talloc_free(r);
762                 return false;
763         }
764
765         pull = ndr_pull_init_blob(&blob, r, NULL);
766         if (pull == NULL) {
767                 talloc_free(r);
768                 return false;
769         }
770
771         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
772         ndr_err = call->ndr_pull(pull, NDR_IN, r);
773         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
774                 talloc_free(r);
775                 return false;
776         }
777
778         if (DEBUGLEVEL >= 10) {
779                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriver, r);
780         }
781
782         r->out.result = _spoolss_AddPrinterDriver(p, r);
783
784         if (p->rng_fault_state) {
785                 talloc_free(r);
786                 /* Return true here, srv_pipe_hnd.c will take care */
787                 return true;
788         }
789
790         if (DEBUGLEVEL >= 10) {
791                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriver, r);
792         }
793
794         push = ndr_push_init_ctx(r, NULL);
795         if (push == NULL) {
796                 talloc_free(r);
797                 return false;
798         }
799
800         ndr_err = call->ndr_push(push, NDR_OUT, r);
801         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
802                 talloc_free(r);
803                 return false;
804         }
805
806         blob = ndr_push_blob(push);
807         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
808                 talloc_free(r);
809                 return false;
810         }
811
812         talloc_free(r);
813
814         return true;
815 }
816
817 static bool api_spoolss_EnumPrinterDrivers(pipes_struct *p)
818 {
819         const struct ndr_interface_call *call;
820         struct ndr_pull *pull;
821         struct ndr_push *push;
822         enum ndr_err_code ndr_err;
823         DATA_BLOB blob;
824         struct spoolss_EnumPrinterDrivers *r;
825
826         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDRIVERS];
827
828         r = talloc(talloc_tos(), struct spoolss_EnumPrinterDrivers);
829         if (r == NULL) {
830                 return false;
831         }
832
833         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
834                 talloc_free(r);
835                 return false;
836         }
837
838         pull = ndr_pull_init_blob(&blob, r, NULL);
839         if (pull == NULL) {
840                 talloc_free(r);
841                 return false;
842         }
843
844         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
845         ndr_err = call->ndr_pull(pull, NDR_IN, r);
846         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
847                 talloc_free(r);
848                 return false;
849         }
850
851         if (DEBUGLEVEL >= 10) {
852                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDrivers, r);
853         }
854
855         ZERO_STRUCT(r->out);
856         r->out.count = talloc_zero(r, uint32_t);
857         if (r->out.count == NULL) {
858                 talloc_free(r);
859                 return false;
860         }
861
862         r->out.info = talloc_zero(r, union spoolss_DriverInfo *);
863         if (r->out.info == NULL) {
864                 talloc_free(r);
865                 return false;
866         }
867
868         r->out.needed = talloc_zero(r, uint32_t);
869         if (r->out.needed == NULL) {
870                 talloc_free(r);
871                 return false;
872         }
873
874         r->out.result = _spoolss_EnumPrinterDrivers(p, r);
875
876         if (p->rng_fault_state) {
877                 talloc_free(r);
878                 /* Return true here, srv_pipe_hnd.c will take care */
879                 return true;
880         }
881
882         if (DEBUGLEVEL >= 10) {
883                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDrivers, r);
884         }
885
886         push = ndr_push_init_ctx(r, NULL);
887         if (push == NULL) {
888                 talloc_free(r);
889                 return false;
890         }
891
892         ndr_err = call->ndr_push(push, NDR_OUT, r);
893         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
894                 talloc_free(r);
895                 return false;
896         }
897
898         blob = ndr_push_blob(push);
899         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
900                 talloc_free(r);
901                 return false;
902         }
903
904         talloc_free(r);
905
906         return true;
907 }
908
909 static bool api_spoolss_GetPrinterDriver(pipes_struct *p)
910 {
911         const struct ndr_interface_call *call;
912         struct ndr_pull *pull;
913         struct ndr_push *push;
914         enum ndr_err_code ndr_err;
915         DATA_BLOB blob;
916         struct spoolss_GetPrinterDriver *r;
917
918         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVER];
919
920         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriver);
921         if (r == NULL) {
922                 return false;
923         }
924
925         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
926                 talloc_free(r);
927                 return false;
928         }
929
930         pull = ndr_pull_init_blob(&blob, r, NULL);
931         if (pull == NULL) {
932                 talloc_free(r);
933                 return false;
934         }
935
936         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
937         ndr_err = call->ndr_pull(pull, NDR_IN, r);
938         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
939                 talloc_free(r);
940                 return false;
941         }
942
943         if (DEBUGLEVEL >= 10) {
944                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver, r);
945         }
946
947         r->out.result = _spoolss_GetPrinterDriver(p, r);
948
949         if (p->rng_fault_state) {
950                 talloc_free(r);
951                 /* Return true here, srv_pipe_hnd.c will take care */
952                 return true;
953         }
954
955         if (DEBUGLEVEL >= 10) {
956                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver, r);
957         }
958
959         push = ndr_push_init_ctx(r, NULL);
960         if (push == NULL) {
961                 talloc_free(r);
962                 return false;
963         }
964
965         ndr_err = call->ndr_push(push, NDR_OUT, r);
966         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
967                 talloc_free(r);
968                 return false;
969         }
970
971         blob = ndr_push_blob(push);
972         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
973                 talloc_free(r);
974                 return false;
975         }
976
977         talloc_free(r);
978
979         return true;
980 }
981
982 static bool api_spoolss_GetPrinterDriverDirectory(pipes_struct *p)
983 {
984         const struct ndr_interface_call *call;
985         struct ndr_pull *pull;
986         struct ndr_push *push;
987         enum ndr_err_code ndr_err;
988         DATA_BLOB blob;
989         struct spoolss_GetPrinterDriverDirectory *r;
990
991         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY];
992
993         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriverDirectory);
994         if (r == NULL) {
995                 return false;
996         }
997
998         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
999                 talloc_free(r);
1000                 return false;
1001         }
1002
1003         pull = ndr_pull_init_blob(&blob, r, NULL);
1004         if (pull == NULL) {
1005                 talloc_free(r);
1006                 return false;
1007         }
1008
1009         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1010         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1011         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1012                 talloc_free(r);
1013                 return false;
1014         }
1015
1016         if (DEBUGLEVEL >= 10) {
1017                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriverDirectory, r);
1018         }
1019
1020         ZERO_STRUCT(r->out);
1021         r->out.info = talloc_zero(r, union spoolss_DriverDirectoryInfo);
1022         if (r->out.info == NULL) {
1023                 talloc_free(r);
1024                 return false;
1025         }
1026
1027         r->out.needed = talloc_zero(r, uint32_t);
1028         if (r->out.needed == NULL) {
1029                 talloc_free(r);
1030                 return false;
1031         }
1032
1033         r->out.result = _spoolss_GetPrinterDriverDirectory(p, r);
1034
1035         if (p->rng_fault_state) {
1036                 talloc_free(r);
1037                 /* Return true here, srv_pipe_hnd.c will take care */
1038                 return true;
1039         }
1040
1041         if (DEBUGLEVEL >= 10) {
1042                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriverDirectory, r);
1043         }
1044
1045         push = ndr_push_init_ctx(r, NULL);
1046         if (push == NULL) {
1047                 talloc_free(r);
1048                 return false;
1049         }
1050
1051         ndr_err = call->ndr_push(push, NDR_OUT, r);
1052         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1053                 talloc_free(r);
1054                 return false;
1055         }
1056
1057         blob = ndr_push_blob(push);
1058         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1059                 talloc_free(r);
1060                 return false;
1061         }
1062
1063         talloc_free(r);
1064
1065         return true;
1066 }
1067
1068 static bool api_spoolss_DeletePrinterDriver(pipes_struct *p)
1069 {
1070         const struct ndr_interface_call *call;
1071         struct ndr_pull *pull;
1072         struct ndr_push *push;
1073         enum ndr_err_code ndr_err;
1074         DATA_BLOB blob;
1075         struct spoolss_DeletePrinterDriver *r;
1076
1077         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVER];
1078
1079         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriver);
1080         if (r == NULL) {
1081                 return false;
1082         }
1083
1084         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1085                 talloc_free(r);
1086                 return false;
1087         }
1088
1089         pull = ndr_pull_init_blob(&blob, r, NULL);
1090         if (pull == NULL) {
1091                 talloc_free(r);
1092                 return false;
1093         }
1094
1095         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1096         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1097         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1098                 talloc_free(r);
1099                 return false;
1100         }
1101
1102         if (DEBUGLEVEL >= 10) {
1103                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriver, r);
1104         }
1105
1106         r->out.result = _spoolss_DeletePrinterDriver(p, r);
1107
1108         if (p->rng_fault_state) {
1109                 talloc_free(r);
1110                 /* Return true here, srv_pipe_hnd.c will take care */
1111                 return true;
1112         }
1113
1114         if (DEBUGLEVEL >= 10) {
1115                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriver, r);
1116         }
1117
1118         push = ndr_push_init_ctx(r, NULL);
1119         if (push == NULL) {
1120                 talloc_free(r);
1121                 return false;
1122         }
1123
1124         ndr_err = call->ndr_push(push, NDR_OUT, r);
1125         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1126                 talloc_free(r);
1127                 return false;
1128         }
1129
1130         blob = ndr_push_blob(push);
1131         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1132                 talloc_free(r);
1133                 return false;
1134         }
1135
1136         talloc_free(r);
1137
1138         return true;
1139 }
1140
1141 static bool api_spoolss_AddPrintProcessor(pipes_struct *p)
1142 {
1143         const struct ndr_interface_call *call;
1144         struct ndr_pull *pull;
1145         struct ndr_push *push;
1146         enum ndr_err_code ndr_err;
1147         DATA_BLOB blob;
1148         struct spoolss_AddPrintProcessor *r;
1149
1150         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTPROCESSOR];
1151
1152         r = talloc(talloc_tos(), struct spoolss_AddPrintProcessor);
1153         if (r == NULL) {
1154                 return false;
1155         }
1156
1157         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1158                 talloc_free(r);
1159                 return false;
1160         }
1161
1162         pull = ndr_pull_init_blob(&blob, r, NULL);
1163         if (pull == NULL) {
1164                 talloc_free(r);
1165                 return false;
1166         }
1167
1168         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1169         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1170         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1171                 talloc_free(r);
1172                 return false;
1173         }
1174
1175         if (DEBUGLEVEL >= 10) {
1176                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProcessor, r);
1177         }
1178
1179         r->out.result = _spoolss_AddPrintProcessor(p, r);
1180
1181         if (p->rng_fault_state) {
1182                 talloc_free(r);
1183                 /* Return true here, srv_pipe_hnd.c will take care */
1184                 return true;
1185         }
1186
1187         if (DEBUGLEVEL >= 10) {
1188                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProcessor, r);
1189         }
1190
1191         push = ndr_push_init_ctx(r, NULL);
1192         if (push == NULL) {
1193                 talloc_free(r);
1194                 return false;
1195         }
1196
1197         ndr_err = call->ndr_push(push, NDR_OUT, r);
1198         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1199                 talloc_free(r);
1200                 return false;
1201         }
1202
1203         blob = ndr_push_blob(push);
1204         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1205                 talloc_free(r);
1206                 return false;
1207         }
1208
1209         talloc_free(r);
1210
1211         return true;
1212 }
1213
1214 static bool api_spoolss_EnumPrintProcessors(pipes_struct *p)
1215 {
1216         const struct ndr_interface_call *call;
1217         struct ndr_pull *pull;
1218         struct ndr_push *push;
1219         enum ndr_err_code ndr_err;
1220         DATA_BLOB blob;
1221         struct spoolss_EnumPrintProcessors *r;
1222
1223         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTPROCESSORS];
1224
1225         r = talloc(talloc_tos(), struct spoolss_EnumPrintProcessors);
1226         if (r == NULL) {
1227                 return false;
1228         }
1229
1230         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1231                 talloc_free(r);
1232                 return false;
1233         }
1234
1235         pull = ndr_pull_init_blob(&blob, r, NULL);
1236         if (pull == NULL) {
1237                 talloc_free(r);
1238                 return false;
1239         }
1240
1241         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1242         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1243         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1244                 talloc_free(r);
1245                 return false;
1246         }
1247
1248         if (DEBUGLEVEL >= 10) {
1249                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcessors, r);
1250         }
1251
1252         ZERO_STRUCT(r->out);
1253         r->out.count = talloc_zero(r, uint32_t);
1254         if (r->out.count == NULL) {
1255                 talloc_free(r);
1256                 return false;
1257         }
1258
1259         r->out.info = talloc_zero(r, union spoolss_PrintProcessorInfo *);
1260         if (r->out.info == NULL) {
1261                 talloc_free(r);
1262                 return false;
1263         }
1264
1265         r->out.needed = talloc_zero(r, uint32_t);
1266         if (r->out.needed == NULL) {
1267                 talloc_free(r);
1268                 return false;
1269         }
1270
1271         r->out.result = _spoolss_EnumPrintProcessors(p, r);
1272
1273         if (p->rng_fault_state) {
1274                 talloc_free(r);
1275                 /* Return true here, srv_pipe_hnd.c will take care */
1276                 return true;
1277         }
1278
1279         if (DEBUGLEVEL >= 10) {
1280                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcessors, r);
1281         }
1282
1283         push = ndr_push_init_ctx(r, NULL);
1284         if (push == NULL) {
1285                 talloc_free(r);
1286                 return false;
1287         }
1288
1289         ndr_err = call->ndr_push(push, NDR_OUT, r);
1290         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1291                 talloc_free(r);
1292                 return false;
1293         }
1294
1295         blob = ndr_push_blob(push);
1296         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1297                 talloc_free(r);
1298                 return false;
1299         }
1300
1301         talloc_free(r);
1302
1303         return true;
1304 }
1305
1306 static bool api_spoolss_GetPrintProcessorDirectory(pipes_struct *p)
1307 {
1308         const struct ndr_interface_call *call;
1309         struct ndr_pull *pull;
1310         struct ndr_push *push;
1311         enum ndr_err_code ndr_err;
1312         DATA_BLOB blob;
1313         struct spoolss_GetPrintProcessorDirectory *r;
1314
1315         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY];
1316
1317         r = talloc(talloc_tos(), struct spoolss_GetPrintProcessorDirectory);
1318         if (r == NULL) {
1319                 return false;
1320         }
1321
1322         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1323                 talloc_free(r);
1324                 return false;
1325         }
1326
1327         pull = ndr_pull_init_blob(&blob, r, NULL);
1328         if (pull == NULL) {
1329                 talloc_free(r);
1330                 return false;
1331         }
1332
1333         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1334         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1335         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1336                 talloc_free(r);
1337                 return false;
1338         }
1339
1340         if (DEBUGLEVEL >= 10) {
1341                 NDR_PRINT_IN_DEBUG(spoolss_GetPrintProcessorDirectory, r);
1342         }
1343
1344         ZERO_STRUCT(r->out);
1345         r->out.info = talloc_zero(r, union spoolss_PrintProcessorDirectoryInfo);
1346         if (r->out.info == NULL) {
1347                 talloc_free(r);
1348                 return false;
1349         }
1350
1351         r->out.needed = talloc_zero(r, uint32_t);
1352         if (r->out.needed == NULL) {
1353                 talloc_free(r);
1354                 return false;
1355         }
1356
1357         r->out.result = _spoolss_GetPrintProcessorDirectory(p, r);
1358
1359         if (p->rng_fault_state) {
1360                 talloc_free(r);
1361                 /* Return true here, srv_pipe_hnd.c will take care */
1362                 return true;
1363         }
1364
1365         if (DEBUGLEVEL >= 10) {
1366                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrintProcessorDirectory, r);
1367         }
1368
1369         push = ndr_push_init_ctx(r, NULL);
1370         if (push == NULL) {
1371                 talloc_free(r);
1372                 return false;
1373         }
1374
1375         ndr_err = call->ndr_push(push, NDR_OUT, r);
1376         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1377                 talloc_free(r);
1378                 return false;
1379         }
1380
1381         blob = ndr_push_blob(push);
1382         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1383                 talloc_free(r);
1384                 return false;
1385         }
1386
1387         talloc_free(r);
1388
1389         return true;
1390 }
1391
1392 static bool api_spoolss_StartDocPrinter(pipes_struct *p)
1393 {
1394         const struct ndr_interface_call *call;
1395         struct ndr_pull *pull;
1396         struct ndr_push *push;
1397         enum ndr_err_code ndr_err;
1398         DATA_BLOB blob;
1399         struct spoolss_StartDocPrinter *r;
1400
1401         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_STARTDOCPRINTER];
1402
1403         r = talloc(talloc_tos(), struct spoolss_StartDocPrinter);
1404         if (r == NULL) {
1405                 return false;
1406         }
1407
1408         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1409                 talloc_free(r);
1410                 return false;
1411         }
1412
1413         pull = ndr_pull_init_blob(&blob, r, NULL);
1414         if (pull == NULL) {
1415                 talloc_free(r);
1416                 return false;
1417         }
1418
1419         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1420         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1421         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1422                 talloc_free(r);
1423                 return false;
1424         }
1425
1426         if (DEBUGLEVEL >= 10) {
1427                 NDR_PRINT_IN_DEBUG(spoolss_StartDocPrinter, r);
1428         }
1429
1430         ZERO_STRUCT(r->out);
1431         r->out.job_id = talloc_zero(r, uint32_t);
1432         if (r->out.job_id == NULL) {
1433                 talloc_free(r);
1434                 return false;
1435         }
1436
1437         r->out.result = _spoolss_StartDocPrinter(p, r);
1438
1439         if (p->rng_fault_state) {
1440                 talloc_free(r);
1441                 /* Return true here, srv_pipe_hnd.c will take care */
1442                 return true;
1443         }
1444
1445         if (DEBUGLEVEL >= 10) {
1446                 NDR_PRINT_OUT_DEBUG(spoolss_StartDocPrinter, r);
1447         }
1448
1449         push = ndr_push_init_ctx(r, NULL);
1450         if (push == NULL) {
1451                 talloc_free(r);
1452                 return false;
1453         }
1454
1455         ndr_err = call->ndr_push(push, NDR_OUT, r);
1456         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1457                 talloc_free(r);
1458                 return false;
1459         }
1460
1461         blob = ndr_push_blob(push);
1462         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1463                 talloc_free(r);
1464                 return false;
1465         }
1466
1467         talloc_free(r);
1468
1469         return true;
1470 }
1471
1472 static bool api_spoolss_StartPagePrinter(pipes_struct *p)
1473 {
1474         const struct ndr_interface_call *call;
1475         struct ndr_pull *pull;
1476         struct ndr_push *push;
1477         enum ndr_err_code ndr_err;
1478         DATA_BLOB blob;
1479         struct spoolss_StartPagePrinter *r;
1480
1481         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_STARTPAGEPRINTER];
1482
1483         r = talloc(talloc_tos(), struct spoolss_StartPagePrinter);
1484         if (r == NULL) {
1485                 return false;
1486         }
1487
1488         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1489                 talloc_free(r);
1490                 return false;
1491         }
1492
1493         pull = ndr_pull_init_blob(&blob, r, NULL);
1494         if (pull == NULL) {
1495                 talloc_free(r);
1496                 return false;
1497         }
1498
1499         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1500         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1501         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1502                 talloc_free(r);
1503                 return false;
1504         }
1505
1506         if (DEBUGLEVEL >= 10) {
1507                 NDR_PRINT_IN_DEBUG(spoolss_StartPagePrinter, r);
1508         }
1509
1510         r->out.result = _spoolss_StartPagePrinter(p, r);
1511
1512         if (p->rng_fault_state) {
1513                 talloc_free(r);
1514                 /* Return true here, srv_pipe_hnd.c will take care */
1515                 return true;
1516         }
1517
1518         if (DEBUGLEVEL >= 10) {
1519                 NDR_PRINT_OUT_DEBUG(spoolss_StartPagePrinter, r);
1520         }
1521
1522         push = ndr_push_init_ctx(r, NULL);
1523         if (push == NULL) {
1524                 talloc_free(r);
1525                 return false;
1526         }
1527
1528         ndr_err = call->ndr_push(push, NDR_OUT, r);
1529         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1530                 talloc_free(r);
1531                 return false;
1532         }
1533
1534         blob = ndr_push_blob(push);
1535         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1536                 talloc_free(r);
1537                 return false;
1538         }
1539
1540         talloc_free(r);
1541
1542         return true;
1543 }
1544
1545 static bool api_spoolss_WritePrinter(pipes_struct *p)
1546 {
1547         const struct ndr_interface_call *call;
1548         struct ndr_pull *pull;
1549         struct ndr_push *push;
1550         enum ndr_err_code ndr_err;
1551         DATA_BLOB blob;
1552         struct spoolss_WritePrinter *r;
1553
1554         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_WRITEPRINTER];
1555
1556         r = talloc(talloc_tos(), struct spoolss_WritePrinter);
1557         if (r == NULL) {
1558                 return false;
1559         }
1560
1561         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1562                 talloc_free(r);
1563                 return false;
1564         }
1565
1566         pull = ndr_pull_init_blob(&blob, r, NULL);
1567         if (pull == NULL) {
1568                 talloc_free(r);
1569                 return false;
1570         }
1571
1572         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1573         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1574         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1575                 talloc_free(r);
1576                 return false;
1577         }
1578
1579         if (DEBUGLEVEL >= 10) {
1580                 NDR_PRINT_IN_DEBUG(spoolss_WritePrinter, r);
1581         }
1582
1583         ZERO_STRUCT(r->out);
1584         r->out.num_written = talloc_zero(r, uint32_t);
1585         if (r->out.num_written == NULL) {
1586                 talloc_free(r);
1587                 return false;
1588         }
1589
1590         r->out.result = _spoolss_WritePrinter(p, r);
1591
1592         if (p->rng_fault_state) {
1593                 talloc_free(r);
1594                 /* Return true here, srv_pipe_hnd.c will take care */
1595                 return true;
1596         }
1597
1598         if (DEBUGLEVEL >= 10) {
1599                 NDR_PRINT_OUT_DEBUG(spoolss_WritePrinter, r);
1600         }
1601
1602         push = ndr_push_init_ctx(r, NULL);
1603         if (push == NULL) {
1604                 talloc_free(r);
1605                 return false;
1606         }
1607
1608         ndr_err = call->ndr_push(push, NDR_OUT, r);
1609         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1610                 talloc_free(r);
1611                 return false;
1612         }
1613
1614         blob = ndr_push_blob(push);
1615         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1616                 talloc_free(r);
1617                 return false;
1618         }
1619
1620         talloc_free(r);
1621
1622         return true;
1623 }
1624
1625 static bool api_spoolss_EndPagePrinter(pipes_struct *p)
1626 {
1627         const struct ndr_interface_call *call;
1628         struct ndr_pull *pull;
1629         struct ndr_push *push;
1630         enum ndr_err_code ndr_err;
1631         DATA_BLOB blob;
1632         struct spoolss_EndPagePrinter *r;
1633
1634         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENDPAGEPRINTER];
1635
1636         r = talloc(talloc_tos(), struct spoolss_EndPagePrinter);
1637         if (r == NULL) {
1638                 return false;
1639         }
1640
1641         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1642                 talloc_free(r);
1643                 return false;
1644         }
1645
1646         pull = ndr_pull_init_blob(&blob, r, NULL);
1647         if (pull == NULL) {
1648                 talloc_free(r);
1649                 return false;
1650         }
1651
1652         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1653         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1654         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1655                 talloc_free(r);
1656                 return false;
1657         }
1658
1659         if (DEBUGLEVEL >= 10) {
1660                 NDR_PRINT_IN_DEBUG(spoolss_EndPagePrinter, r);
1661         }
1662
1663         r->out.result = _spoolss_EndPagePrinter(p, r);
1664
1665         if (p->rng_fault_state) {
1666                 talloc_free(r);
1667                 /* Return true here, srv_pipe_hnd.c will take care */
1668                 return true;
1669         }
1670
1671         if (DEBUGLEVEL >= 10) {
1672                 NDR_PRINT_OUT_DEBUG(spoolss_EndPagePrinter, r);
1673         }
1674
1675         push = ndr_push_init_ctx(r, NULL);
1676         if (push == NULL) {
1677                 talloc_free(r);
1678                 return false;
1679         }
1680
1681         ndr_err = call->ndr_push(push, NDR_OUT, r);
1682         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1683                 talloc_free(r);
1684                 return false;
1685         }
1686
1687         blob = ndr_push_blob(push);
1688         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1689                 talloc_free(r);
1690                 return false;
1691         }
1692
1693         talloc_free(r);
1694
1695         return true;
1696 }
1697
1698 static bool api_spoolss_AbortPrinter(pipes_struct *p)
1699 {
1700         const struct ndr_interface_call *call;
1701         struct ndr_pull *pull;
1702         struct ndr_push *push;
1703         enum ndr_err_code ndr_err;
1704         DATA_BLOB blob;
1705         struct spoolss_AbortPrinter *r;
1706
1707         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ABORTPRINTER];
1708
1709         r = talloc(talloc_tos(), struct spoolss_AbortPrinter);
1710         if (r == NULL) {
1711                 return false;
1712         }
1713
1714         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1715                 talloc_free(r);
1716                 return false;
1717         }
1718
1719         pull = ndr_pull_init_blob(&blob, r, NULL);
1720         if (pull == NULL) {
1721                 talloc_free(r);
1722                 return false;
1723         }
1724
1725         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1726         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1727         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1728                 talloc_free(r);
1729                 return false;
1730         }
1731
1732         if (DEBUGLEVEL >= 10) {
1733                 NDR_PRINT_IN_DEBUG(spoolss_AbortPrinter, r);
1734         }
1735
1736         r->out.result = _spoolss_AbortPrinter(p, r);
1737
1738         if (p->rng_fault_state) {
1739                 talloc_free(r);
1740                 /* Return true here, srv_pipe_hnd.c will take care */
1741                 return true;
1742         }
1743
1744         if (DEBUGLEVEL >= 10) {
1745                 NDR_PRINT_OUT_DEBUG(spoolss_AbortPrinter, r);
1746         }
1747
1748         push = ndr_push_init_ctx(r, NULL);
1749         if (push == NULL) {
1750                 talloc_free(r);
1751                 return false;
1752         }
1753
1754         ndr_err = call->ndr_push(push, NDR_OUT, r);
1755         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1756                 talloc_free(r);
1757                 return false;
1758         }
1759
1760         blob = ndr_push_blob(push);
1761         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1762                 talloc_free(r);
1763                 return false;
1764         }
1765
1766         talloc_free(r);
1767
1768         return true;
1769 }
1770
1771 static bool api_spoolss_ReadPrinter(pipes_struct *p)
1772 {
1773         const struct ndr_interface_call *call;
1774         struct ndr_pull *pull;
1775         struct ndr_push *push;
1776         enum ndr_err_code ndr_err;
1777         DATA_BLOB blob;
1778         struct spoolss_ReadPrinter *r;
1779
1780         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_READPRINTER];
1781
1782         r = talloc(talloc_tos(), struct spoolss_ReadPrinter);
1783         if (r == NULL) {
1784                 return false;
1785         }
1786
1787         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1788                 talloc_free(r);
1789                 return false;
1790         }
1791
1792         pull = ndr_pull_init_blob(&blob, r, NULL);
1793         if (pull == NULL) {
1794                 talloc_free(r);
1795                 return false;
1796         }
1797
1798         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1799         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1800         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1801                 talloc_free(r);
1802                 return false;
1803         }
1804
1805         if (DEBUGLEVEL >= 10) {
1806                 NDR_PRINT_IN_DEBUG(spoolss_ReadPrinter, r);
1807         }
1808
1809         ZERO_STRUCT(r->out);
1810         r->out.data = talloc_zero_array(r, uint8_t, r->in.data_size);
1811         if (r->out.data == NULL) {
1812                 talloc_free(r);
1813                 return false;
1814         }
1815
1816         r->out._data_size = talloc_zero(r, uint32_t);
1817         if (r->out._data_size == NULL) {
1818                 talloc_free(r);
1819                 return false;
1820         }
1821
1822         r->out.result = _spoolss_ReadPrinter(p, r);
1823
1824         if (p->rng_fault_state) {
1825                 talloc_free(r);
1826                 /* Return true here, srv_pipe_hnd.c will take care */
1827                 return true;
1828         }
1829
1830         if (DEBUGLEVEL >= 10) {
1831                 NDR_PRINT_OUT_DEBUG(spoolss_ReadPrinter, r);
1832         }
1833
1834         push = ndr_push_init_ctx(r, NULL);
1835         if (push == NULL) {
1836                 talloc_free(r);
1837                 return false;
1838         }
1839
1840         ndr_err = call->ndr_push(push, NDR_OUT, r);
1841         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1842                 talloc_free(r);
1843                 return false;
1844         }
1845
1846         blob = ndr_push_blob(push);
1847         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1848                 talloc_free(r);
1849                 return false;
1850         }
1851
1852         talloc_free(r);
1853
1854         return true;
1855 }
1856
1857 static bool api_spoolss_EndDocPrinter(pipes_struct *p)
1858 {
1859         const struct ndr_interface_call *call;
1860         struct ndr_pull *pull;
1861         struct ndr_push *push;
1862         enum ndr_err_code ndr_err;
1863         DATA_BLOB blob;
1864         struct spoolss_EndDocPrinter *r;
1865
1866         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENDDOCPRINTER];
1867
1868         r = talloc(talloc_tos(), struct spoolss_EndDocPrinter);
1869         if (r == NULL) {
1870                 return false;
1871         }
1872
1873         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1874                 talloc_free(r);
1875                 return false;
1876         }
1877
1878         pull = ndr_pull_init_blob(&blob, r, NULL);
1879         if (pull == NULL) {
1880                 talloc_free(r);
1881                 return false;
1882         }
1883
1884         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1885         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1886         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1887                 talloc_free(r);
1888                 return false;
1889         }
1890
1891         if (DEBUGLEVEL >= 10) {
1892                 NDR_PRINT_IN_DEBUG(spoolss_EndDocPrinter, r);
1893         }
1894
1895         r->out.result = _spoolss_EndDocPrinter(p, r);
1896
1897         if (p->rng_fault_state) {
1898                 talloc_free(r);
1899                 /* Return true here, srv_pipe_hnd.c will take care */
1900                 return true;
1901         }
1902
1903         if (DEBUGLEVEL >= 10) {
1904                 NDR_PRINT_OUT_DEBUG(spoolss_EndDocPrinter, r);
1905         }
1906
1907         push = ndr_push_init_ctx(r, NULL);
1908         if (push == NULL) {
1909                 talloc_free(r);
1910                 return false;
1911         }
1912
1913         ndr_err = call->ndr_push(push, NDR_OUT, r);
1914         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1915                 talloc_free(r);
1916                 return false;
1917         }
1918
1919         blob = ndr_push_blob(push);
1920         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1921                 talloc_free(r);
1922                 return false;
1923         }
1924
1925         talloc_free(r);
1926
1927         return true;
1928 }
1929
1930 static bool api_spoolss_AddJob(pipes_struct *p)
1931 {
1932         const struct ndr_interface_call *call;
1933         struct ndr_pull *pull;
1934         struct ndr_push *push;
1935         enum ndr_err_code ndr_err;
1936         DATA_BLOB blob;
1937         struct spoolss_AddJob *r;
1938
1939         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDJOB];
1940
1941         r = talloc(talloc_tos(), struct spoolss_AddJob);
1942         if (r == NULL) {
1943                 return false;
1944         }
1945
1946         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1947                 talloc_free(r);
1948                 return false;
1949         }
1950
1951         pull = ndr_pull_init_blob(&blob, r, NULL);
1952         if (pull == NULL) {
1953                 talloc_free(r);
1954                 return false;
1955         }
1956
1957         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1958         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1959         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1960                 talloc_free(r);
1961                 return false;
1962         }
1963
1964         if (DEBUGLEVEL >= 10) {
1965                 NDR_PRINT_IN_DEBUG(spoolss_AddJob, r);
1966         }
1967
1968         ZERO_STRUCT(r->out);
1969         r->out.buffer = r->in.buffer;
1970         r->out.needed = talloc_zero(r, uint32_t);
1971         if (r->out.needed == NULL) {
1972                 talloc_free(r);
1973                 return false;
1974         }
1975
1976         r->out.result = _spoolss_AddJob(p, r);
1977
1978         if (p->rng_fault_state) {
1979                 talloc_free(r);
1980                 /* Return true here, srv_pipe_hnd.c will take care */
1981                 return true;
1982         }
1983
1984         if (DEBUGLEVEL >= 10) {
1985                 NDR_PRINT_OUT_DEBUG(spoolss_AddJob, r);
1986         }
1987
1988         push = ndr_push_init_ctx(r, NULL);
1989         if (push == NULL) {
1990                 talloc_free(r);
1991                 return false;
1992         }
1993
1994         ndr_err = call->ndr_push(push, NDR_OUT, r);
1995         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1996                 talloc_free(r);
1997                 return false;
1998         }
1999
2000         blob = ndr_push_blob(push);
2001         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2002                 talloc_free(r);
2003                 return false;
2004         }
2005
2006         talloc_free(r);
2007
2008         return true;
2009 }
2010
2011 static bool api_spoolss_ScheduleJob(pipes_struct *p)
2012 {
2013         const struct ndr_interface_call *call;
2014         struct ndr_pull *pull;
2015         struct ndr_push *push;
2016         enum ndr_err_code ndr_err;
2017         DATA_BLOB blob;
2018         struct spoolss_ScheduleJob *r;
2019
2020         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SCHEDULEJOB];
2021
2022         r = talloc(talloc_tos(), struct spoolss_ScheduleJob);
2023         if (r == NULL) {
2024                 return false;
2025         }
2026
2027         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2028                 talloc_free(r);
2029                 return false;
2030         }
2031
2032         pull = ndr_pull_init_blob(&blob, r, NULL);
2033         if (pull == NULL) {
2034                 talloc_free(r);
2035                 return false;
2036         }
2037
2038         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2039         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2040         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2041                 talloc_free(r);
2042                 return false;
2043         }
2044
2045         if (DEBUGLEVEL >= 10) {
2046                 NDR_PRINT_IN_DEBUG(spoolss_ScheduleJob, r);
2047         }
2048
2049         r->out.result = _spoolss_ScheduleJob(p, r);
2050
2051         if (p->rng_fault_state) {
2052                 talloc_free(r);
2053                 /* Return true here, srv_pipe_hnd.c will take care */
2054                 return true;
2055         }
2056
2057         if (DEBUGLEVEL >= 10) {
2058                 NDR_PRINT_OUT_DEBUG(spoolss_ScheduleJob, r);
2059         }
2060
2061         push = ndr_push_init_ctx(r, NULL);
2062         if (push == NULL) {
2063                 talloc_free(r);
2064                 return false;
2065         }
2066
2067         ndr_err = call->ndr_push(push, NDR_OUT, r);
2068         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2069                 talloc_free(r);
2070                 return false;
2071         }
2072
2073         blob = ndr_push_blob(push);
2074         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2075                 talloc_free(r);
2076                 return false;
2077         }
2078
2079         talloc_free(r);
2080
2081         return true;
2082 }
2083
2084 static bool api_spoolss_GetPrinterData(pipes_struct *p)
2085 {
2086         const struct ndr_interface_call *call;
2087         struct ndr_pull *pull;
2088         struct ndr_push *push;
2089         enum ndr_err_code ndr_err;
2090         DATA_BLOB blob;
2091         struct spoolss_GetPrinterData *r;
2092
2093         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATA];
2094
2095         r = talloc(talloc_tos(), struct spoolss_GetPrinterData);
2096         if (r == NULL) {
2097                 return false;
2098         }
2099
2100         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2101                 talloc_free(r);
2102                 return false;
2103         }
2104
2105         pull = ndr_pull_init_blob(&blob, r, NULL);
2106         if (pull == NULL) {
2107                 talloc_free(r);
2108                 return false;
2109         }
2110
2111         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2112         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2113         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2114                 talloc_free(r);
2115                 return false;
2116         }
2117
2118         if (DEBUGLEVEL >= 10) {
2119                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterData, r);
2120         }
2121
2122         ZERO_STRUCT(r->out);
2123         r->out.type = talloc_zero(r, enum winreg_Type);
2124         if (r->out.type == NULL) {
2125                 talloc_free(r);
2126                 return false;
2127         }
2128
2129         r->out.data = talloc_zero(r, union spoolss_PrinterData);
2130         if (r->out.data == NULL) {
2131                 talloc_free(r);
2132                 return false;
2133         }
2134
2135         r->out.needed = talloc_zero(r, uint32_t);
2136         if (r->out.needed == NULL) {
2137                 talloc_free(r);
2138                 return false;
2139         }
2140
2141         r->out.result = _spoolss_GetPrinterData(p, r);
2142
2143         if (p->rng_fault_state) {
2144                 talloc_free(r);
2145                 /* Return true here, srv_pipe_hnd.c will take care */
2146                 return true;
2147         }
2148
2149         if (DEBUGLEVEL >= 10) {
2150                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterData, r);
2151         }
2152
2153         push = ndr_push_init_ctx(r, NULL);
2154         if (push == NULL) {
2155                 talloc_free(r);
2156                 return false;
2157         }
2158
2159         ndr_err = call->ndr_push(push, NDR_OUT, r);
2160         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2161                 talloc_free(r);
2162                 return false;
2163         }
2164
2165         blob = ndr_push_blob(push);
2166         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2167                 talloc_free(r);
2168                 return false;
2169         }
2170
2171         talloc_free(r);
2172
2173         return true;
2174 }
2175
2176 static bool api_spoolss_SetPrinterData(pipes_struct *p)
2177 {
2178         const struct ndr_interface_call *call;
2179         struct ndr_pull *pull;
2180         struct ndr_push *push;
2181         enum ndr_err_code ndr_err;
2182         DATA_BLOB blob;
2183         struct spoolss_SetPrinterData *r;
2184
2185         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATA];
2186
2187         r = talloc(talloc_tos(), struct spoolss_SetPrinterData);
2188         if (r == NULL) {
2189                 return false;
2190         }
2191
2192         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2193                 talloc_free(r);
2194                 return false;
2195         }
2196
2197         pull = ndr_pull_init_blob(&blob, r, NULL);
2198         if (pull == NULL) {
2199                 talloc_free(r);
2200                 return false;
2201         }
2202
2203         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2204         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2205         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2206                 talloc_free(r);
2207                 return false;
2208         }
2209
2210         if (DEBUGLEVEL >= 10) {
2211                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterData, r);
2212         }
2213
2214         r->out.result = _spoolss_SetPrinterData(p, r);
2215
2216         if (p->rng_fault_state) {
2217                 talloc_free(r);
2218                 /* Return true here, srv_pipe_hnd.c will take care */
2219                 return true;
2220         }
2221
2222         if (DEBUGLEVEL >= 10) {
2223                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterData, r);
2224         }
2225
2226         push = ndr_push_init_ctx(r, NULL);
2227         if (push == NULL) {
2228                 talloc_free(r);
2229                 return false;
2230         }
2231
2232         ndr_err = call->ndr_push(push, NDR_OUT, r);
2233         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2234                 talloc_free(r);
2235                 return false;
2236         }
2237
2238         blob = ndr_push_blob(push);
2239         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2240                 talloc_free(r);
2241                 return false;
2242         }
2243
2244         talloc_free(r);
2245
2246         return true;
2247 }
2248
2249 static bool api_spoolss_WaitForPrinterChange(pipes_struct *p)
2250 {
2251         const struct ndr_interface_call *call;
2252         struct ndr_pull *pull;
2253         struct ndr_push *push;
2254         enum ndr_err_code ndr_err;
2255         DATA_BLOB blob;
2256         struct spoolss_WaitForPrinterChange *r;
2257
2258         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_WAITFORPRINTERCHANGE];
2259
2260         r = talloc(talloc_tos(), struct spoolss_WaitForPrinterChange);
2261         if (r == NULL) {
2262                 return false;
2263         }
2264
2265         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2266                 talloc_free(r);
2267                 return false;
2268         }
2269
2270         pull = ndr_pull_init_blob(&blob, r, NULL);
2271         if (pull == NULL) {
2272                 talloc_free(r);
2273                 return false;
2274         }
2275
2276         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2277         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2278         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2279                 talloc_free(r);
2280                 return false;
2281         }
2282
2283         if (DEBUGLEVEL >= 10) {
2284                 NDR_PRINT_IN_DEBUG(spoolss_WaitForPrinterChange, r);
2285         }
2286
2287         r->out.result = _spoolss_WaitForPrinterChange(p, r);
2288
2289         if (p->rng_fault_state) {
2290                 talloc_free(r);
2291                 /* Return true here, srv_pipe_hnd.c will take care */
2292                 return true;
2293         }
2294
2295         if (DEBUGLEVEL >= 10) {
2296                 NDR_PRINT_OUT_DEBUG(spoolss_WaitForPrinterChange, r);
2297         }
2298
2299         push = ndr_push_init_ctx(r, NULL);
2300         if (push == NULL) {
2301                 talloc_free(r);
2302                 return false;
2303         }
2304
2305         ndr_err = call->ndr_push(push, NDR_OUT, r);
2306         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2307                 talloc_free(r);
2308                 return false;
2309         }
2310
2311         blob = ndr_push_blob(push);
2312         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2313                 talloc_free(r);
2314                 return false;
2315         }
2316
2317         talloc_free(r);
2318
2319         return true;
2320 }
2321
2322 static bool api_spoolss_ClosePrinter(pipes_struct *p)
2323 {
2324         const struct ndr_interface_call *call;
2325         struct ndr_pull *pull;
2326         struct ndr_push *push;
2327         enum ndr_err_code ndr_err;
2328         DATA_BLOB blob;
2329         struct spoolss_ClosePrinter *r;
2330
2331         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CLOSEPRINTER];
2332
2333         r = talloc(talloc_tos(), struct spoolss_ClosePrinter);
2334         if (r == NULL) {
2335                 return false;
2336         }
2337
2338         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2339                 talloc_free(r);
2340                 return false;
2341         }
2342
2343         pull = ndr_pull_init_blob(&blob, r, NULL);
2344         if (pull == NULL) {
2345                 talloc_free(r);
2346                 return false;
2347         }
2348
2349         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2350         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2351         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2352                 talloc_free(r);
2353                 return false;
2354         }
2355
2356         if (DEBUGLEVEL >= 10) {
2357                 NDR_PRINT_IN_DEBUG(spoolss_ClosePrinter, r);
2358         }
2359
2360         ZERO_STRUCT(r->out);
2361         r->out.handle = r->in.handle;
2362         r->out.result = _spoolss_ClosePrinter(p, r);
2363
2364         if (p->rng_fault_state) {
2365                 talloc_free(r);
2366                 /* Return true here, srv_pipe_hnd.c will take care */
2367                 return true;
2368         }
2369
2370         if (DEBUGLEVEL >= 10) {
2371                 NDR_PRINT_OUT_DEBUG(spoolss_ClosePrinter, r);
2372         }
2373
2374         push = ndr_push_init_ctx(r, NULL);
2375         if (push == NULL) {
2376                 talloc_free(r);
2377                 return false;
2378         }
2379
2380         ndr_err = call->ndr_push(push, NDR_OUT, r);
2381         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2382                 talloc_free(r);
2383                 return false;
2384         }
2385
2386         blob = ndr_push_blob(push);
2387         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2388                 talloc_free(r);
2389                 return false;
2390         }
2391
2392         talloc_free(r);
2393
2394         return true;
2395 }
2396
2397 static bool api_spoolss_AddForm(pipes_struct *p)
2398 {
2399         const struct ndr_interface_call *call;
2400         struct ndr_pull *pull;
2401         struct ndr_push *push;
2402         enum ndr_err_code ndr_err;
2403         DATA_BLOB blob;
2404         struct spoolss_AddForm *r;
2405
2406         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDFORM];
2407
2408         r = talloc(talloc_tos(), struct spoolss_AddForm);
2409         if (r == NULL) {
2410                 return false;
2411         }
2412
2413         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2414                 talloc_free(r);
2415                 return false;
2416         }
2417
2418         pull = ndr_pull_init_blob(&blob, r, NULL);
2419         if (pull == NULL) {
2420                 talloc_free(r);
2421                 return false;
2422         }
2423
2424         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2425         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2426         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2427                 talloc_free(r);
2428                 return false;
2429         }
2430
2431         if (DEBUGLEVEL >= 10) {
2432                 NDR_PRINT_IN_DEBUG(spoolss_AddForm, r);
2433         }
2434
2435         r->out.result = _spoolss_AddForm(p, r);
2436
2437         if (p->rng_fault_state) {
2438                 talloc_free(r);
2439                 /* Return true here, srv_pipe_hnd.c will take care */
2440                 return true;
2441         }
2442
2443         if (DEBUGLEVEL >= 10) {
2444                 NDR_PRINT_OUT_DEBUG(spoolss_AddForm, r);
2445         }
2446
2447         push = ndr_push_init_ctx(r, NULL);
2448         if (push == NULL) {
2449                 talloc_free(r);
2450                 return false;
2451         }
2452
2453         ndr_err = call->ndr_push(push, NDR_OUT, r);
2454         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2455                 talloc_free(r);
2456                 return false;
2457         }
2458
2459         blob = ndr_push_blob(push);
2460         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2461                 talloc_free(r);
2462                 return false;
2463         }
2464
2465         talloc_free(r);
2466
2467         return true;
2468 }
2469
2470 static bool api_spoolss_DeleteForm(pipes_struct *p)
2471 {
2472         const struct ndr_interface_call *call;
2473         struct ndr_pull *pull;
2474         struct ndr_push *push;
2475         enum ndr_err_code ndr_err;
2476         DATA_BLOB blob;
2477         struct spoolss_DeleteForm *r;
2478
2479         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEFORM];
2480
2481         r = talloc(talloc_tos(), struct spoolss_DeleteForm);
2482         if (r == NULL) {
2483                 return false;
2484         }
2485
2486         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2487                 talloc_free(r);
2488                 return false;
2489         }
2490
2491         pull = ndr_pull_init_blob(&blob, r, NULL);
2492         if (pull == NULL) {
2493                 talloc_free(r);
2494                 return false;
2495         }
2496
2497         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2498         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2499         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2500                 talloc_free(r);
2501                 return false;
2502         }
2503
2504         if (DEBUGLEVEL >= 10) {
2505                 NDR_PRINT_IN_DEBUG(spoolss_DeleteForm, r);
2506         }
2507
2508         r->out.result = _spoolss_DeleteForm(p, r);
2509
2510         if (p->rng_fault_state) {
2511                 talloc_free(r);
2512                 /* Return true here, srv_pipe_hnd.c will take care */
2513                 return true;
2514         }
2515
2516         if (DEBUGLEVEL >= 10) {
2517                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteForm, r);
2518         }
2519
2520         push = ndr_push_init_ctx(r, NULL);
2521         if (push == NULL) {
2522                 talloc_free(r);
2523                 return false;
2524         }
2525
2526         ndr_err = call->ndr_push(push, NDR_OUT, r);
2527         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2528                 talloc_free(r);
2529                 return false;
2530         }
2531
2532         blob = ndr_push_blob(push);
2533         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2534                 talloc_free(r);
2535                 return false;
2536         }
2537
2538         talloc_free(r);
2539
2540         return true;
2541 }
2542
2543 static bool api_spoolss_GetForm(pipes_struct *p)
2544 {
2545         const struct ndr_interface_call *call;
2546         struct ndr_pull *pull;
2547         struct ndr_push *push;
2548         enum ndr_err_code ndr_err;
2549         DATA_BLOB blob;
2550         struct spoolss_GetForm *r;
2551
2552         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETFORM];
2553
2554         r = talloc(talloc_tos(), struct spoolss_GetForm);
2555         if (r == NULL) {
2556                 return false;
2557         }
2558
2559         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2560                 talloc_free(r);
2561                 return false;
2562         }
2563
2564         pull = ndr_pull_init_blob(&blob, r, NULL);
2565         if (pull == NULL) {
2566                 talloc_free(r);
2567                 return false;
2568         }
2569
2570         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2571         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2572         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2573                 talloc_free(r);
2574                 return false;
2575         }
2576
2577         if (DEBUGLEVEL >= 10) {
2578                 NDR_PRINT_IN_DEBUG(spoolss_GetForm, r);
2579         }
2580
2581         ZERO_STRUCT(r->out);
2582         r->out.info = talloc_zero(r, union spoolss_FormInfo);
2583         if (r->out.info == NULL) {
2584                 talloc_free(r);
2585                 return false;
2586         }
2587
2588         r->out.needed = talloc_zero(r, uint32_t);
2589         if (r->out.needed == NULL) {
2590                 talloc_free(r);
2591                 return false;
2592         }
2593
2594         r->out.result = _spoolss_GetForm(p, r);
2595
2596         if (p->rng_fault_state) {
2597                 talloc_free(r);
2598                 /* Return true here, srv_pipe_hnd.c will take care */
2599                 return true;
2600         }
2601
2602         if (DEBUGLEVEL >= 10) {
2603                 NDR_PRINT_OUT_DEBUG(spoolss_GetForm, r);
2604         }
2605
2606         push = ndr_push_init_ctx(r, NULL);
2607         if (push == NULL) {
2608                 talloc_free(r);
2609                 return false;
2610         }
2611
2612         ndr_err = call->ndr_push(push, NDR_OUT, r);
2613         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2614                 talloc_free(r);
2615                 return false;
2616         }
2617
2618         blob = ndr_push_blob(push);
2619         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2620                 talloc_free(r);
2621                 return false;
2622         }
2623
2624         talloc_free(r);
2625
2626         return true;
2627 }
2628
2629 static bool api_spoolss_SetForm(pipes_struct *p)
2630 {
2631         const struct ndr_interface_call *call;
2632         struct ndr_pull *pull;
2633         struct ndr_push *push;
2634         enum ndr_err_code ndr_err;
2635         DATA_BLOB blob;
2636         struct spoolss_SetForm *r;
2637
2638         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETFORM];
2639
2640         r = talloc(talloc_tos(), struct spoolss_SetForm);
2641         if (r == NULL) {
2642                 return false;
2643         }
2644
2645         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2646                 talloc_free(r);
2647                 return false;
2648         }
2649
2650         pull = ndr_pull_init_blob(&blob, r, NULL);
2651         if (pull == NULL) {
2652                 talloc_free(r);
2653                 return false;
2654         }
2655
2656         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2657         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2658         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2659                 talloc_free(r);
2660                 return false;
2661         }
2662
2663         if (DEBUGLEVEL >= 10) {
2664                 NDR_PRINT_IN_DEBUG(spoolss_SetForm, r);
2665         }
2666
2667         r->out.result = _spoolss_SetForm(p, r);
2668
2669         if (p->rng_fault_state) {
2670                 talloc_free(r);
2671                 /* Return true here, srv_pipe_hnd.c will take care */
2672                 return true;
2673         }
2674
2675         if (DEBUGLEVEL >= 10) {
2676                 NDR_PRINT_OUT_DEBUG(spoolss_SetForm, r);
2677         }
2678
2679         push = ndr_push_init_ctx(r, NULL);
2680         if (push == NULL) {
2681                 talloc_free(r);
2682                 return false;
2683         }
2684
2685         ndr_err = call->ndr_push(push, NDR_OUT, r);
2686         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2687                 talloc_free(r);
2688                 return false;
2689         }
2690
2691         blob = ndr_push_blob(push);
2692         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2693                 talloc_free(r);
2694                 return false;
2695         }
2696
2697         talloc_free(r);
2698
2699         return true;
2700 }
2701
2702 static bool api_spoolss_EnumForms(pipes_struct *p)
2703 {
2704         const struct ndr_interface_call *call;
2705         struct ndr_pull *pull;
2706         struct ndr_push *push;
2707         enum ndr_err_code ndr_err;
2708         DATA_BLOB blob;
2709         struct spoolss_EnumForms *r;
2710
2711         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMFORMS];
2712
2713         r = talloc(talloc_tos(), struct spoolss_EnumForms);
2714         if (r == NULL) {
2715                 return false;
2716         }
2717
2718         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2719                 talloc_free(r);
2720                 return false;
2721         }
2722
2723         pull = ndr_pull_init_blob(&blob, r, NULL);
2724         if (pull == NULL) {
2725                 talloc_free(r);
2726                 return false;
2727         }
2728
2729         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2730         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2731         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2732                 talloc_free(r);
2733                 return false;
2734         }
2735
2736         if (DEBUGLEVEL >= 10) {
2737                 NDR_PRINT_IN_DEBUG(spoolss_EnumForms, r);
2738         }
2739
2740         ZERO_STRUCT(r->out);
2741         r->out.count = talloc_zero(r, uint32_t);
2742         if (r->out.count == NULL) {
2743                 talloc_free(r);
2744                 return false;
2745         }
2746
2747         r->out.info = talloc_zero(r, union spoolss_FormInfo *);
2748         if (r->out.info == NULL) {
2749                 talloc_free(r);
2750                 return false;
2751         }
2752
2753         r->out.needed = talloc_zero(r, uint32_t);
2754         if (r->out.needed == NULL) {
2755                 talloc_free(r);
2756                 return false;
2757         }
2758
2759         r->out.result = _spoolss_EnumForms(p, r);
2760
2761         if (p->rng_fault_state) {
2762                 talloc_free(r);
2763                 /* Return true here, srv_pipe_hnd.c will take care */
2764                 return true;
2765         }
2766
2767         if (DEBUGLEVEL >= 10) {
2768                 NDR_PRINT_OUT_DEBUG(spoolss_EnumForms, r);
2769         }
2770
2771         push = ndr_push_init_ctx(r, NULL);
2772         if (push == NULL) {
2773                 talloc_free(r);
2774                 return false;
2775         }
2776
2777         ndr_err = call->ndr_push(push, NDR_OUT, r);
2778         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2779                 talloc_free(r);
2780                 return false;
2781         }
2782
2783         blob = ndr_push_blob(push);
2784         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2785                 talloc_free(r);
2786                 return false;
2787         }
2788
2789         talloc_free(r);
2790
2791         return true;
2792 }
2793
2794 static bool api_spoolss_EnumPorts(pipes_struct *p)
2795 {
2796         const struct ndr_interface_call *call;
2797         struct ndr_pull *pull;
2798         struct ndr_push *push;
2799         enum ndr_err_code ndr_err;
2800         DATA_BLOB blob;
2801         struct spoolss_EnumPorts *r;
2802
2803         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPORTS];
2804
2805         r = talloc(talloc_tos(), struct spoolss_EnumPorts);
2806         if (r == NULL) {
2807                 return false;
2808         }
2809
2810         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2811                 talloc_free(r);
2812                 return false;
2813         }
2814
2815         pull = ndr_pull_init_blob(&blob, r, NULL);
2816         if (pull == NULL) {
2817                 talloc_free(r);
2818                 return false;
2819         }
2820
2821         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2822         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2823         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2824                 talloc_free(r);
2825                 return false;
2826         }
2827
2828         if (DEBUGLEVEL >= 10) {
2829                 NDR_PRINT_IN_DEBUG(spoolss_EnumPorts, r);
2830         }
2831
2832         ZERO_STRUCT(r->out);
2833         r->out.count = talloc_zero(r, uint32_t);
2834         if (r->out.count == NULL) {
2835                 talloc_free(r);
2836                 return false;
2837         }
2838
2839         r->out.info = talloc_zero(r, union spoolss_PortInfo *);
2840         if (r->out.info == NULL) {
2841                 talloc_free(r);
2842                 return false;
2843         }
2844
2845         r->out.needed = talloc_zero(r, uint32_t);
2846         if (r->out.needed == NULL) {
2847                 talloc_free(r);
2848                 return false;
2849         }
2850
2851         r->out.result = _spoolss_EnumPorts(p, r);
2852
2853         if (p->rng_fault_state) {
2854                 talloc_free(r);
2855                 /* Return true here, srv_pipe_hnd.c will take care */
2856                 return true;
2857         }
2858
2859         if (DEBUGLEVEL >= 10) {
2860                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPorts, r);
2861         }
2862
2863         push = ndr_push_init_ctx(r, NULL);
2864         if (push == NULL) {
2865                 talloc_free(r);
2866                 return false;
2867         }
2868
2869         ndr_err = call->ndr_push(push, NDR_OUT, r);
2870         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2871                 talloc_free(r);
2872                 return false;
2873         }
2874
2875         blob = ndr_push_blob(push);
2876         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2877                 talloc_free(r);
2878                 return false;
2879         }
2880
2881         talloc_free(r);
2882
2883         return true;
2884 }
2885
2886 static bool api_spoolss_EnumMonitors(pipes_struct *p)
2887 {
2888         const struct ndr_interface_call *call;
2889         struct ndr_pull *pull;
2890         struct ndr_push *push;
2891         enum ndr_err_code ndr_err;
2892         DATA_BLOB blob;
2893         struct spoolss_EnumMonitors *r;
2894
2895         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMMONITORS];
2896
2897         r = talloc(talloc_tos(), struct spoolss_EnumMonitors);
2898         if (r == NULL) {
2899                 return false;
2900         }
2901
2902         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2903                 talloc_free(r);
2904                 return false;
2905         }
2906
2907         pull = ndr_pull_init_blob(&blob, r, NULL);
2908         if (pull == NULL) {
2909                 talloc_free(r);
2910                 return false;
2911         }
2912
2913         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2914         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2915         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2916                 talloc_free(r);
2917                 return false;
2918         }
2919
2920         if (DEBUGLEVEL >= 10) {
2921                 NDR_PRINT_IN_DEBUG(spoolss_EnumMonitors, r);
2922         }
2923
2924         ZERO_STRUCT(r->out);
2925         r->out.count = talloc_zero(r, uint32_t);
2926         if (r->out.count == NULL) {
2927                 talloc_free(r);
2928                 return false;
2929         }
2930
2931         r->out.info = talloc_zero(r, union spoolss_MonitorInfo *);
2932         if (r->out.info == NULL) {
2933                 talloc_free(r);
2934                 return false;
2935         }
2936
2937         r->out.needed = talloc_zero(r, uint32_t);
2938         if (r->out.needed == NULL) {
2939                 talloc_free(r);
2940                 return false;
2941         }
2942
2943         r->out.result = _spoolss_EnumMonitors(p, r);
2944
2945         if (p->rng_fault_state) {
2946                 talloc_free(r);
2947                 /* Return true here, srv_pipe_hnd.c will take care */
2948                 return true;
2949         }
2950
2951         if (DEBUGLEVEL >= 10) {
2952                 NDR_PRINT_OUT_DEBUG(spoolss_EnumMonitors, r);
2953         }
2954
2955         push = ndr_push_init_ctx(r, NULL);
2956         if (push == NULL) {
2957                 talloc_free(r);
2958                 return false;
2959         }
2960
2961         ndr_err = call->ndr_push(push, NDR_OUT, r);
2962         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2963                 talloc_free(r);
2964                 return false;
2965         }
2966
2967         blob = ndr_push_blob(push);
2968         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2969                 talloc_free(r);
2970                 return false;
2971         }
2972
2973         talloc_free(r);
2974
2975         return true;
2976 }
2977
2978 static bool api_spoolss_AddPort(pipes_struct *p)
2979 {
2980         const struct ndr_interface_call *call;
2981         struct ndr_pull *pull;
2982         struct ndr_push *push;
2983         enum ndr_err_code ndr_err;
2984         DATA_BLOB blob;
2985         struct spoolss_AddPort *r;
2986
2987         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORT];
2988
2989         r = talloc(talloc_tos(), struct spoolss_AddPort);
2990         if (r == NULL) {
2991                 return false;
2992         }
2993
2994         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2995                 talloc_free(r);
2996                 return false;
2997         }
2998
2999         pull = ndr_pull_init_blob(&blob, r, NULL);
3000         if (pull == NULL) {
3001                 talloc_free(r);
3002                 return false;
3003         }
3004
3005         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3006         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3007         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3008                 talloc_free(r);
3009                 return false;
3010         }
3011
3012         if (DEBUGLEVEL >= 10) {
3013                 NDR_PRINT_IN_DEBUG(spoolss_AddPort, r);
3014         }
3015
3016         r->out.result = _spoolss_AddPort(p, r);
3017
3018         if (p->rng_fault_state) {
3019                 talloc_free(r);
3020                 /* Return true here, srv_pipe_hnd.c will take care */
3021                 return true;
3022         }
3023
3024         if (DEBUGLEVEL >= 10) {
3025                 NDR_PRINT_OUT_DEBUG(spoolss_AddPort, r);
3026         }
3027
3028         push = ndr_push_init_ctx(r, NULL);
3029         if (push == NULL) {
3030                 talloc_free(r);
3031                 return false;
3032         }
3033
3034         ndr_err = call->ndr_push(push, NDR_OUT, r);
3035         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3036                 talloc_free(r);
3037                 return false;
3038         }
3039
3040         blob = ndr_push_blob(push);
3041         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3042                 talloc_free(r);
3043                 return false;
3044         }
3045
3046         talloc_free(r);
3047
3048         return true;
3049 }
3050
3051 static bool api_spoolss_ConfigurePort(pipes_struct *p)
3052 {
3053         const struct ndr_interface_call *call;
3054         struct ndr_pull *pull;
3055         struct ndr_push *push;
3056         enum ndr_err_code ndr_err;
3057         DATA_BLOB blob;
3058         struct spoolss_ConfigurePort *r;
3059
3060         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CONFIGUREPORT];
3061
3062         r = talloc(talloc_tos(), struct spoolss_ConfigurePort);
3063         if (r == NULL) {
3064                 return false;
3065         }
3066
3067         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3068                 talloc_free(r);
3069                 return false;
3070         }
3071
3072         pull = ndr_pull_init_blob(&blob, r, NULL);
3073         if (pull == NULL) {
3074                 talloc_free(r);
3075                 return false;
3076         }
3077
3078         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3079         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3080         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3081                 talloc_free(r);
3082                 return false;
3083         }
3084
3085         if (DEBUGLEVEL >= 10) {
3086                 NDR_PRINT_IN_DEBUG(spoolss_ConfigurePort, r);
3087         }
3088
3089         r->out.result = _spoolss_ConfigurePort(p, r);
3090
3091         if (p->rng_fault_state) {
3092                 talloc_free(r);
3093                 /* Return true here, srv_pipe_hnd.c will take care */
3094                 return true;
3095         }
3096
3097         if (DEBUGLEVEL >= 10) {
3098                 NDR_PRINT_OUT_DEBUG(spoolss_ConfigurePort, r);
3099         }
3100
3101         push = ndr_push_init_ctx(r, NULL);
3102         if (push == NULL) {
3103                 talloc_free(r);
3104                 return false;
3105         }
3106
3107         ndr_err = call->ndr_push(push, NDR_OUT, r);
3108         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3109                 talloc_free(r);
3110                 return false;
3111         }
3112
3113         blob = ndr_push_blob(push);
3114         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3115                 talloc_free(r);
3116                 return false;
3117         }
3118
3119         talloc_free(r);
3120
3121         return true;
3122 }
3123
3124 static bool api_spoolss_DeletePort(pipes_struct *p)
3125 {
3126         const struct ndr_interface_call *call;
3127         struct ndr_pull *pull;
3128         struct ndr_push *push;
3129         enum ndr_err_code ndr_err;
3130         DATA_BLOB blob;
3131         struct spoolss_DeletePort *r;
3132
3133         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPORT];
3134
3135         r = talloc(talloc_tos(), struct spoolss_DeletePort);
3136         if (r == NULL) {
3137                 return false;
3138         }
3139
3140         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3141                 talloc_free(r);
3142                 return false;
3143         }
3144
3145         pull = ndr_pull_init_blob(&blob, r, NULL);
3146         if (pull == NULL) {
3147                 talloc_free(r);
3148                 return false;
3149         }
3150
3151         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3152         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3153         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3154                 talloc_free(r);
3155                 return false;
3156         }
3157
3158         if (DEBUGLEVEL >= 10) {
3159                 NDR_PRINT_IN_DEBUG(spoolss_DeletePort, r);
3160         }
3161
3162         r->out.result = _spoolss_DeletePort(p, r);
3163
3164         if (p->rng_fault_state) {
3165                 talloc_free(r);
3166                 /* Return true here, srv_pipe_hnd.c will take care */
3167                 return true;
3168         }
3169
3170         if (DEBUGLEVEL >= 10) {
3171                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePort, r);
3172         }
3173
3174         push = ndr_push_init_ctx(r, NULL);
3175         if (push == NULL) {
3176                 talloc_free(r);
3177                 return false;
3178         }
3179
3180         ndr_err = call->ndr_push(push, NDR_OUT, r);
3181         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3182                 talloc_free(r);
3183                 return false;
3184         }
3185
3186         blob = ndr_push_blob(push);
3187         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3188                 talloc_free(r);
3189                 return false;
3190         }
3191
3192         talloc_free(r);
3193
3194         return true;
3195 }
3196
3197 static bool api_spoolss_CreatePrinterIC(pipes_struct *p)
3198 {
3199         const struct ndr_interface_call *call;
3200         struct ndr_pull *pull;
3201         struct ndr_push *push;
3202         enum ndr_err_code ndr_err;
3203         DATA_BLOB blob;
3204         struct spoolss_CreatePrinterIC *r;
3205
3206         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CREATEPRINTERIC];
3207
3208         r = talloc(talloc_tos(), struct spoolss_CreatePrinterIC);
3209         if (r == NULL) {
3210                 return false;
3211         }
3212
3213         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3214                 talloc_free(r);
3215                 return false;
3216         }
3217
3218         pull = ndr_pull_init_blob(&blob, r, NULL);
3219         if (pull == NULL) {
3220                 talloc_free(r);
3221                 return false;
3222         }
3223
3224         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3225         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3226         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3227                 talloc_free(r);
3228                 return false;
3229         }
3230
3231         if (DEBUGLEVEL >= 10) {
3232                 NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, r);
3233         }
3234
3235         r->out.result = _spoolss_CreatePrinterIC(p, r);
3236
3237         if (p->rng_fault_state) {
3238                 talloc_free(r);
3239                 /* Return true here, srv_pipe_hnd.c will take care */
3240                 return true;
3241         }
3242
3243         if (DEBUGLEVEL >= 10) {
3244                 NDR_PRINT_OUT_DEBUG(spoolss_CreatePrinterIC, r);
3245         }
3246
3247         push = ndr_push_init_ctx(r, NULL);
3248         if (push == NULL) {
3249                 talloc_free(r);
3250                 return false;
3251         }
3252
3253         ndr_err = call->ndr_push(push, NDR_OUT, r);
3254         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3255                 talloc_free(r);
3256                 return false;
3257         }
3258
3259         blob = ndr_push_blob(push);
3260         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3261                 talloc_free(r);
3262                 return false;
3263         }
3264
3265         talloc_free(r);
3266
3267         return true;
3268 }
3269
3270 static bool api_spoolss_PlayGDIScriptOnPrinterIC(pipes_struct *p)
3271 {
3272         const struct ndr_interface_call *call;
3273         struct ndr_pull *pull;
3274         struct ndr_push *push;
3275         enum ndr_err_code ndr_err;
3276         DATA_BLOB blob;
3277         struct spoolss_PlayGDIScriptOnPrinterIC *r;
3278
3279         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC];
3280
3281         r = talloc(talloc_tos(), struct spoolss_PlayGDIScriptOnPrinterIC);
3282         if (r == NULL) {
3283                 return false;
3284         }
3285
3286         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3287                 talloc_free(r);
3288                 return false;
3289         }
3290
3291         pull = ndr_pull_init_blob(&blob, r, NULL);
3292         if (pull == NULL) {
3293                 talloc_free(r);
3294                 return false;
3295         }
3296
3297         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3298         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3299         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3300                 talloc_free(r);
3301                 return false;
3302         }
3303
3304         if (DEBUGLEVEL >= 10) {
3305                 NDR_PRINT_IN_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3306         }
3307
3308         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(p, r);
3309
3310         if (p->rng_fault_state) {
3311                 talloc_free(r);
3312                 /* Return true here, srv_pipe_hnd.c will take care */
3313                 return true;
3314         }
3315
3316         if (DEBUGLEVEL >= 10) {
3317                 NDR_PRINT_OUT_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3318         }
3319
3320         push = ndr_push_init_ctx(r, NULL);
3321         if (push == NULL) {
3322                 talloc_free(r);
3323                 return false;
3324         }
3325
3326         ndr_err = call->ndr_push(push, NDR_OUT, r);
3327         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3328                 talloc_free(r);
3329                 return false;
3330         }
3331
3332         blob = ndr_push_blob(push);
3333         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3334                 talloc_free(r);
3335                 return false;
3336         }
3337
3338         talloc_free(r);
3339
3340         return true;
3341 }
3342
3343 static bool api_spoolss_DeletePrinterIC(pipes_struct *p)
3344 {
3345         const struct ndr_interface_call *call;
3346         struct ndr_pull *pull;
3347         struct ndr_push *push;
3348         enum ndr_err_code ndr_err;
3349         DATA_BLOB blob;
3350         struct spoolss_DeletePrinterIC *r;
3351
3352         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERIC];
3353
3354         r = talloc(talloc_tos(), struct spoolss_DeletePrinterIC);
3355         if (r == NULL) {
3356                 return false;
3357         }
3358
3359         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3360                 talloc_free(r);
3361                 return false;
3362         }
3363
3364         pull = ndr_pull_init_blob(&blob, r, NULL);
3365         if (pull == NULL) {
3366                 talloc_free(r);
3367                 return false;
3368         }
3369
3370         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3371         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3372         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3373                 talloc_free(r);
3374                 return false;
3375         }
3376
3377         if (DEBUGLEVEL >= 10) {
3378                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, r);
3379         }
3380
3381         r->out.result = _spoolss_DeletePrinterIC(p, r);
3382
3383         if (p->rng_fault_state) {
3384                 talloc_free(r);
3385                 /* Return true here, srv_pipe_hnd.c will take care */
3386                 return true;
3387         }
3388
3389         if (DEBUGLEVEL >= 10) {
3390                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterIC, r);
3391         }
3392
3393         push = ndr_push_init_ctx(r, NULL);
3394         if (push == NULL) {
3395                 talloc_free(r);
3396                 return false;
3397         }
3398
3399         ndr_err = call->ndr_push(push, NDR_OUT, r);
3400         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3401                 talloc_free(r);
3402                 return false;
3403         }
3404
3405         blob = ndr_push_blob(push);
3406         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3407                 talloc_free(r);
3408                 return false;
3409         }
3410
3411         talloc_free(r);
3412
3413         return true;
3414 }
3415
3416 static bool api_spoolss_AddPrinterConnection(pipes_struct *p)
3417 {
3418         const struct ndr_interface_call *call;
3419         struct ndr_pull *pull;
3420         struct ndr_push *push;
3421         enum ndr_err_code ndr_err;
3422         DATA_BLOB blob;
3423         struct spoolss_AddPrinterConnection *r;
3424
3425         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERCONNECTION];
3426
3427         r = talloc(talloc_tos(), struct spoolss_AddPrinterConnection);
3428         if (r == NULL) {
3429                 return false;
3430         }
3431
3432         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3433                 talloc_free(r);
3434                 return false;
3435         }
3436
3437         pull = ndr_pull_init_blob(&blob, r, NULL);
3438         if (pull == NULL) {
3439                 talloc_free(r);
3440                 return false;
3441         }
3442
3443         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3444         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3445         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3446                 talloc_free(r);
3447                 return false;
3448         }
3449
3450         if (DEBUGLEVEL >= 10) {
3451                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterConnection, r);
3452         }
3453
3454         r->out.result = _spoolss_AddPrinterConnection(p, r);
3455
3456         if (p->rng_fault_state) {
3457                 talloc_free(r);
3458                 /* Return true here, srv_pipe_hnd.c will take care */
3459                 return true;
3460         }
3461
3462         if (DEBUGLEVEL >= 10) {
3463                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterConnection, r);
3464         }
3465
3466         push = ndr_push_init_ctx(r, NULL);
3467         if (push == NULL) {
3468                 talloc_free(r);
3469                 return false;
3470         }
3471
3472         ndr_err = call->ndr_push(push, NDR_OUT, r);
3473         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3474                 talloc_free(r);
3475                 return false;
3476         }
3477
3478         blob = ndr_push_blob(push);
3479         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3480                 talloc_free(r);
3481                 return false;
3482         }
3483
3484         talloc_free(r);
3485
3486         return true;
3487 }
3488
3489 static bool api_spoolss_DeletePrinterConnection(pipes_struct *p)
3490 {
3491         const struct ndr_interface_call *call;
3492         struct ndr_pull *pull;
3493         struct ndr_push *push;
3494         enum ndr_err_code ndr_err;
3495         DATA_BLOB blob;
3496         struct spoolss_DeletePrinterConnection *r;
3497
3498         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERCONNECTION];
3499
3500         r = talloc(talloc_tos(), struct spoolss_DeletePrinterConnection);
3501         if (r == NULL) {
3502                 return false;
3503         }
3504
3505         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3506                 talloc_free(r);
3507                 return false;
3508         }
3509
3510         pull = ndr_pull_init_blob(&blob, r, NULL);
3511         if (pull == NULL) {
3512                 talloc_free(r);
3513                 return false;
3514         }
3515
3516         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3517         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3518         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3519                 talloc_free(r);
3520                 return false;
3521         }
3522
3523         if (DEBUGLEVEL >= 10) {
3524                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterConnection, r);
3525         }
3526
3527         r->out.result = _spoolss_DeletePrinterConnection(p, r);
3528
3529         if (p->rng_fault_state) {
3530                 talloc_free(r);
3531                 /* Return true here, srv_pipe_hnd.c will take care */
3532                 return true;
3533         }
3534
3535         if (DEBUGLEVEL >= 10) {
3536                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterConnection, r);
3537         }
3538
3539         push = ndr_push_init_ctx(r, NULL);
3540         if (push == NULL) {
3541                 talloc_free(r);
3542                 return false;
3543         }
3544
3545         ndr_err = call->ndr_push(push, NDR_OUT, r);
3546         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3547                 talloc_free(r);
3548                 return false;
3549         }
3550
3551         blob = ndr_push_blob(push);
3552         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3553                 talloc_free(r);
3554                 return false;
3555         }
3556
3557         talloc_free(r);
3558
3559         return true;
3560 }
3561
3562 static bool api_spoolss_PrinterMessageBox(pipes_struct *p)
3563 {
3564         const struct ndr_interface_call *call;
3565         struct ndr_pull *pull;
3566         struct ndr_push *push;
3567         enum ndr_err_code ndr_err;
3568         DATA_BLOB blob;
3569         struct spoolss_PrinterMessageBox *r;
3570
3571         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PRINTERMESSAGEBOX];
3572
3573         r = talloc(talloc_tos(), struct spoolss_PrinterMessageBox);
3574         if (r == NULL) {
3575                 return false;
3576         }
3577
3578         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3579                 talloc_free(r);
3580                 return false;
3581         }
3582
3583         pull = ndr_pull_init_blob(&blob, r, NULL);
3584         if (pull == NULL) {
3585                 talloc_free(r);
3586                 return false;
3587         }
3588
3589         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3590         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3591         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3592                 talloc_free(r);
3593                 return false;
3594         }
3595
3596         if (DEBUGLEVEL >= 10) {
3597                 NDR_PRINT_IN_DEBUG(spoolss_PrinterMessageBox, r);
3598         }
3599
3600         r->out.result = _spoolss_PrinterMessageBox(p, r);
3601
3602         if (p->rng_fault_state) {
3603                 talloc_free(r);
3604                 /* Return true here, srv_pipe_hnd.c will take care */
3605                 return true;
3606         }
3607
3608         if (DEBUGLEVEL >= 10) {
3609                 NDR_PRINT_OUT_DEBUG(spoolss_PrinterMessageBox, r);
3610         }
3611
3612         push = ndr_push_init_ctx(r, NULL);
3613         if (push == NULL) {
3614                 talloc_free(r);
3615                 return false;
3616         }
3617
3618         ndr_err = call->ndr_push(push, NDR_OUT, r);
3619         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3620                 talloc_free(r);
3621                 return false;
3622         }
3623
3624         blob = ndr_push_blob(push);
3625         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3626                 talloc_free(r);
3627                 return false;
3628         }
3629
3630         talloc_free(r);
3631
3632         return true;
3633 }
3634
3635 static bool api_spoolss_AddMonitor(pipes_struct *p)
3636 {
3637         const struct ndr_interface_call *call;
3638         struct ndr_pull *pull;
3639         struct ndr_push *push;
3640         enum ndr_err_code ndr_err;
3641         DATA_BLOB blob;
3642         struct spoolss_AddMonitor *r;
3643
3644         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDMONITOR];
3645
3646         r = talloc(talloc_tos(), struct spoolss_AddMonitor);
3647         if (r == NULL) {
3648                 return false;
3649         }
3650
3651         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3652                 talloc_free(r);
3653                 return false;
3654         }
3655
3656         pull = ndr_pull_init_blob(&blob, r, NULL);
3657         if (pull == NULL) {
3658                 talloc_free(r);
3659                 return false;
3660         }
3661
3662         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3663         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3664         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3665                 talloc_free(r);
3666                 return false;
3667         }
3668
3669         if (DEBUGLEVEL >= 10) {
3670                 NDR_PRINT_IN_DEBUG(spoolss_AddMonitor, r);
3671         }
3672
3673         r->out.result = _spoolss_AddMonitor(p, r);
3674
3675         if (p->rng_fault_state) {
3676                 talloc_free(r);
3677                 /* Return true here, srv_pipe_hnd.c will take care */
3678                 return true;
3679         }
3680
3681         if (DEBUGLEVEL >= 10) {
3682                 NDR_PRINT_OUT_DEBUG(spoolss_AddMonitor, r);
3683         }
3684
3685         push = ndr_push_init_ctx(r, NULL);
3686         if (push == NULL) {
3687                 talloc_free(r);
3688                 return false;
3689         }
3690
3691         ndr_err = call->ndr_push(push, NDR_OUT, r);
3692         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3693                 talloc_free(r);
3694                 return false;
3695         }
3696
3697         blob = ndr_push_blob(push);
3698         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3699                 talloc_free(r);
3700                 return false;
3701         }
3702
3703         talloc_free(r);
3704
3705         return true;
3706 }
3707
3708 static bool api_spoolss_DeleteMonitor(pipes_struct *p)
3709 {
3710         const struct ndr_interface_call *call;
3711         struct ndr_pull *pull;
3712         struct ndr_push *push;
3713         enum ndr_err_code ndr_err;
3714         DATA_BLOB blob;
3715         struct spoolss_DeleteMonitor *r;
3716
3717         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEMONITOR];
3718
3719         r = talloc(talloc_tos(), struct spoolss_DeleteMonitor);
3720         if (r == NULL) {
3721                 return false;
3722         }
3723
3724         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3725                 talloc_free(r);
3726                 return false;
3727         }
3728
3729         pull = ndr_pull_init_blob(&blob, r, NULL);
3730         if (pull == NULL) {
3731                 talloc_free(r);
3732                 return false;
3733         }
3734
3735         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3736         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3737         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3738                 talloc_free(r);
3739                 return false;
3740         }
3741
3742         if (DEBUGLEVEL >= 10) {
3743                 NDR_PRINT_IN_DEBUG(spoolss_DeleteMonitor, r);
3744         }
3745
3746         r->out.result = _spoolss_DeleteMonitor(p, r);
3747
3748         if (p->rng_fault_state) {
3749                 talloc_free(r);
3750                 /* Return true here, srv_pipe_hnd.c will take care */
3751                 return true;
3752         }
3753
3754         if (DEBUGLEVEL >= 10) {
3755                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteMonitor, r);
3756         }
3757
3758         push = ndr_push_init_ctx(r, NULL);
3759         if (push == NULL) {
3760                 talloc_free(r);
3761                 return false;
3762         }
3763
3764         ndr_err = call->ndr_push(push, NDR_OUT, r);
3765         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3766                 talloc_free(r);
3767                 return false;
3768         }
3769
3770         blob = ndr_push_blob(push);
3771         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3772                 talloc_free(r);
3773                 return false;
3774         }
3775
3776         talloc_free(r);
3777
3778         return true;
3779 }
3780
3781 static bool api_spoolss_DeletePrintProcessor(pipes_struct *p)
3782 {
3783         const struct ndr_interface_call *call;
3784         struct ndr_pull *pull;
3785         struct ndr_push *push;
3786         enum ndr_err_code ndr_err;
3787         DATA_BLOB blob;
3788         struct spoolss_DeletePrintProcessor *r;
3789
3790         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROCESSOR];
3791
3792         r = talloc(talloc_tos(), struct spoolss_DeletePrintProcessor);
3793         if (r == NULL) {
3794                 return false;
3795         }
3796
3797         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3798                 talloc_free(r);
3799                 return false;
3800         }
3801
3802         pull = ndr_pull_init_blob(&blob, r, NULL);
3803         if (pull == NULL) {
3804                 talloc_free(r);
3805                 return false;
3806         }
3807
3808         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3809         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3810         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3811                 talloc_free(r);
3812                 return false;
3813         }
3814
3815         if (DEBUGLEVEL >= 10) {
3816                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProcessor, r);
3817         }
3818
3819         r->out.result = _spoolss_DeletePrintProcessor(p, r);
3820
3821         if (p->rng_fault_state) {
3822                 talloc_free(r);
3823                 /* Return true here, srv_pipe_hnd.c will take care */
3824                 return true;
3825         }
3826
3827         if (DEBUGLEVEL >= 10) {
3828                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProcessor, r);
3829         }
3830
3831         push = ndr_push_init_ctx(r, NULL);
3832         if (push == NULL) {
3833                 talloc_free(r);
3834                 return false;
3835         }
3836
3837         ndr_err = call->ndr_push(push, NDR_OUT, r);
3838         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3839                 talloc_free(r);
3840                 return false;
3841         }
3842
3843         blob = ndr_push_blob(push);
3844         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3845                 talloc_free(r);
3846                 return false;
3847         }
3848
3849         talloc_free(r);
3850
3851         return true;
3852 }
3853
3854 static bool api_spoolss_AddPrintProvidor(pipes_struct *p)
3855 {
3856         const struct ndr_interface_call *call;
3857         struct ndr_pull *pull;
3858         struct ndr_push *push;
3859         enum ndr_err_code ndr_err;
3860         DATA_BLOB blob;
3861         struct spoolss_AddPrintProvidor *r;
3862
3863         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTPROVIDOR];
3864
3865         r = talloc(talloc_tos(), struct spoolss_AddPrintProvidor);
3866         if (r == NULL) {
3867                 return false;
3868         }
3869
3870         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3871                 talloc_free(r);
3872                 return false;
3873         }
3874
3875         pull = ndr_pull_init_blob(&blob, r, NULL);
3876         if (pull == NULL) {
3877                 talloc_free(r);
3878                 return false;
3879         }
3880
3881         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3882         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3883         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3884                 talloc_free(r);
3885                 return false;
3886         }
3887
3888         if (DEBUGLEVEL >= 10) {
3889                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProvidor, r);
3890         }
3891
3892         r->out.result = _spoolss_AddPrintProvidor(p, r);
3893
3894         if (p->rng_fault_state) {
3895                 talloc_free(r);
3896                 /* Return true here, srv_pipe_hnd.c will take care */
3897                 return true;
3898         }
3899
3900         if (DEBUGLEVEL >= 10) {
3901                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProvidor, r);
3902         }
3903
3904         push = ndr_push_init_ctx(r, NULL);
3905         if (push == NULL) {
3906                 talloc_free(r);
3907                 return false;
3908         }
3909
3910         ndr_err = call->ndr_push(push, NDR_OUT, r);
3911         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3912                 talloc_free(r);
3913                 return false;
3914         }
3915
3916         blob = ndr_push_blob(push);
3917         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3918                 talloc_free(r);
3919                 return false;
3920         }
3921
3922         talloc_free(r);
3923
3924         return true;
3925 }
3926
3927 static bool api_spoolss_DeletePrintProvidor(pipes_struct *p)
3928 {
3929         const struct ndr_interface_call *call;
3930         struct ndr_pull *pull;
3931         struct ndr_push *push;
3932         enum ndr_err_code ndr_err;
3933         DATA_BLOB blob;
3934         struct spoolss_DeletePrintProvidor *r;
3935
3936         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROVIDOR];
3937
3938         r = talloc(talloc_tos(), struct spoolss_DeletePrintProvidor);
3939         if (r == NULL) {
3940                 return false;
3941         }
3942
3943         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3944                 talloc_free(r);
3945                 return false;
3946         }
3947
3948         pull = ndr_pull_init_blob(&blob, r, NULL);
3949         if (pull == NULL) {
3950                 talloc_free(r);
3951                 return false;
3952         }
3953
3954         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3955         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3956         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3957                 talloc_free(r);
3958                 return false;
3959         }
3960
3961         if (DEBUGLEVEL >= 10) {
3962                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProvidor, r);
3963         }
3964
3965         r->out.result = _spoolss_DeletePrintProvidor(p, r);
3966
3967         if (p->rng_fault_state) {
3968                 talloc_free(r);
3969                 /* Return true here, srv_pipe_hnd.c will take care */
3970                 return true;
3971         }
3972
3973         if (DEBUGLEVEL >= 10) {
3974                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProvidor, r);
3975         }
3976
3977         push = ndr_push_init_ctx(r, NULL);
3978         if (push == NULL) {
3979                 talloc_free(r);
3980                 return false;
3981         }
3982
3983         ndr_err = call->ndr_push(push, NDR_OUT, r);
3984         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3985                 talloc_free(r);
3986                 return false;
3987         }
3988
3989         blob = ndr_push_blob(push);
3990         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3991                 talloc_free(r);
3992                 return false;
3993         }
3994
3995         talloc_free(r);
3996
3997         return true;
3998 }
3999
4000 static bool api_spoolss_EnumPrintProcDataTypes(pipes_struct *p)
4001 {
4002         const struct ndr_interface_call *call;
4003         struct ndr_pull *pull;
4004         struct ndr_push *push;
4005         enum ndr_err_code ndr_err;
4006         DATA_BLOB blob;
4007         struct spoolss_EnumPrintProcDataTypes *r;
4008
4009         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTPROCDATATYPES];
4010
4011         r = talloc(talloc_tos(), struct spoolss_EnumPrintProcDataTypes);
4012         if (r == NULL) {
4013                 return false;
4014         }
4015
4016         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4017                 talloc_free(r);
4018                 return false;
4019         }
4020
4021         pull = ndr_pull_init_blob(&blob, r, NULL);
4022         if (pull == NULL) {
4023                 talloc_free(r);
4024                 return false;
4025         }
4026
4027         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4028         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4029         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4030                 talloc_free(r);
4031                 return false;
4032         }
4033
4034         if (DEBUGLEVEL >= 10) {
4035                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcDataTypes, r);
4036         }
4037
4038         ZERO_STRUCT(r->out);
4039         r->out.count = talloc_zero(r, uint32_t);
4040         if (r->out.count == NULL) {
4041                 talloc_free(r);
4042                 return false;
4043         }
4044
4045         r->out.info = talloc_zero(r, union spoolss_PrintProcDataTypesInfo *);
4046         if (r->out.info == NULL) {
4047                 talloc_free(r);
4048                 return false;
4049         }
4050
4051         r->out.needed = talloc_zero(r, uint32_t);
4052         if (r->out.needed == NULL) {
4053                 talloc_free(r);
4054                 return false;
4055         }
4056
4057         r->out.result = _spoolss_EnumPrintProcDataTypes(p, r);
4058
4059         if (p->rng_fault_state) {
4060                 talloc_free(r);
4061                 /* Return true here, srv_pipe_hnd.c will take care */
4062                 return true;
4063         }
4064
4065         if (DEBUGLEVEL >= 10) {
4066                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcDataTypes, r);
4067         }
4068
4069         push = ndr_push_init_ctx(r, NULL);
4070         if (push == NULL) {
4071                 talloc_free(r);
4072                 return false;
4073         }
4074
4075         ndr_err = call->ndr_push(push, NDR_OUT, r);
4076         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4077                 talloc_free(r);
4078                 return false;
4079         }
4080
4081         blob = ndr_push_blob(push);
4082         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4083                 talloc_free(r);
4084                 return false;
4085         }
4086
4087         talloc_free(r);
4088
4089         return true;
4090 }
4091
4092 static bool api_spoolss_ResetPrinter(pipes_struct *p)
4093 {
4094         const struct ndr_interface_call *call;
4095         struct ndr_pull *pull;
4096         struct ndr_push *push;
4097         enum ndr_err_code ndr_err;
4098         DATA_BLOB blob;
4099         struct spoolss_ResetPrinter *r;
4100
4101         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTER];
4102
4103         r = talloc(talloc_tos(), struct spoolss_ResetPrinter);
4104         if (r == NULL) {
4105                 return false;
4106         }
4107
4108         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4109                 talloc_free(r);
4110                 return false;
4111         }
4112
4113         pull = ndr_pull_init_blob(&blob, r, NULL);
4114         if (pull == NULL) {
4115                 talloc_free(r);
4116                 return false;
4117         }
4118
4119         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4120         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4121         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4122                 talloc_free(r);
4123                 return false;
4124         }
4125
4126         if (DEBUGLEVEL >= 10) {
4127                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinter, r);
4128         }
4129
4130         r->out.result = _spoolss_ResetPrinter(p, r);
4131
4132         if (p->rng_fault_state) {
4133                 talloc_free(r);
4134                 /* Return true here, srv_pipe_hnd.c will take care */
4135                 return true;
4136         }
4137
4138         if (DEBUGLEVEL >= 10) {
4139                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinter, r);
4140         }
4141
4142         push = ndr_push_init_ctx(r, NULL);
4143         if (push == NULL) {
4144                 talloc_free(r);
4145                 return false;
4146         }
4147
4148         ndr_err = call->ndr_push(push, NDR_OUT, r);
4149         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4150                 talloc_free(r);
4151                 return false;
4152         }
4153
4154         blob = ndr_push_blob(push);
4155         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4156                 talloc_free(r);
4157                 return false;
4158         }
4159
4160         talloc_free(r);
4161
4162         return true;
4163 }
4164
4165 static bool api_spoolss_GetPrinterDriver2(pipes_struct *p)
4166 {
4167         const struct ndr_interface_call *call;
4168         struct ndr_pull *pull;
4169         struct ndr_push *push;
4170         enum ndr_err_code ndr_err;
4171         DATA_BLOB blob;
4172         struct spoolss_GetPrinterDriver2 *r;
4173
4174         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVER2];
4175
4176         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriver2);
4177         if (r == NULL) {
4178                 return false;
4179         }
4180
4181         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4182                 talloc_free(r);
4183                 return false;
4184         }
4185
4186         pull = ndr_pull_init_blob(&blob, r, NULL);
4187         if (pull == NULL) {
4188                 talloc_free(r);
4189                 return false;
4190         }
4191
4192         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4193         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4194         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4195                 talloc_free(r);
4196                 return false;
4197         }
4198
4199         if (DEBUGLEVEL >= 10) {
4200                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver2, r);
4201         }
4202
4203         ZERO_STRUCT(r->out);
4204         r->out.info = talloc_zero(r, union spoolss_DriverInfo);
4205         if (r->out.info == NULL) {
4206                 talloc_free(r);
4207                 return false;
4208         }
4209
4210         r->out.needed = talloc_zero(r, uint32_t);
4211         if (r->out.needed == NULL) {
4212                 talloc_free(r);
4213                 return false;
4214         }
4215
4216         r->out.server_major_version = talloc_zero(r, uint32_t);
4217         if (r->out.server_major_version == NULL) {
4218                 talloc_free(r);
4219                 return false;
4220         }
4221
4222         r->out.server_minor_version = talloc_zero(r, uint32_t);
4223         if (r->out.server_minor_version == NULL) {
4224                 talloc_free(r);
4225                 return false;
4226         }
4227
4228         r->out.result = _spoolss_GetPrinterDriver2(p, r);
4229
4230         if (p->rng_fault_state) {
4231                 talloc_free(r);
4232                 /* Return true here, srv_pipe_hnd.c will take care */
4233                 return true;
4234         }
4235
4236         if (DEBUGLEVEL >= 10) {
4237                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver2, r);
4238         }
4239
4240         push = ndr_push_init_ctx(r, NULL);
4241         if (push == NULL) {
4242                 talloc_free(r);
4243                 return false;
4244         }
4245
4246         ndr_err = call->ndr_push(push, NDR_OUT, r);
4247         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4248                 talloc_free(r);
4249                 return false;
4250         }
4251
4252         blob = ndr_push_blob(push);
4253         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4254                 talloc_free(r);
4255                 return false;
4256         }
4257
4258         talloc_free(r);
4259
4260         return true;
4261 }
4262
4263 static bool api_spoolss_FindFirstPrinterChangeNotification(pipes_struct *p)
4264 {
4265         const struct ndr_interface_call *call;
4266         struct ndr_pull *pull;
4267         struct ndr_push *push;
4268         enum ndr_err_code ndr_err;
4269         DATA_BLOB blob;
4270         struct spoolss_FindFirstPrinterChangeNotification *r;
4271
4272         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION];
4273
4274         r = talloc(talloc_tos(), struct spoolss_FindFirstPrinterChangeNotification);
4275         if (r == NULL) {
4276                 return false;
4277         }
4278
4279         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4280                 talloc_free(r);
4281                 return false;
4282         }
4283
4284         pull = ndr_pull_init_blob(&blob, r, NULL);
4285         if (pull == NULL) {
4286                 talloc_free(r);
4287                 return false;
4288         }
4289
4290         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4291         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4292         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4293                 talloc_free(r);
4294                 return false;
4295         }
4296
4297         if (DEBUGLEVEL >= 10) {
4298                 NDR_PRINT_IN_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4299         }
4300
4301         r->out.result = _spoolss_FindFirstPrinterChangeNotification(p, r);
4302
4303         if (p->rng_fault_state) {
4304                 talloc_free(r);
4305                 /* Return true here, srv_pipe_hnd.c will take care */
4306                 return true;
4307         }
4308
4309         if (DEBUGLEVEL >= 10) {
4310                 NDR_PRINT_OUT_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4311         }
4312
4313         push = ndr_push_init_ctx(r, NULL);
4314         if (push == NULL) {
4315                 talloc_free(r);
4316                 return false;
4317         }
4318
4319         ndr_err = call->ndr_push(push, NDR_OUT, r);
4320         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4321                 talloc_free(r);
4322                 return false;
4323         }
4324
4325         blob = ndr_push_blob(push);
4326         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4327                 talloc_free(r);
4328                 return false;
4329         }
4330
4331         talloc_free(r);
4332
4333         return true;
4334 }
4335
4336 static bool api_spoolss_FindNextPrinterChangeNotification(pipes_struct *p)
4337 {
4338         const struct ndr_interface_call *call;
4339         struct ndr_pull *pull;
4340         struct ndr_push *push;
4341         enum ndr_err_code ndr_err;
4342         DATA_BLOB blob;
4343         struct spoolss_FindNextPrinterChangeNotification *r;
4344
4345         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION];
4346
4347         r = talloc(talloc_tos(), struct spoolss_FindNextPrinterChangeNotification);
4348         if (r == NULL) {
4349                 return false;
4350         }
4351
4352         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4353                 talloc_free(r);
4354                 return false;
4355         }
4356
4357         pull = ndr_pull_init_blob(&blob, r, NULL);
4358         if (pull == NULL) {
4359                 talloc_free(r);
4360                 return false;
4361         }
4362
4363         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4364         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4365         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4366                 talloc_free(r);
4367                 return false;
4368         }
4369
4370         if (DEBUGLEVEL >= 10) {
4371                 NDR_PRINT_IN_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4372         }
4373
4374         r->out.result = _spoolss_FindNextPrinterChangeNotification(p, r);
4375
4376         if (p->rng_fault_state) {
4377                 talloc_free(r);
4378                 /* Return true here, srv_pipe_hnd.c will take care */
4379                 return true;
4380         }
4381
4382         if (DEBUGLEVEL >= 10) {
4383                 NDR_PRINT_OUT_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4384         }
4385
4386         push = ndr_push_init_ctx(r, NULL);
4387         if (push == NULL) {
4388                 talloc_free(r);
4389                 return false;
4390         }
4391
4392         ndr_err = call->ndr_push(push, NDR_OUT, r);
4393         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4394                 talloc_free(r);
4395                 return false;
4396         }
4397
4398         blob = ndr_push_blob(push);
4399         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4400                 talloc_free(r);
4401                 return false;
4402         }
4403
4404         talloc_free(r);
4405
4406         return true;
4407 }
4408
4409 static bool api_spoolss_FindClosePrinterNotify(pipes_struct *p)
4410 {
4411         const struct ndr_interface_call *call;
4412         struct ndr_pull *pull;
4413         struct ndr_push *push;
4414         enum ndr_err_code ndr_err;
4415         DATA_BLOB blob;
4416         struct spoolss_FindClosePrinterNotify *r;
4417
4418         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY];
4419
4420         r = talloc(talloc_tos(), struct spoolss_FindClosePrinterNotify);
4421         if (r == NULL) {
4422                 return false;
4423         }
4424
4425         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4426                 talloc_free(r);
4427                 return false;
4428         }
4429
4430         pull = ndr_pull_init_blob(&blob, r, NULL);
4431         if (pull == NULL) {
4432                 talloc_free(r);
4433                 return false;
4434         }
4435
4436         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4437         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4438         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4439                 talloc_free(r);
4440                 return false;
4441         }
4442
4443         if (DEBUGLEVEL >= 10) {
4444                 NDR_PRINT_IN_DEBUG(spoolss_FindClosePrinterNotify, r);
4445         }
4446
4447         r->out.result = _spoolss_FindClosePrinterNotify(p, r);
4448
4449         if (p->rng_fault_state) {
4450                 talloc_free(r);
4451                 /* Return true here, srv_pipe_hnd.c will take care */
4452                 return true;
4453         }
4454
4455         if (DEBUGLEVEL >= 10) {
4456                 NDR_PRINT_OUT_DEBUG(spoolss_FindClosePrinterNotify, r);
4457         }
4458
4459         push = ndr_push_init_ctx(r, NULL);
4460         if (push == NULL) {
4461                 talloc_free(r);
4462                 return false;
4463         }
4464
4465         ndr_err = call->ndr_push(push, NDR_OUT, r);
4466         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4467                 talloc_free(r);
4468                 return false;
4469         }
4470
4471         blob = ndr_push_blob(push);
4472         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4473                 talloc_free(r);
4474                 return false;
4475         }
4476
4477         talloc_free(r);
4478
4479         return true;
4480 }
4481
4482 static bool api_spoolss_RouterFindFirstPrinterChangeNotificationOld(pipes_struct *p)
4483 {
4484         const struct ndr_interface_call *call;
4485         struct ndr_pull *pull;
4486         struct ndr_push *push;
4487         enum ndr_err_code ndr_err;
4488         DATA_BLOB blob;
4489         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r;
4490
4491         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD];
4492
4493         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotificationOld);
4494         if (r == NULL) {
4495                 return false;
4496         }
4497
4498         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4499                 talloc_free(r);
4500                 return false;
4501         }
4502
4503         pull = ndr_pull_init_blob(&blob, r, NULL);
4504         if (pull == NULL) {
4505                 talloc_free(r);
4506                 return false;
4507         }
4508
4509         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4510         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4511         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4512                 talloc_free(r);
4513                 return false;
4514         }
4515
4516         if (DEBUGLEVEL >= 10) {
4517                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4518         }
4519
4520         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(p, r);
4521
4522         if (p->rng_fault_state) {
4523                 talloc_free(r);
4524                 /* Return true here, srv_pipe_hnd.c will take care */
4525                 return true;
4526         }
4527
4528         if (DEBUGLEVEL >= 10) {
4529                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4530         }
4531
4532         push = ndr_push_init_ctx(r, NULL);
4533         if (push == NULL) {
4534                 talloc_free(r);
4535                 return false;
4536         }
4537
4538         ndr_err = call->ndr_push(push, NDR_OUT, r);
4539         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4540                 talloc_free(r);
4541                 return false;
4542         }
4543
4544         blob = ndr_push_blob(push);
4545         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4546                 talloc_free(r);
4547                 return false;
4548         }
4549
4550         talloc_free(r);
4551
4552         return true;
4553 }
4554
4555 static bool api_spoolss_ReplyOpenPrinter(pipes_struct *p)
4556 {
4557         const struct ndr_interface_call *call;
4558         struct ndr_pull *pull;
4559         struct ndr_push *push;
4560         enum ndr_err_code ndr_err;
4561         DATA_BLOB blob;
4562         struct spoolss_ReplyOpenPrinter *r;
4563
4564         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYOPENPRINTER];
4565
4566         r = talloc(talloc_tos(), struct spoolss_ReplyOpenPrinter);
4567         if (r == NULL) {
4568                 return false;
4569         }
4570
4571         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4572                 talloc_free(r);
4573                 return false;
4574         }
4575
4576         pull = ndr_pull_init_blob(&blob, r, NULL);
4577         if (pull == NULL) {
4578                 talloc_free(r);
4579                 return false;
4580         }
4581
4582         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4583         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4584         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4585                 talloc_free(r);
4586                 return false;
4587         }
4588
4589         if (DEBUGLEVEL >= 10) {
4590                 NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, r);
4591         }
4592
4593         ZERO_STRUCT(r->out);
4594         r->out.handle = talloc_zero(r, struct policy_handle);
4595         if (r->out.handle == NULL) {
4596                 talloc_free(r);
4597                 return false;
4598         }
4599
4600         r->out.result = _spoolss_ReplyOpenPrinter(p, r);
4601
4602         if (p->rng_fault_state) {
4603                 talloc_free(r);
4604                 /* Return true here, srv_pipe_hnd.c will take care */
4605                 return true;
4606         }
4607
4608         if (DEBUGLEVEL >= 10) {
4609                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, r);
4610         }
4611
4612         push = ndr_push_init_ctx(r, NULL);
4613         if (push == NULL) {
4614                 talloc_free(r);
4615                 return false;
4616         }
4617
4618         ndr_err = call->ndr_push(push, NDR_OUT, r);
4619         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4620                 talloc_free(r);
4621                 return false;
4622         }
4623
4624         blob = ndr_push_blob(push);
4625         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4626                 talloc_free(r);
4627                 return false;
4628         }
4629
4630         talloc_free(r);
4631
4632         return true;
4633 }
4634
4635 static bool api_spoolss_RouterReplyPrinter(pipes_struct *p)
4636 {
4637         const struct ndr_interface_call *call;
4638         struct ndr_pull *pull;
4639         struct ndr_push *push;
4640         enum ndr_err_code ndr_err;
4641         DATA_BLOB blob;
4642         struct spoolss_RouterReplyPrinter *r;
4643
4644         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTER];
4645
4646         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinter);
4647         if (r == NULL) {
4648                 return false;
4649         }
4650
4651         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4652                 talloc_free(r);
4653                 return false;
4654         }
4655
4656         pull = ndr_pull_init_blob(&blob, r, NULL);
4657         if (pull == NULL) {
4658                 talloc_free(r);
4659                 return false;
4660         }
4661
4662         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4663         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4664         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4665                 talloc_free(r);
4666                 return false;
4667         }
4668
4669         if (DEBUGLEVEL >= 10) {
4670                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinter, r);
4671         }
4672
4673         r->out.result = _spoolss_RouterReplyPrinter(p, r);
4674
4675         if (p->rng_fault_state) {
4676                 talloc_free(r);
4677                 /* Return true here, srv_pipe_hnd.c will take care */
4678                 return true;
4679         }
4680
4681         if (DEBUGLEVEL >= 10) {
4682                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinter, r);
4683         }
4684
4685         push = ndr_push_init_ctx(r, NULL);
4686         if (push == NULL) {
4687                 talloc_free(r);
4688                 return false;
4689         }
4690
4691         ndr_err = call->ndr_push(push, NDR_OUT, r);
4692         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4693                 talloc_free(r);
4694                 return false;
4695         }
4696
4697         blob = ndr_push_blob(push);
4698         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4699                 talloc_free(r);
4700                 return false;
4701         }
4702
4703         talloc_free(r);
4704
4705         return true;
4706 }
4707
4708 static bool api_spoolss_ReplyClosePrinter(pipes_struct *p)
4709 {
4710         const struct ndr_interface_call *call;
4711         struct ndr_pull *pull;
4712         struct ndr_push *push;
4713         enum ndr_err_code ndr_err;
4714         DATA_BLOB blob;
4715         struct spoolss_ReplyClosePrinter *r;
4716
4717         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYCLOSEPRINTER];
4718
4719         r = talloc(talloc_tos(), struct spoolss_ReplyClosePrinter);
4720         if (r == NULL) {
4721                 return false;
4722         }
4723
4724         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4725                 talloc_free(r);
4726                 return false;
4727         }
4728
4729         pull = ndr_pull_init_blob(&blob, r, NULL);
4730         if (pull == NULL) {
4731                 talloc_free(r);
4732                 return false;
4733         }
4734
4735         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4736         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4737         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4738                 talloc_free(r);
4739                 return false;
4740         }
4741
4742         if (DEBUGLEVEL >= 10) {
4743                 NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, r);
4744         }
4745
4746         ZERO_STRUCT(r->out);
4747         r->out.handle = r->in.handle;
4748         r->out.result = _spoolss_ReplyClosePrinter(p, r);
4749
4750         if (p->rng_fault_state) {
4751                 talloc_free(r);
4752                 /* Return true here, srv_pipe_hnd.c will take care */
4753                 return true;
4754         }
4755
4756         if (DEBUGLEVEL >= 10) {
4757                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, r);
4758         }
4759
4760         push = ndr_push_init_ctx(r, NULL);
4761         if (push == NULL) {
4762                 talloc_free(r);
4763                 return false;
4764         }
4765
4766         ndr_err = call->ndr_push(push, NDR_OUT, r);
4767         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4768                 talloc_free(r);
4769                 return false;
4770         }
4771
4772         blob = ndr_push_blob(push);
4773         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4774                 talloc_free(r);
4775                 return false;
4776         }
4777
4778         talloc_free(r);
4779
4780         return true;
4781 }
4782
4783 static bool api_spoolss_AddPortEx(pipes_struct *p)
4784 {
4785         const struct ndr_interface_call *call;
4786         struct ndr_pull *pull;
4787         struct ndr_push *push;
4788         enum ndr_err_code ndr_err;
4789         DATA_BLOB blob;
4790         struct spoolss_AddPortEx *r;
4791
4792         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORTEX];
4793
4794         r = talloc(talloc_tos(), struct spoolss_AddPortEx);
4795         if (r == NULL) {
4796                 return false;
4797         }
4798
4799         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4800                 talloc_free(r);
4801                 return false;
4802         }
4803
4804         pull = ndr_pull_init_blob(&blob, r, NULL);
4805         if (pull == NULL) {
4806                 talloc_free(r);
4807                 return false;
4808         }
4809
4810         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4811         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4812         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4813                 talloc_free(r);
4814                 return false;
4815         }
4816
4817         if (DEBUGLEVEL >= 10) {
4818                 NDR_PRINT_IN_DEBUG(spoolss_AddPortEx, r);
4819         }
4820
4821         r->out.result = _spoolss_AddPortEx(p, r);
4822
4823         if (p->rng_fault_state) {
4824                 talloc_free(r);
4825                 /* Return true here, srv_pipe_hnd.c will take care */
4826                 return true;
4827         }
4828
4829         if (DEBUGLEVEL >= 10) {
4830                 NDR_PRINT_OUT_DEBUG(spoolss_AddPortEx, r);
4831         }
4832
4833         push = ndr_push_init_ctx(r, NULL);
4834         if (push == NULL) {
4835                 talloc_free(r);
4836                 return false;
4837         }
4838
4839         ndr_err = call->ndr_push(push, NDR_OUT, r);
4840         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4841                 talloc_free(r);
4842                 return false;
4843         }
4844
4845         blob = ndr_push_blob(push);
4846         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4847                 talloc_free(r);
4848                 return false;
4849         }
4850
4851         talloc_free(r);
4852
4853         return true;
4854 }
4855
4856 static bool api_spoolss_RouterFindFirstPrinterChangeNotification(pipes_struct *p)
4857 {
4858         const struct ndr_interface_call *call;
4859         struct ndr_pull *pull;
4860         struct ndr_push *push;
4861         enum ndr_err_code ndr_err;
4862         DATA_BLOB blob;
4863         struct spoolss_RouterFindFirstPrinterChangeNotification *r;
4864
4865         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION];
4866
4867         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotification);
4868         if (r == NULL) {
4869                 return false;
4870         }
4871
4872         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4873                 talloc_free(r);
4874                 return false;
4875         }
4876
4877         pull = ndr_pull_init_blob(&blob, r, NULL);
4878         if (pull == NULL) {
4879                 talloc_free(r);
4880                 return false;
4881         }
4882
4883         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4884         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4885         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4886                 talloc_free(r);
4887                 return false;
4888         }
4889
4890         if (DEBUGLEVEL >= 10) {
4891                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4892         }
4893
4894         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(p, r);
4895
4896         if (p->rng_fault_state) {
4897                 talloc_free(r);
4898                 /* Return true here, srv_pipe_hnd.c will take care */
4899                 return true;
4900         }
4901
4902         if (DEBUGLEVEL >= 10) {
4903                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4904         }
4905
4906         push = ndr_push_init_ctx(r, NULL);
4907         if (push == NULL) {
4908                 talloc_free(r);
4909                 return false;
4910         }
4911
4912         ndr_err = call->ndr_push(push, NDR_OUT, r);
4913         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4914                 talloc_free(r);
4915                 return false;
4916         }
4917
4918         blob = ndr_push_blob(push);
4919         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4920                 talloc_free(r);
4921                 return false;
4922         }
4923
4924         talloc_free(r);
4925
4926         return true;
4927 }
4928
4929 static bool api_spoolss_SpoolerInit(pipes_struct *p)
4930 {
4931         const struct ndr_interface_call *call;
4932         struct ndr_pull *pull;
4933         struct ndr_push *push;
4934         enum ndr_err_code ndr_err;
4935         DATA_BLOB blob;
4936         struct spoolss_SpoolerInit *r;
4937
4938         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SPOOLERINIT];
4939
4940         r = talloc(talloc_tos(), struct spoolss_SpoolerInit);
4941         if (r == NULL) {
4942                 return false;
4943         }
4944
4945         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4946                 talloc_free(r);
4947                 return false;
4948         }
4949
4950         pull = ndr_pull_init_blob(&blob, r, NULL);
4951         if (pull == NULL) {
4952                 talloc_free(r);
4953                 return false;
4954         }
4955
4956         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4957         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4958         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4959                 talloc_free(r);
4960                 return false;
4961         }
4962
4963         if (DEBUGLEVEL >= 10) {
4964                 NDR_PRINT_IN_DEBUG(spoolss_SpoolerInit, r);
4965         }
4966
4967         r->out.result = _spoolss_SpoolerInit(p, r);
4968
4969         if (p->rng_fault_state) {
4970                 talloc_free(r);
4971                 /* Return true here, srv_pipe_hnd.c will take care */
4972                 return true;
4973         }
4974
4975         if (DEBUGLEVEL >= 10) {
4976                 NDR_PRINT_OUT_DEBUG(spoolss_SpoolerInit, r);
4977         }
4978
4979         push = ndr_push_init_ctx(r, NULL);
4980         if (push == NULL) {
4981                 talloc_free(r);
4982                 return false;
4983         }
4984
4985         ndr_err = call->ndr_push(push, NDR_OUT, r);
4986         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4987                 talloc_free(r);
4988                 return false;
4989         }
4990
4991         blob = ndr_push_blob(push);
4992         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4993                 talloc_free(r);
4994                 return false;
4995         }
4996
4997         talloc_free(r);
4998
4999         return true;
5000 }
5001
5002 static bool api_spoolss_ResetPrinterEx(pipes_struct *p)
5003 {
5004         const struct ndr_interface_call *call;
5005         struct ndr_pull *pull;
5006         struct ndr_push *push;
5007         enum ndr_err_code ndr_err;
5008         DATA_BLOB blob;
5009         struct spoolss_ResetPrinterEx *r;
5010
5011         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTEREX];
5012
5013         r = talloc(talloc_tos(), struct spoolss_ResetPrinterEx);
5014         if (r == NULL) {
5015                 return false;
5016         }
5017
5018         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5019                 talloc_free(r);
5020                 return false;
5021         }
5022
5023         pull = ndr_pull_init_blob(&blob, r, NULL);
5024         if (pull == NULL) {
5025                 talloc_free(r);
5026                 return false;
5027         }
5028
5029         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5030         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5031         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5032                 talloc_free(r);
5033                 return false;
5034         }
5035
5036         if (DEBUGLEVEL >= 10) {
5037                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinterEx, r);
5038         }
5039
5040         r->out.result = _spoolss_ResetPrinterEx(p, r);
5041
5042         if (p->rng_fault_state) {
5043                 talloc_free(r);
5044                 /* Return true here, srv_pipe_hnd.c will take care */
5045                 return true;
5046         }
5047
5048         if (DEBUGLEVEL >= 10) {
5049                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinterEx, r);
5050         }
5051
5052         push = ndr_push_init_ctx(r, NULL);
5053         if (push == NULL) {
5054                 talloc_free(r);
5055                 return false;
5056         }
5057
5058         ndr_err = call->ndr_push(push, NDR_OUT, r);
5059         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5060                 talloc_free(r);
5061                 return false;
5062         }
5063
5064         blob = ndr_push_blob(push);
5065         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5066                 talloc_free(r);
5067                 return false;
5068         }
5069
5070         talloc_free(r);
5071
5072         return true;
5073 }
5074
5075 static bool api_spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p)
5076 {
5077         const struct ndr_interface_call *call;
5078         struct ndr_pull *pull;
5079         struct ndr_push *push;
5080         enum ndr_err_code ndr_err;
5081         DATA_BLOB blob;
5082         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r;
5083
5084         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX];
5085
5086         r = talloc(talloc_tos(), struct spoolss_RemoteFindFirstPrinterChangeNotifyEx);
5087         if (r == NULL) {
5088                 return false;
5089         }
5090
5091         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5092                 talloc_free(r);
5093                 return false;
5094         }
5095
5096         pull = ndr_pull_init_blob(&blob, r, NULL);
5097         if (pull == NULL) {
5098                 talloc_free(r);
5099                 return false;
5100         }
5101
5102         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5103         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5104         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5105                 talloc_free(r);
5106                 return false;
5107         }
5108
5109         if (DEBUGLEVEL >= 10) {
5110                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5111         }
5112
5113         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, r);
5114
5115         if (p->rng_fault_state) {
5116                 talloc_free(r);
5117                 /* Return true here, srv_pipe_hnd.c will take care */
5118                 return true;
5119         }
5120
5121         if (DEBUGLEVEL >= 10) {
5122                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5123         }
5124
5125         push = ndr_push_init_ctx(r, NULL);
5126         if (push == NULL) {
5127                 talloc_free(r);
5128                 return false;
5129         }
5130
5131         ndr_err = call->ndr_push(push, NDR_OUT, r);
5132         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5133                 talloc_free(r);
5134                 return false;
5135         }
5136
5137         blob = ndr_push_blob(push);
5138         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5139                 talloc_free(r);
5140                 return false;
5141         }
5142
5143         talloc_free(r);
5144
5145         return true;
5146 }
5147
5148 static bool api_spoolss_RouterReplyPrinterEx(pipes_struct *p)
5149 {
5150         const struct ndr_interface_call *call;
5151         struct ndr_pull *pull;
5152         struct ndr_push *push;
5153         enum ndr_err_code ndr_err;
5154         DATA_BLOB blob;
5155         struct spoolss_RouterReplyPrinterEx *r;
5156
5157         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTEREX];
5158
5159         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinterEx);
5160         if (r == NULL) {
5161                 return false;
5162         }
5163
5164         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5165                 talloc_free(r);
5166                 return false;
5167         }
5168
5169         pull = ndr_pull_init_blob(&blob, r, NULL);
5170         if (pull == NULL) {
5171                 talloc_free(r);
5172                 return false;
5173         }
5174
5175         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5176         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5177         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5178                 talloc_free(r);
5179                 return false;
5180         }
5181
5182         if (DEBUGLEVEL >= 10) {
5183                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinterEx, r);
5184         }
5185
5186         ZERO_STRUCT(r->out);
5187         r->out.reply_result = talloc_zero(r, uint32_t);
5188         if (r->out.reply_result == NULL) {
5189                 talloc_free(r);
5190                 return false;
5191         }
5192
5193         r->out.result = _spoolss_RouterReplyPrinterEx(p, r);
5194
5195         if (p->rng_fault_state) {
5196                 talloc_free(r);
5197                 /* Return true here, srv_pipe_hnd.c will take care */
5198                 return true;
5199         }
5200
5201         if (DEBUGLEVEL >= 10) {
5202                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinterEx, r);
5203         }
5204
5205         push = ndr_push_init_ctx(r, NULL);
5206         if (push == NULL) {
5207                 talloc_free(r);
5208                 return false;
5209         }
5210
5211         ndr_err = call->ndr_push(push, NDR_OUT, r);
5212         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5213                 talloc_free(r);
5214                 return false;
5215         }
5216
5217         blob = ndr_push_blob(push);
5218         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5219                 talloc_free(r);
5220                 return false;
5221         }
5222
5223         talloc_free(r);
5224
5225         return true;
5226 }
5227
5228 static bool api_spoolss_RouterRefreshPrinterChangeNotify(pipes_struct *p)
5229 {
5230         const struct ndr_interface_call *call;
5231         struct ndr_pull *pull;
5232         struct ndr_push *push;
5233         enum ndr_err_code ndr_err;
5234         DATA_BLOB blob;
5235         struct spoolss_RouterRefreshPrinterChangeNotify *r;
5236
5237         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY];
5238
5239         r = talloc(talloc_tos(), struct spoolss_RouterRefreshPrinterChangeNotify);
5240         if (r == NULL) {
5241                 return false;
5242         }
5243
5244         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5245                 talloc_free(r);
5246                 return false;
5247         }
5248
5249         pull = ndr_pull_init_blob(&blob, r, NULL);
5250         if (pull == NULL) {
5251                 talloc_free(r);
5252                 return false;
5253         }
5254
5255         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5256         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5257         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5258                 talloc_free(r);
5259                 return false;
5260         }
5261
5262         if (DEBUGLEVEL >= 10) {
5263                 NDR_PRINT_IN_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5264         }
5265
5266         ZERO_STRUCT(r->out);
5267         r->out.info = talloc_zero(r, struct spoolss_NotifyInfo *);
5268         if (r->out.info == NULL) {
5269                 talloc_free(r);
5270                 return false;
5271         }
5272
5273         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(p, r);
5274
5275         if (p->rng_fault_state) {
5276                 talloc_free(r);
5277                 /* Return true here, srv_pipe_hnd.c will take care */
5278                 return true;
5279         }
5280
5281         if (DEBUGLEVEL >= 10) {
5282                 NDR_PRINT_OUT_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5283         }
5284
5285         push = ndr_push_init_ctx(r, NULL);
5286         if (push == NULL) {
5287                 talloc_free(r);
5288                 return false;
5289         }
5290
5291         ndr_err = call->ndr_push(push, NDR_OUT, r);
5292         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5293                 talloc_free(r);
5294                 return false;
5295         }
5296
5297         blob = ndr_push_blob(push);
5298         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5299                 talloc_free(r);
5300                 return false;
5301         }
5302
5303         talloc_free(r);
5304
5305         return true;
5306 }
5307
5308 static bool api_spoolss_44(pipes_struct *p)
5309 {
5310         const struct ndr_interface_call *call;
5311         struct ndr_pull *pull;
5312         struct ndr_push *push;
5313         enum ndr_err_code ndr_err;
5314         DATA_BLOB blob;
5315         struct spoolss_44 *r;
5316
5317         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_44];
5318
5319         r = talloc(talloc_tos(), struct spoolss_44);
5320         if (r == NULL) {
5321                 return false;
5322         }
5323
5324         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5325                 talloc_free(r);
5326                 return false;
5327         }
5328
5329         pull = ndr_pull_init_blob(&blob, r, NULL);
5330         if (pull == NULL) {
5331                 talloc_free(r);
5332                 return false;
5333         }
5334
5335         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5336         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5337         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5338                 talloc_free(r);
5339                 return false;
5340         }
5341
5342         if (DEBUGLEVEL >= 10) {
5343                 NDR_PRINT_IN_DEBUG(spoolss_44, r);
5344         }
5345
5346         r->out.result = _spoolss_44(p, r);
5347
5348         if (p->rng_fault_state) {
5349                 talloc_free(r);
5350                 /* Return true here, srv_pipe_hnd.c will take care */
5351                 return true;
5352         }
5353
5354         if (DEBUGLEVEL >= 10) {
5355                 NDR_PRINT_OUT_DEBUG(spoolss_44, r);
5356         }
5357
5358         push = ndr_push_init_ctx(r, NULL);
5359         if (push == NULL) {
5360                 talloc_free(r);
5361                 return false;
5362         }
5363
5364         ndr_err = call->ndr_push(push, NDR_OUT, r);
5365         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5366                 talloc_free(r);
5367                 return false;
5368         }
5369
5370         blob = ndr_push_blob(push);
5371         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5372                 talloc_free(r);
5373                 return false;
5374         }
5375
5376         talloc_free(r);
5377
5378         return true;
5379 }
5380
5381 static bool api_spoolss_OpenPrinterEx(pipes_struct *p)
5382 {
5383         const struct ndr_interface_call *call;
5384         struct ndr_pull *pull;
5385         struct ndr_push *push;
5386         enum ndr_err_code ndr_err;
5387         DATA_BLOB blob;
5388         struct spoolss_OpenPrinterEx *r;
5389
5390         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_OPENPRINTEREX];
5391
5392         r = talloc(talloc_tos(), struct spoolss_OpenPrinterEx);
5393         if (r == NULL) {
5394                 return false;
5395         }
5396
5397         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5398                 talloc_free(r);
5399                 return false;
5400         }
5401
5402         pull = ndr_pull_init_blob(&blob, r, NULL);
5403         if (pull == NULL) {
5404                 talloc_free(r);
5405                 return false;
5406         }
5407
5408         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5409         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5410         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5411                 talloc_free(r);
5412                 return false;
5413         }
5414
5415         if (DEBUGLEVEL >= 10) {
5416                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinterEx, r);
5417         }
5418
5419         ZERO_STRUCT(r->out);
5420         r->out.handle = talloc_zero(r, struct policy_handle);
5421         if (r->out.handle == NULL) {
5422                 talloc_free(r);
5423                 return false;
5424         }
5425
5426         r->out.result = _spoolss_OpenPrinterEx(p, r);
5427
5428         if (p->rng_fault_state) {
5429                 talloc_free(r);
5430                 /* Return true here, srv_pipe_hnd.c will take care */
5431                 return true;
5432         }
5433
5434         if (DEBUGLEVEL >= 10) {
5435                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinterEx, r);
5436         }
5437
5438         push = ndr_push_init_ctx(r, NULL);
5439         if (push == NULL) {
5440                 talloc_free(r);
5441                 return false;
5442         }
5443
5444         ndr_err = call->ndr_push(push, NDR_OUT, r);
5445         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5446                 talloc_free(r);
5447                 return false;
5448         }
5449
5450         blob = ndr_push_blob(push);
5451         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5452                 talloc_free(r);
5453                 return false;
5454         }
5455
5456         talloc_free(r);
5457
5458         return true;
5459 }
5460
5461 static bool api_spoolss_AddPrinterEx(pipes_struct *p)
5462 {
5463         const struct ndr_interface_call *call;
5464         struct ndr_pull *pull;
5465         struct ndr_push *push;
5466         enum ndr_err_code ndr_err;
5467         DATA_BLOB blob;
5468         struct spoolss_AddPrinterEx *r;
5469
5470         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTEREX];
5471
5472         r = talloc(talloc_tos(), struct spoolss_AddPrinterEx);
5473         if (r == NULL) {
5474                 return false;
5475         }
5476
5477         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5478                 talloc_free(r);
5479                 return false;
5480         }
5481
5482         pull = ndr_pull_init_blob(&blob, r, NULL);
5483         if (pull == NULL) {
5484                 talloc_free(r);
5485                 return false;
5486         }
5487
5488         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5489         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5490         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5491                 talloc_free(r);
5492                 return false;
5493         }
5494
5495         if (DEBUGLEVEL >= 10) {
5496                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, r);
5497         }
5498
5499         ZERO_STRUCT(r->out);
5500         r->out.handle = talloc_zero(r, struct policy_handle);
5501         if (r->out.handle == NULL) {
5502                 talloc_free(r);
5503                 return false;
5504         }
5505
5506         r->out.result = _spoolss_AddPrinterEx(p, r);
5507
5508         if (p->rng_fault_state) {
5509                 talloc_free(r);
5510                 /* Return true here, srv_pipe_hnd.c will take care */
5511                 return true;
5512         }
5513
5514         if (DEBUGLEVEL >= 10) {
5515                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterEx, r);
5516         }
5517
5518         push = ndr_push_init_ctx(r, NULL);
5519         if (push == NULL) {
5520                 talloc_free(r);
5521                 return false;
5522         }
5523
5524         ndr_err = call->ndr_push(push, NDR_OUT, r);
5525         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5526                 talloc_free(r);
5527                 return false;
5528         }
5529
5530         blob = ndr_push_blob(push);
5531         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5532                 talloc_free(r);
5533                 return false;
5534         }
5535
5536         talloc_free(r);
5537
5538         return true;
5539 }
5540
5541 static bool api_spoolss_47(pipes_struct *p)
5542 {
5543         const struct ndr_interface_call *call;
5544         struct ndr_pull *pull;
5545         struct ndr_push *push;
5546         enum ndr_err_code ndr_err;
5547         DATA_BLOB blob;
5548         struct spoolss_47 *r;
5549
5550         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_47];
5551
5552         r = talloc(talloc_tos(), struct spoolss_47);
5553         if (r == NULL) {
5554                 return false;
5555         }
5556
5557         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5558                 talloc_free(r);
5559                 return false;
5560         }
5561
5562         pull = ndr_pull_init_blob(&blob, r, NULL);
5563         if (pull == NULL) {
5564                 talloc_free(r);
5565                 return false;
5566         }
5567
5568         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5569         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5570         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5571                 talloc_free(r);
5572                 return false;
5573         }
5574
5575         if (DEBUGLEVEL >= 10) {
5576                 NDR_PRINT_IN_DEBUG(spoolss_47, r);
5577         }
5578
5579         r->out.result = _spoolss_47(p, r);
5580
5581         if (p->rng_fault_state) {
5582                 talloc_free(r);
5583                 /* Return true here, srv_pipe_hnd.c will take care */
5584                 return true;
5585         }
5586
5587         if (DEBUGLEVEL >= 10) {
5588                 NDR_PRINT_OUT_DEBUG(spoolss_47, r);
5589         }
5590
5591         push = ndr_push_init_ctx(r, NULL);
5592         if (push == NULL) {
5593                 talloc_free(r);
5594                 return false;
5595         }
5596
5597         ndr_err = call->ndr_push(push, NDR_OUT, r);
5598         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5599                 talloc_free(r);
5600                 return false;
5601         }
5602
5603         blob = ndr_push_blob(push);
5604         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5605                 talloc_free(r);
5606                 return false;
5607         }
5608
5609         talloc_free(r);
5610
5611         return true;
5612 }
5613
5614 static bool api_spoolss_EnumPrinterData(pipes_struct *p)
5615 {
5616         const struct ndr_interface_call *call;
5617         struct ndr_pull *pull;
5618         struct ndr_push *push;
5619         enum ndr_err_code ndr_err;
5620         DATA_BLOB blob;
5621         struct spoolss_EnumPrinterData *r;
5622
5623         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATA];
5624
5625         r = talloc(talloc_tos(), struct spoolss_EnumPrinterData);
5626         if (r == NULL) {
5627                 return false;
5628         }
5629
5630         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5631                 talloc_free(r);
5632                 return false;
5633         }
5634
5635         pull = ndr_pull_init_blob(&blob, r, NULL);
5636         if (pull == NULL) {
5637                 talloc_free(r);
5638                 return false;
5639         }
5640
5641         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5642         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5643         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5644                 talloc_free(r);
5645                 return false;
5646         }
5647
5648         if (DEBUGLEVEL >= 10) {
5649                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterData, r);
5650         }
5651
5652         ZERO_STRUCT(r->out);
5653         r->out.value_name = talloc_zero_array(r, const char, r->in.value_offered / 2);
5654         if (r->out.value_name == NULL) {
5655                 talloc_free(r);
5656                 return false;
5657         }
5658
5659         r->out.value_needed = talloc_zero(r, uint32_t);
5660         if (r->out.value_needed == NULL) {
5661                 talloc_free(r);
5662                 return false;
5663         }
5664
5665         r->out.type = talloc_zero(r, enum winreg_Type);
5666         if (r->out.type == NULL) {
5667                 talloc_free(r);
5668                 return false;
5669         }
5670
5671         r->out.data = talloc_zero_array(r, uint8_t, r->in.data_offered);
5672         if (r->out.data == NULL) {
5673                 talloc_free(r);
5674                 return false;
5675         }
5676
5677         r->out.data_needed = talloc_zero(r, uint32_t);
5678         if (r->out.data_needed == NULL) {
5679                 talloc_free(r);
5680                 return false;
5681         }
5682
5683         r->out.result = _spoolss_EnumPrinterData(p, r);
5684
5685         if (p->rng_fault_state) {
5686                 talloc_free(r);
5687                 /* Return true here, srv_pipe_hnd.c will take care */
5688                 return true;
5689         }
5690
5691         if (DEBUGLEVEL >= 10) {
5692                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterData, r);
5693         }
5694
5695         push = ndr_push_init_ctx(r, NULL);
5696         if (push == NULL) {
5697                 talloc_free(r);
5698                 return false;
5699         }
5700
5701         ndr_err = call->ndr_push(push, NDR_OUT, r);
5702         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5703                 talloc_free(r);
5704                 return false;
5705         }
5706
5707         blob = ndr_push_blob(push);
5708         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5709                 talloc_free(r);
5710                 return false;
5711         }
5712
5713         talloc_free(r);
5714
5715         return true;
5716 }
5717
5718 static bool api_spoolss_DeletePrinterData(pipes_struct *p)
5719 {
5720         const struct ndr_interface_call *call;
5721         struct ndr_pull *pull;
5722         struct ndr_push *push;
5723         enum ndr_err_code ndr_err;
5724         DATA_BLOB blob;
5725         struct spoolss_DeletePrinterData *r;
5726
5727         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATA];
5728
5729         r = talloc(talloc_tos(), struct spoolss_DeletePrinterData);
5730         if (r == NULL) {
5731                 return false;
5732         }
5733
5734         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5735                 talloc_free(r);
5736                 return false;
5737         }
5738
5739         pull = ndr_pull_init_blob(&blob, r, NULL);
5740         if (pull == NULL) {
5741                 talloc_free(r);
5742                 return false;
5743         }
5744
5745         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5746         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5747         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5748                 talloc_free(r);
5749                 return false;
5750         }
5751
5752         if (DEBUGLEVEL >= 10) {
5753                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterData, r);
5754         }
5755
5756         r->out.result = _spoolss_DeletePrinterData(p, r);
5757
5758         if (p->rng_fault_state) {
5759                 talloc_free(r);
5760                 /* Return true here, srv_pipe_hnd.c will take care */
5761                 return true;
5762         }
5763
5764         if (DEBUGLEVEL >= 10) {
5765                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterData, r);
5766         }
5767
5768         push = ndr_push_init_ctx(r, NULL);
5769         if (push == NULL) {
5770                 talloc_free(r);
5771                 return false;
5772         }
5773
5774         ndr_err = call->ndr_push(push, NDR_OUT, r);
5775         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5776                 talloc_free(r);
5777                 return false;
5778         }
5779
5780         blob = ndr_push_blob(push);
5781         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5782                 talloc_free(r);
5783                 return false;
5784         }
5785
5786         talloc_free(r);
5787
5788         return true;
5789 }
5790
5791 static bool api_spoolss_4a(pipes_struct *p)
5792 {
5793         const struct ndr_interface_call *call;
5794         struct ndr_pull *pull;
5795         struct ndr_push *push;
5796         enum ndr_err_code ndr_err;
5797         DATA_BLOB blob;
5798         struct spoolss_4a *r;
5799
5800         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4A];
5801
5802         r = talloc(talloc_tos(), struct spoolss_4a);
5803         if (r == NULL) {
5804                 return false;
5805         }
5806
5807         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5808                 talloc_free(r);
5809                 return false;
5810         }
5811
5812         pull = ndr_pull_init_blob(&blob, r, NULL);
5813         if (pull == NULL) {
5814                 talloc_free(r);
5815                 return false;
5816         }
5817
5818         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5819         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5820         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5821                 talloc_free(r);
5822                 return false;
5823         }
5824
5825         if (DEBUGLEVEL >= 10) {
5826                 NDR_PRINT_IN_DEBUG(spoolss_4a, r);
5827         }
5828
5829         r->out.result = _spoolss_4a(p, r);
5830
5831         if (p->rng_fault_state) {
5832                 talloc_free(r);
5833                 /* Return true here, srv_pipe_hnd.c will take care */
5834                 return true;
5835         }
5836
5837         if (DEBUGLEVEL >= 10) {
5838                 NDR_PRINT_OUT_DEBUG(spoolss_4a, r);
5839         }
5840
5841         push = ndr_push_init_ctx(r, NULL);
5842         if (push == NULL) {
5843                 talloc_free(r);
5844                 return false;
5845         }
5846
5847         ndr_err = call->ndr_push(push, NDR_OUT, r);
5848         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5849                 talloc_free(r);
5850                 return false;
5851         }
5852
5853         blob = ndr_push_blob(push);
5854         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5855                 talloc_free(r);
5856                 return false;
5857         }
5858
5859         talloc_free(r);
5860
5861         return true;
5862 }
5863
5864 static bool api_spoolss_4b(pipes_struct *p)
5865 {
5866         const struct ndr_interface_call *call;
5867         struct ndr_pull *pull;
5868         struct ndr_push *push;
5869         enum ndr_err_code ndr_err;
5870         DATA_BLOB blob;
5871         struct spoolss_4b *r;
5872
5873         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4B];
5874
5875         r = talloc(talloc_tos(), struct spoolss_4b);
5876         if (r == NULL) {
5877                 return false;
5878         }
5879
5880         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5881                 talloc_free(r);
5882                 return false;
5883         }
5884
5885         pull = ndr_pull_init_blob(&blob, r, NULL);
5886         if (pull == NULL) {
5887                 talloc_free(r);
5888                 return false;
5889         }
5890
5891         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5892         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5893         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5894                 talloc_free(r);
5895                 return false;
5896         }
5897
5898         if (DEBUGLEVEL >= 10) {
5899                 NDR_PRINT_IN_DEBUG(spoolss_4b, r);
5900         }
5901
5902         r->out.result = _spoolss_4b(p, r);
5903
5904         if (p->rng_fault_state) {
5905                 talloc_free(r);
5906                 /* Return true here, srv_pipe_hnd.c will take care */
5907                 return true;
5908         }
5909
5910         if (DEBUGLEVEL >= 10) {
5911                 NDR_PRINT_OUT_DEBUG(spoolss_4b, r);
5912         }
5913
5914         push = ndr_push_init_ctx(r, NULL);
5915         if (push == NULL) {
5916                 talloc_free(r);
5917                 return false;
5918         }
5919
5920         ndr_err = call->ndr_push(push, NDR_OUT, r);
5921         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5922                 talloc_free(r);
5923                 return false;
5924         }
5925
5926         blob = ndr_push_blob(push);
5927         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5928                 talloc_free(r);
5929                 return false;
5930         }
5931
5932         talloc_free(r);
5933
5934         return true;
5935 }
5936
5937 static bool api_spoolss_4c(pipes_struct *p)
5938 {
5939         const struct ndr_interface_call *call;
5940         struct ndr_pull *pull;
5941         struct ndr_push *push;
5942         enum ndr_err_code ndr_err;
5943         DATA_BLOB blob;
5944         struct spoolss_4c *r;
5945
5946         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4C];
5947
5948         r = talloc(talloc_tos(), struct spoolss_4c);
5949         if (r == NULL) {
5950                 return false;
5951         }
5952
5953         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5954                 talloc_free(r);
5955                 return false;
5956         }
5957
5958         pull = ndr_pull_init_blob(&blob, r, NULL);
5959         if (pull == NULL) {
5960                 talloc_free(r);
5961                 return false;
5962         }
5963
5964         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5965         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5966         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5967                 talloc_free(r);
5968                 return false;
5969         }
5970
5971         if (DEBUGLEVEL >= 10) {
5972                 NDR_PRINT_IN_DEBUG(spoolss_4c, r);
5973         }
5974
5975         r->out.result = _spoolss_4c(p, r);
5976
5977         if (p->rng_fault_state) {
5978                 talloc_free(r);
5979                 /* Return true here, srv_pipe_hnd.c will take care */
5980                 return true;
5981         }
5982
5983         if (DEBUGLEVEL >= 10) {
5984                 NDR_PRINT_OUT_DEBUG(spoolss_4c, r);
5985         }
5986
5987         push = ndr_push_init_ctx(r, NULL);
5988         if (push == NULL) {
5989                 talloc_free(r);
5990                 return false;
5991         }
5992
5993         ndr_err = call->ndr_push(push, NDR_OUT, r);
5994         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5995                 talloc_free(r);
5996                 return false;
5997         }
5998
5999         blob = ndr_push_blob(push);
6000         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6001                 talloc_free(r);
6002                 return false;
6003         }
6004
6005         talloc_free(r);
6006
6007         return true;
6008 }
6009
6010 static bool api_spoolss_SetPrinterDataEx(pipes_struct *p)
6011 {
6012         const struct ndr_interface_call *call;
6013         struct ndr_pull *pull;
6014         struct ndr_push *push;
6015         enum ndr_err_code ndr_err;
6016         DATA_BLOB blob;
6017         struct spoolss_SetPrinterDataEx *r;
6018
6019         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATAEX];
6020
6021         r = talloc(talloc_tos(), struct spoolss_SetPrinterDataEx);
6022         if (r == NULL) {
6023                 return false;
6024         }
6025
6026         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6027                 talloc_free(r);
6028                 return false;
6029         }
6030
6031         pull = ndr_pull_init_blob(&blob, r, NULL);
6032         if (pull == NULL) {
6033                 talloc_free(r);
6034                 return false;
6035         }
6036
6037         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6038         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6039         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6040                 talloc_free(r);
6041                 return false;
6042         }
6043
6044         if (DEBUGLEVEL >= 10) {
6045                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterDataEx, r);
6046         }
6047
6048         r->out.result = _spoolss_SetPrinterDataEx(p, r);
6049
6050         if (p->rng_fault_state) {
6051                 talloc_free(r);
6052                 /* Return true here, srv_pipe_hnd.c will take care */
6053                 return true;
6054         }
6055
6056         if (DEBUGLEVEL >= 10) {
6057                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterDataEx, r);
6058         }
6059
6060         push = ndr_push_init_ctx(r, NULL);
6061         if (push == NULL) {
6062                 talloc_free(r);
6063                 return false;
6064         }
6065
6066         ndr_err = call->ndr_push(push, NDR_OUT, r);
6067         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6068                 talloc_free(r);
6069                 return false;
6070         }
6071
6072         blob = ndr_push_blob(push);
6073         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6074                 talloc_free(r);
6075                 return false;
6076         }
6077
6078         talloc_free(r);
6079
6080         return true;
6081 }
6082
6083 static bool api_spoolss_GetPrinterDataEx(pipes_struct *p)
6084 {
6085         const struct ndr_interface_call *call;
6086         struct ndr_pull *pull;
6087         struct ndr_push *push;
6088         enum ndr_err_code ndr_err;
6089         DATA_BLOB blob;
6090         struct spoolss_GetPrinterDataEx *r;
6091
6092         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATAEX];
6093
6094         r = talloc(talloc_tos(), struct spoolss_GetPrinterDataEx);
6095         if (r == NULL) {
6096                 return false;
6097         }
6098
6099         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6100                 talloc_free(r);
6101                 return false;
6102         }
6103
6104         pull = ndr_pull_init_blob(&blob, r, NULL);
6105         if (pull == NULL) {
6106                 talloc_free(r);
6107                 return false;
6108         }
6109
6110         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6111         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6112         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6113                 talloc_free(r);
6114                 return false;
6115         }
6116
6117         if (DEBUGLEVEL >= 10) {
6118                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDataEx, r);
6119         }
6120
6121         ZERO_STRUCT(r->out);
6122         r->out.type = talloc_zero(r, enum winreg_Type);
6123         if (r->out.type == NULL) {
6124                 talloc_free(r);
6125                 return false;
6126         }
6127
6128         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6129         if (r->out.buffer == NULL) {
6130                 talloc_free(r);
6131                 return false;
6132         }
6133
6134         r->out.needed = talloc_zero(r, uint32_t);
6135         if (r->out.needed == NULL) {
6136                 talloc_free(r);
6137                 return false;
6138         }
6139
6140         r->out.result = _spoolss_GetPrinterDataEx(p, r);
6141
6142         if (p->rng_fault_state) {
6143                 talloc_free(r);
6144                 /* Return true here, srv_pipe_hnd.c will take care */
6145                 return true;
6146         }
6147
6148         if (DEBUGLEVEL >= 10) {
6149                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDataEx, r);
6150         }
6151
6152         push = ndr_push_init_ctx(r, NULL);
6153         if (push == NULL) {
6154                 talloc_free(r);
6155                 return false;
6156         }
6157
6158         ndr_err = call->ndr_push(push, NDR_OUT, r);
6159         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6160                 talloc_free(r);
6161                 return false;
6162         }
6163
6164         blob = ndr_push_blob(push);
6165         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6166                 talloc_free(r);
6167                 return false;
6168         }
6169
6170         talloc_free(r);
6171
6172         return true;
6173 }
6174
6175 static bool api_spoolss_EnumPrinterDataEx(pipes_struct *p)
6176 {
6177         const struct ndr_interface_call *call;
6178         struct ndr_pull *pull;
6179         struct ndr_push *push;
6180         enum ndr_err_code ndr_err;
6181         DATA_BLOB blob;
6182         struct spoolss_EnumPrinterDataEx *r;
6183
6184         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATAEX];
6185
6186         r = talloc(talloc_tos(), struct spoolss_EnumPrinterDataEx);
6187         if (r == NULL) {
6188                 return false;
6189         }
6190
6191         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6192                 talloc_free(r);
6193                 return false;
6194         }
6195
6196         pull = ndr_pull_init_blob(&blob, r, NULL);
6197         if (pull == NULL) {
6198                 talloc_free(r);
6199                 return false;
6200         }
6201
6202         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6203         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6204         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6205                 talloc_free(r);
6206                 return false;
6207         }
6208
6209         if (DEBUGLEVEL >= 10) {
6210                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDataEx, r);
6211         }
6212
6213         ZERO_STRUCT(r->out);
6214         r->out.count = talloc_zero(r, uint32_t);
6215         if (r->out.count == NULL) {
6216                 talloc_free(r);
6217                 return false;
6218         }
6219
6220         r->out.info = talloc_zero(r, struct spoolss_PrinterEnumValues *);
6221         if (r->out.info == NULL) {
6222                 talloc_free(r);
6223                 return false;
6224         }
6225
6226         r->out.needed = talloc_zero(r, uint32_t);
6227         if (r->out.needed == NULL) {
6228                 talloc_free(r);
6229                 return false;
6230         }
6231
6232         r->out.result = _spoolss_EnumPrinterDataEx(p, r);
6233
6234         if (p->rng_fault_state) {
6235                 talloc_free(r);
6236                 /* Return true here, srv_pipe_hnd.c will take care */
6237                 return true;
6238         }
6239
6240         if (DEBUGLEVEL >= 10) {
6241                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDataEx, r);
6242         }
6243
6244         push = ndr_push_init_ctx(r, NULL);
6245         if (push == NULL) {
6246                 talloc_free(r);
6247                 return false;
6248         }
6249
6250         ndr_err = call->ndr_push(push, NDR_OUT, r);
6251         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6252                 talloc_free(r);
6253                 return false;
6254         }
6255
6256         blob = ndr_push_blob(push);
6257         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6258                 talloc_free(r);
6259                 return false;
6260         }
6261
6262         talloc_free(r);
6263
6264         return true;
6265 }
6266
6267 static bool api_spoolss_EnumPrinterKey(pipes_struct *p)
6268 {
6269         const struct ndr_interface_call *call;
6270         struct ndr_pull *pull;
6271         struct ndr_push *push;
6272         enum ndr_err_code ndr_err;
6273         DATA_BLOB blob;
6274         struct spoolss_EnumPrinterKey *r;
6275
6276         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERKEY];
6277
6278         r = talloc(talloc_tos(), struct spoolss_EnumPrinterKey);
6279         if (r == NULL) {
6280                 return false;
6281         }
6282
6283         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6284                 talloc_free(r);
6285                 return false;
6286         }
6287
6288         pull = ndr_pull_init_blob(&blob, r, NULL);
6289         if (pull == NULL) {
6290                 talloc_free(r);
6291                 return false;
6292         }
6293
6294         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6295         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6296         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6297                 talloc_free(r);
6298                 return false;
6299         }
6300
6301         if (DEBUGLEVEL >= 10) {
6302                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, r);
6303         }
6304
6305         ZERO_STRUCT(r->out);
6306         r->out.key_buffer = talloc_zero(r, const char **);
6307         if (r->out.key_buffer == NULL) {
6308                 talloc_free(r);
6309                 return false;
6310         }
6311
6312         r->out.needed = talloc_zero(r, uint32_t);
6313         if (r->out.needed == NULL) {
6314                 talloc_free(r);
6315                 return false;
6316         }
6317
6318         r->out.result = _spoolss_EnumPrinterKey(p, r);
6319
6320         if (p->rng_fault_state) {
6321                 talloc_free(r);
6322                 /* Return true here, srv_pipe_hnd.c will take care */
6323                 return true;
6324         }
6325
6326         if (DEBUGLEVEL >= 10) {
6327                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterKey, r);
6328         }
6329
6330         push = ndr_push_init_ctx(r, NULL);
6331         if (push == NULL) {
6332                 talloc_free(r);
6333                 return false;
6334         }
6335
6336         ndr_err = call->ndr_push(push, NDR_OUT, r);
6337         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6338                 talloc_free(r);
6339                 return false;
6340         }
6341
6342         blob = ndr_push_blob(push);
6343         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6344                 talloc_free(r);
6345                 return false;
6346         }
6347
6348         talloc_free(r);
6349
6350         return true;
6351 }
6352
6353 static bool api_spoolss_DeletePrinterDataEx(pipes_struct *p)
6354 {
6355         const struct ndr_interface_call *call;
6356         struct ndr_pull *pull;
6357         struct ndr_push *push;
6358         enum ndr_err_code ndr_err;
6359         DATA_BLOB blob;
6360         struct spoolss_DeletePrinterDataEx *r;
6361
6362         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATAEX];
6363
6364         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDataEx);
6365         if (r == NULL) {
6366                 return false;
6367         }
6368
6369         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6370                 talloc_free(r);
6371                 return false;
6372         }
6373
6374         pull = ndr_pull_init_blob(&blob, r, NULL);
6375         if (pull == NULL) {
6376                 talloc_free(r);
6377                 return false;
6378         }
6379
6380         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6381         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6382         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6383                 talloc_free(r);
6384                 return false;
6385         }
6386
6387         if (DEBUGLEVEL >= 10) {
6388                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDataEx, r);
6389         }
6390
6391         r->out.result = _spoolss_DeletePrinterDataEx(p, r);
6392
6393         if (p->rng_fault_state) {
6394                 talloc_free(r);
6395                 /* Return true here, srv_pipe_hnd.c will take care */
6396                 return true;
6397         }
6398
6399         if (DEBUGLEVEL >= 10) {
6400                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDataEx, r);
6401         }
6402
6403         push = ndr_push_init_ctx(r, NULL);
6404         if (push == NULL) {
6405                 talloc_free(r);
6406                 return false;
6407         }
6408
6409         ndr_err = call->ndr_push(push, NDR_OUT, r);
6410         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6411                 talloc_free(r);
6412                 return false;
6413         }
6414
6415         blob = ndr_push_blob(push);
6416         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6417                 talloc_free(r);
6418                 return false;
6419         }
6420
6421         talloc_free(r);
6422
6423         return true;
6424 }
6425
6426 static bool api_spoolss_DeletePrinterKey(pipes_struct *p)
6427 {
6428         const struct ndr_interface_call *call;
6429         struct ndr_pull *pull;
6430         struct ndr_push *push;
6431         enum ndr_err_code ndr_err;
6432         DATA_BLOB blob;
6433         struct spoolss_DeletePrinterKey *r;
6434
6435         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERKEY];
6436
6437         r = talloc(talloc_tos(), struct spoolss_DeletePrinterKey);
6438         if (r == NULL) {
6439                 return false;
6440         }
6441
6442         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6443                 talloc_free(r);
6444                 return false;
6445         }
6446
6447         pull = ndr_pull_init_blob(&blob, r, NULL);
6448         if (pull == NULL) {
6449                 talloc_free(r);
6450                 return false;
6451         }
6452
6453         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6454         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6455         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6456                 talloc_free(r);
6457                 return false;
6458         }
6459
6460         if (DEBUGLEVEL >= 10) {
6461                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterKey, r);
6462         }
6463
6464         r->out.result = _spoolss_DeletePrinterKey(p, r);
6465
6466         if (p->rng_fault_state) {
6467                 talloc_free(r);
6468                 /* Return true here, srv_pipe_hnd.c will take care */
6469                 return true;
6470         }
6471
6472         if (DEBUGLEVEL >= 10) {
6473                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterKey, r);
6474         }
6475
6476         push = ndr_push_init_ctx(r, NULL);
6477         if (push == NULL) {
6478                 talloc_free(r);
6479                 return false;
6480         }
6481
6482         ndr_err = call->ndr_push(push, NDR_OUT, r);
6483         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6484                 talloc_free(r);
6485                 return false;
6486         }
6487
6488         blob = ndr_push_blob(push);
6489         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6490                 talloc_free(r);
6491                 return false;
6492         }
6493
6494         talloc_free(r);
6495
6496         return true;
6497 }
6498
6499 static bool api_spoolss_53(pipes_struct *p)
6500 {
6501         const struct ndr_interface_call *call;
6502         struct ndr_pull *pull;
6503         struct ndr_push *push;
6504         enum ndr_err_code ndr_err;
6505         DATA_BLOB blob;
6506         struct spoolss_53 *r;
6507
6508         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_53];
6509
6510         r = talloc(talloc_tos(), struct spoolss_53);
6511         if (r == NULL) {
6512                 return false;
6513         }
6514
6515         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6516                 talloc_free(r);
6517                 return false;
6518         }
6519
6520         pull = ndr_pull_init_blob(&blob, r, NULL);
6521         if (pull == NULL) {
6522                 talloc_free(r);
6523                 return false;
6524         }
6525
6526         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6527         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6528         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6529                 talloc_free(r);
6530                 return false;
6531         }
6532
6533         if (DEBUGLEVEL >= 10) {
6534                 NDR_PRINT_IN_DEBUG(spoolss_53, r);
6535         }
6536
6537         r->out.result = _spoolss_53(p, r);
6538
6539         if (p->rng_fault_state) {
6540                 talloc_free(r);
6541                 /* Return true here, srv_pipe_hnd.c will take care */
6542                 return true;
6543         }
6544
6545         if (DEBUGLEVEL >= 10) {
6546                 NDR_PRINT_OUT_DEBUG(spoolss_53, r);
6547         }
6548
6549         push = ndr_push_init_ctx(r, NULL);
6550         if (push == NULL) {
6551                 talloc_free(r);
6552                 return false;
6553         }
6554
6555         ndr_err = call->ndr_push(push, NDR_OUT, r);
6556         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6557                 talloc_free(r);
6558                 return false;
6559         }
6560
6561         blob = ndr_push_blob(push);
6562         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6563                 talloc_free(r);
6564                 return false;
6565         }
6566
6567         talloc_free(r);
6568
6569         return true;
6570 }
6571
6572 static bool api_spoolss_DeletePrinterDriverEx(pipes_struct *p)
6573 {
6574         const struct ndr_interface_call *call;
6575         struct ndr_pull *pull;
6576         struct ndr_push *push;
6577         enum ndr_err_code ndr_err;
6578         DATA_BLOB blob;
6579         struct spoolss_DeletePrinterDriverEx *r;
6580
6581         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVEREX];
6582
6583         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriverEx);
6584         if (r == NULL) {
6585                 return false;
6586         }
6587
6588         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6589                 talloc_free(r);
6590                 return false;
6591         }
6592
6593         pull = ndr_pull_init_blob(&blob, r, NULL);
6594         if (pull == NULL) {
6595                 talloc_free(r);
6596                 return false;
6597         }
6598
6599         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6600         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6601         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6602                 talloc_free(r);
6603                 return false;
6604         }
6605
6606         if (DEBUGLEVEL >= 10) {
6607                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriverEx, r);
6608         }
6609
6610         r->out.result = _spoolss_DeletePrinterDriverEx(p, r);
6611
6612         if (p->rng_fault_state) {
6613                 talloc_free(r);
6614                 /* Return true here, srv_pipe_hnd.c will take care */
6615                 return true;
6616         }
6617
6618         if (DEBUGLEVEL >= 10) {
6619                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriverEx, r);
6620         }
6621
6622         push = ndr_push_init_ctx(r, NULL);
6623         if (push == NULL) {
6624                 talloc_free(r);
6625                 return false;
6626         }
6627
6628         ndr_err = call->ndr_push(push, NDR_OUT, r);
6629         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6630                 talloc_free(r);
6631                 return false;
6632         }
6633
6634         blob = ndr_push_blob(push);
6635         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6636                 talloc_free(r);
6637                 return false;
6638         }
6639
6640         talloc_free(r);
6641
6642         return true;
6643 }
6644
6645 static bool api_spoolss_55(pipes_struct *p)
6646 {
6647         const struct ndr_interface_call *call;
6648         struct ndr_pull *pull;
6649         struct ndr_push *push;
6650         enum ndr_err_code ndr_err;
6651         DATA_BLOB blob;
6652         struct spoolss_55 *r;
6653
6654         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_55];
6655
6656         r = talloc(talloc_tos(), struct spoolss_55);
6657         if (r == NULL) {
6658                 return false;
6659         }
6660
6661         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6662                 talloc_free(r);
6663                 return false;
6664         }
6665
6666         pull = ndr_pull_init_blob(&blob, r, NULL);
6667         if (pull == NULL) {
6668                 talloc_free(r);
6669                 return false;
6670         }
6671
6672         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6673         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6674         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6675                 talloc_free(r);
6676                 return false;
6677         }
6678
6679         if (DEBUGLEVEL >= 10) {
6680                 NDR_PRINT_IN_DEBUG(spoolss_55, r);
6681         }
6682
6683         r->out.result = _spoolss_55(p, r);
6684
6685         if (p->rng_fault_state) {
6686                 talloc_free(r);
6687                 /* Return true here, srv_pipe_hnd.c will take care */
6688                 return true;
6689         }
6690
6691         if (DEBUGLEVEL >= 10) {
6692                 NDR_PRINT_OUT_DEBUG(spoolss_55, r);
6693         }
6694
6695         push = ndr_push_init_ctx(r, NULL);
6696         if (push == NULL) {
6697                 talloc_free(r);
6698                 return false;
6699         }
6700
6701         ndr_err = call->ndr_push(push, NDR_OUT, r);
6702         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6703                 talloc_free(r);
6704                 return false;
6705         }
6706
6707         blob = ndr_push_blob(push);
6708         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6709                 talloc_free(r);
6710                 return false;
6711         }
6712
6713         talloc_free(r);
6714
6715         return true;
6716 }
6717
6718 static bool api_spoolss_56(pipes_struct *p)
6719 {
6720         const struct ndr_interface_call *call;
6721         struct ndr_pull *pull;
6722         struct ndr_push *push;
6723         enum ndr_err_code ndr_err;
6724         DATA_BLOB blob;
6725         struct spoolss_56 *r;
6726
6727         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_56];
6728
6729         r = talloc(talloc_tos(), struct spoolss_56);
6730         if (r == NULL) {
6731                 return false;
6732         }
6733
6734         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6735                 talloc_free(r);
6736                 return false;
6737         }
6738
6739         pull = ndr_pull_init_blob(&blob, r, NULL);
6740         if (pull == NULL) {
6741                 talloc_free(r);
6742                 return false;
6743         }
6744
6745         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6746         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6747         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6748                 talloc_free(r);
6749                 return false;
6750         }
6751
6752         if (DEBUGLEVEL >= 10) {
6753                 NDR_PRINT_IN_DEBUG(spoolss_56, r);
6754         }
6755
6756         r->out.result = _spoolss_56(p, r);
6757
6758         if (p->rng_fault_state) {
6759                 talloc_free(r);
6760                 /* Return true here, srv_pipe_hnd.c will take care */
6761                 return true;
6762         }
6763
6764         if (DEBUGLEVEL >= 10) {
6765                 NDR_PRINT_OUT_DEBUG(spoolss_56, r);
6766         }
6767
6768         push = ndr_push_init_ctx(r, NULL);
6769         if (push == NULL) {
6770                 talloc_free(r);
6771                 return false;
6772         }
6773
6774         ndr_err = call->ndr_push(push, NDR_OUT, r);
6775         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6776                 talloc_free(r);
6777                 return false;
6778         }
6779
6780         blob = ndr_push_blob(push);
6781         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6782                 talloc_free(r);
6783                 return false;
6784         }
6785
6786         talloc_free(r);
6787
6788         return true;
6789 }
6790
6791 static bool api_spoolss_57(pipes_struct *p)
6792 {
6793         const struct ndr_interface_call *call;
6794         struct ndr_pull *pull;
6795         struct ndr_push *push;
6796         enum ndr_err_code ndr_err;
6797         DATA_BLOB blob;
6798         struct spoolss_57 *r;
6799
6800         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_57];
6801
6802         r = talloc(talloc_tos(), struct spoolss_57);
6803         if (r == NULL) {
6804                 return false;
6805         }
6806
6807         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6808                 talloc_free(r);
6809                 return false;
6810         }
6811
6812         pull = ndr_pull_init_blob(&blob, r, NULL);
6813         if (pull == NULL) {
6814                 talloc_free(r);
6815                 return false;
6816         }
6817
6818         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6819         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6820         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6821                 talloc_free(r);
6822                 return false;
6823         }
6824
6825         if (DEBUGLEVEL >= 10) {
6826                 NDR_PRINT_IN_DEBUG(spoolss_57, r);
6827         }
6828
6829         r->out.result = _spoolss_57(p, r);
6830
6831         if (p->rng_fault_state) {
6832                 talloc_free(r);
6833                 /* Return true here, srv_pipe_hnd.c will take care */
6834                 return true;
6835         }
6836
6837         if (DEBUGLEVEL >= 10) {
6838                 NDR_PRINT_OUT_DEBUG(spoolss_57, r);
6839         }
6840
6841         push = ndr_push_init_ctx(r, NULL);
6842         if (push == NULL) {
6843                 talloc_free(r);
6844                 return false;
6845         }
6846
6847         ndr_err = call->ndr_push(push, NDR_OUT, r);
6848         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6849                 talloc_free(r);
6850                 return false;
6851         }
6852
6853         blob = ndr_push_blob(push);
6854         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6855                 talloc_free(r);
6856                 return false;
6857         }
6858
6859         talloc_free(r);
6860
6861         return true;
6862 }
6863
6864 static bool api_spoolss_XcvData(pipes_struct *p)
6865 {
6866         const struct ndr_interface_call *call;
6867         struct ndr_pull *pull;
6868         struct ndr_push *push;
6869         enum ndr_err_code ndr_err;
6870         DATA_BLOB blob;
6871         struct spoolss_XcvData *r;
6872
6873         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_XCVDATA];
6874
6875         r = talloc(talloc_tos(), struct spoolss_XcvData);
6876         if (r == NULL) {
6877                 return false;
6878         }
6879
6880         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6881                 talloc_free(r);
6882                 return false;
6883         }
6884
6885         pull = ndr_pull_init_blob(&blob, r, NULL);
6886         if (pull == NULL) {
6887                 talloc_free(r);
6888                 return false;
6889         }
6890
6891         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6892         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6893         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6894                 talloc_free(r);
6895                 return false;
6896         }
6897
6898         if (DEBUGLEVEL >= 10) {
6899                 NDR_PRINT_IN_DEBUG(spoolss_XcvData, r);
6900         }
6901
6902         ZERO_STRUCT(r->out);
6903         r->out.status_code = r->in.status_code;
6904         r->out.out_data = talloc_zero_array(r, uint8_t, r->in.out_data_size);
6905         if (r->out.out_data == NULL) {
6906                 talloc_free(r);
6907                 return false;
6908         }
6909
6910         r->out.needed = talloc_zero(r, uint32_t);
6911         if (r->out.needed == NULL) {
6912                 talloc_free(r);
6913                 return false;
6914         }
6915
6916         r->out.result = _spoolss_XcvData(p, r);
6917
6918         if (p->rng_fault_state) {
6919                 talloc_free(r);
6920                 /* Return true here, srv_pipe_hnd.c will take care */
6921                 return true;
6922         }
6923
6924         if (DEBUGLEVEL >= 10) {
6925                 NDR_PRINT_OUT_DEBUG(spoolss_XcvData, r);
6926         }
6927
6928         push = ndr_push_init_ctx(r, NULL);
6929         if (push == NULL) {
6930                 talloc_free(r);
6931                 return false;
6932         }
6933
6934         ndr_err = call->ndr_push(push, NDR_OUT, r);
6935         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6936                 talloc_free(r);
6937                 return false;
6938         }
6939
6940         blob = ndr_push_blob(push);
6941         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6942                 talloc_free(r);
6943                 return false;
6944         }
6945
6946         talloc_free(r);
6947
6948         return true;
6949 }
6950
6951 static bool api_spoolss_AddPrinterDriverEx(pipes_struct *p)
6952 {
6953         const struct ndr_interface_call *call;
6954         struct ndr_pull *pull;
6955         struct ndr_push *push;
6956         enum ndr_err_code ndr_err;
6957         DATA_BLOB blob;
6958         struct spoolss_AddPrinterDriverEx *r;
6959
6960         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERDRIVEREX];
6961
6962         r = talloc(talloc_tos(), struct spoolss_AddPrinterDriverEx);
6963         if (r == NULL) {
6964                 return false;
6965         }
6966
6967         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6968                 talloc_free(r);
6969                 return false;
6970         }
6971
6972         pull = ndr_pull_init_blob(&blob, r, NULL);
6973         if (pull == NULL) {
6974                 talloc_free(r);
6975                 return false;
6976         }
6977
6978         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6979         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6980         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6981                 talloc_free(r);
6982                 return false;
6983         }
6984
6985         if (DEBUGLEVEL >= 10) {
6986                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriverEx, r);
6987         }
6988
6989         r->out.result = _spoolss_AddPrinterDriverEx(p, r);
6990
6991         if (p->rng_fault_state) {
6992                 talloc_free(r);
6993                 /* Return true here, srv_pipe_hnd.c will take care */
6994                 return true;
6995         }
6996
6997         if (DEBUGLEVEL >= 10) {
6998                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriverEx, r);
6999         }
7000
7001         push = ndr_push_init_ctx(r, NULL);
7002         if (push == NULL) {
7003                 talloc_free(r);
7004                 return false;
7005         }
7006
7007         ndr_err = call->ndr_push(push, NDR_OUT, r);
7008         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7009                 talloc_free(r);
7010                 return false;
7011         }
7012
7013         blob = ndr_push_blob(push);
7014         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7015                 talloc_free(r);
7016                 return false;
7017         }
7018
7019         talloc_free(r);
7020
7021         return true;
7022 }
7023
7024 static bool api_spoolss_5a(pipes_struct *p)
7025 {
7026         const struct ndr_interface_call *call;
7027         struct ndr_pull *pull;
7028         struct ndr_push *push;
7029         enum ndr_err_code ndr_err;
7030         DATA_BLOB blob;
7031         struct spoolss_5a *r;
7032
7033         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5A];
7034
7035         r = talloc(talloc_tos(), struct spoolss_5a);
7036         if (r == NULL) {
7037                 return false;
7038         }
7039
7040         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7041                 talloc_free(r);
7042                 return false;
7043         }
7044
7045         pull = ndr_pull_init_blob(&blob, r, NULL);
7046         if (pull == NULL) {
7047                 talloc_free(r);
7048                 return false;
7049         }
7050
7051         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7052         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7053         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7054                 talloc_free(r);
7055                 return false;
7056         }
7057
7058         if (DEBUGLEVEL >= 10) {
7059                 NDR_PRINT_IN_DEBUG(spoolss_5a, r);
7060         }
7061
7062         r->out.result = _spoolss_5a(p, r);
7063
7064         if (p->rng_fault_state) {
7065                 talloc_free(r);
7066                 /* Return true here, srv_pipe_hnd.c will take care */
7067                 return true;
7068         }
7069
7070         if (DEBUGLEVEL >= 10) {
7071                 NDR_PRINT_OUT_DEBUG(spoolss_5a, r);
7072         }
7073
7074         push = ndr_push_init_ctx(r, NULL);
7075         if (push == NULL) {
7076                 talloc_free(r);
7077                 return false;
7078         }
7079
7080         ndr_err = call->ndr_push(push, NDR_OUT, r);
7081         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7082                 talloc_free(r);
7083                 return false;
7084         }
7085
7086         blob = ndr_push_blob(push);
7087         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7088                 talloc_free(r);
7089                 return false;
7090         }
7091
7092         talloc_free(r);
7093
7094         return true;
7095 }
7096
7097 static bool api_spoolss_5b(pipes_struct *p)
7098 {
7099         const struct ndr_interface_call *call;
7100         struct ndr_pull *pull;
7101         struct ndr_push *push;
7102         enum ndr_err_code ndr_err;
7103         DATA_BLOB blob;
7104         struct spoolss_5b *r;
7105
7106         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5B];
7107
7108         r = talloc(talloc_tos(), struct spoolss_5b);
7109         if (r == NULL) {
7110                 return false;
7111         }
7112
7113         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7114                 talloc_free(r);
7115                 return false;
7116         }
7117
7118         pull = ndr_pull_init_blob(&blob, r, NULL);
7119         if (pull == NULL) {
7120                 talloc_free(r);
7121                 return false;
7122         }
7123
7124         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7125         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7126         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7127                 talloc_free(r);
7128                 return false;
7129         }
7130
7131         if (DEBUGLEVEL >= 10) {
7132                 NDR_PRINT_IN_DEBUG(spoolss_5b, r);
7133         }
7134
7135         r->out.result = _spoolss_5b(p, r);
7136
7137         if (p->rng_fault_state) {
7138                 talloc_free(r);
7139                 /* Return true here, srv_pipe_hnd.c will take care */
7140                 return true;
7141         }
7142
7143         if (DEBUGLEVEL >= 10) {
7144                 NDR_PRINT_OUT_DEBUG(spoolss_5b, r);
7145         }
7146
7147         push = ndr_push_init_ctx(r, NULL);
7148         if (push == NULL) {
7149                 talloc_free(r);
7150                 return false;
7151         }
7152
7153         ndr_err = call->ndr_push(push, NDR_OUT, r);
7154         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7155                 talloc_free(r);
7156                 return false;
7157         }
7158
7159         blob = ndr_push_blob(push);
7160         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7161                 talloc_free(r);
7162                 return false;
7163         }
7164
7165         talloc_free(r);
7166
7167         return true;
7168 }
7169
7170 static bool api_spoolss_5c(pipes_struct *p)
7171 {
7172         const struct ndr_interface_call *call;
7173         struct ndr_pull *pull;
7174         struct ndr_push *push;
7175         enum ndr_err_code ndr_err;
7176         DATA_BLOB blob;
7177         struct spoolss_5c *r;
7178
7179         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5C];
7180
7181         r = talloc(talloc_tos(), struct spoolss_5c);
7182         if (r == NULL) {
7183                 return false;
7184         }
7185
7186         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7187                 talloc_free(r);
7188                 return false;
7189         }
7190
7191         pull = ndr_pull_init_blob(&blob, r, NULL);
7192         if (pull == NULL) {
7193                 talloc_free(r);
7194                 return false;
7195         }
7196
7197         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7198         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7199         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7200                 talloc_free(r);
7201                 return false;
7202         }
7203
7204         if (DEBUGLEVEL >= 10) {
7205                 NDR_PRINT_IN_DEBUG(spoolss_5c, r);
7206         }
7207
7208         r->out.result = _spoolss_5c(p, r);
7209
7210         if (p->rng_fault_state) {
7211                 talloc_free(r);
7212                 /* Return true here, srv_pipe_hnd.c will take care */
7213                 return true;
7214         }
7215
7216         if (DEBUGLEVEL >= 10) {
7217                 NDR_PRINT_OUT_DEBUG(spoolss_5c, r);
7218         }
7219
7220         push = ndr_push_init_ctx(r, NULL);
7221         if (push == NULL) {
7222                 talloc_free(r);
7223                 return false;
7224         }
7225
7226         ndr_err = call->ndr_push(push, NDR_OUT, r);
7227         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7228                 talloc_free(r);
7229                 return false;
7230         }
7231
7232         blob = ndr_push_blob(push);
7233         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7234                 talloc_free(r);
7235                 return false;
7236         }
7237
7238         talloc_free(r);
7239
7240         return true;
7241 }
7242
7243 static bool api_spoolss_5d(pipes_struct *p)
7244 {
7245         const struct ndr_interface_call *call;
7246         struct ndr_pull *pull;
7247         struct ndr_push *push;
7248         enum ndr_err_code ndr_err;
7249         DATA_BLOB blob;
7250         struct spoolss_5d *r;
7251
7252         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5D];
7253
7254         r = talloc(talloc_tos(), struct spoolss_5d);
7255         if (r == NULL) {
7256                 return false;
7257         }
7258
7259         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7260                 talloc_free(r);
7261                 return false;
7262         }
7263
7264         pull = ndr_pull_init_blob(&blob, r, NULL);
7265         if (pull == NULL) {
7266                 talloc_free(r);
7267                 return false;
7268         }
7269
7270         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7271         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7272         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7273                 talloc_free(r);
7274                 return false;
7275         }
7276
7277         if (DEBUGLEVEL >= 10) {
7278                 NDR_PRINT_IN_DEBUG(spoolss_5d, r);
7279         }
7280
7281         r->out.result = _spoolss_5d(p, r);
7282
7283         if (p->rng_fault_state) {
7284                 talloc_free(r);
7285                 /* Return true here, srv_pipe_hnd.c will take care */
7286                 return true;
7287         }
7288
7289         if (DEBUGLEVEL >= 10) {
7290                 NDR_PRINT_OUT_DEBUG(spoolss_5d, r);
7291         }
7292
7293         push = ndr_push_init_ctx(r, NULL);
7294         if (push == NULL) {
7295                 talloc_free(r);
7296                 return false;
7297         }
7298
7299         ndr_err = call->ndr_push(push, NDR_OUT, r);
7300         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7301                 talloc_free(r);
7302                 return false;
7303         }
7304
7305         blob = ndr_push_blob(push);
7306         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7307                 talloc_free(r);
7308                 return false;
7309         }
7310
7311         talloc_free(r);
7312
7313         return true;
7314 }
7315
7316 static bool api_spoolss_5e(pipes_struct *p)
7317 {
7318         const struct ndr_interface_call *call;
7319         struct ndr_pull *pull;
7320         struct ndr_push *push;
7321         enum ndr_err_code ndr_err;
7322         DATA_BLOB blob;
7323         struct spoolss_5e *r;
7324
7325         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5E];
7326
7327         r = talloc(talloc_tos(), struct spoolss_5e);
7328         if (r == NULL) {
7329                 return false;
7330         }
7331
7332         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7333                 talloc_free(r);
7334                 return false;
7335         }
7336
7337         pull = ndr_pull_init_blob(&blob, r, NULL);
7338         if (pull == NULL) {
7339                 talloc_free(r);
7340                 return false;
7341         }
7342
7343         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7344         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7345         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7346                 talloc_free(r);
7347                 return false;
7348         }
7349
7350         if (DEBUGLEVEL >= 10) {
7351                 NDR_PRINT_IN_DEBUG(spoolss_5e, r);
7352         }
7353
7354         r->out.result = _spoolss_5e(p, r);
7355
7356         if (p->rng_fault_state) {
7357                 talloc_free(r);
7358                 /* Return true here, srv_pipe_hnd.c will take care */
7359                 return true;
7360         }
7361
7362         if (DEBUGLEVEL >= 10) {
7363                 NDR_PRINT_OUT_DEBUG(spoolss_5e, r);
7364         }
7365
7366         push = ndr_push_init_ctx(r, NULL);
7367         if (push == NULL) {
7368                 talloc_free(r);
7369                 return false;
7370         }
7371
7372         ndr_err = call->ndr_push(push, NDR_OUT, r);
7373         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7374                 talloc_free(r);
7375                 return false;
7376         }
7377
7378         blob = ndr_push_blob(push);
7379         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7380                 talloc_free(r);
7381                 return false;
7382         }
7383
7384         talloc_free(r);
7385
7386         return true;
7387 }
7388
7389 static bool api_spoolss_5f(pipes_struct *p)
7390 {
7391         const struct ndr_interface_call *call;
7392         struct ndr_pull *pull;
7393         struct ndr_push *push;
7394         enum ndr_err_code ndr_err;
7395         DATA_BLOB blob;
7396         struct spoolss_5f *r;
7397
7398         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5F];
7399
7400         r = talloc(talloc_tos(), struct spoolss_5f);
7401         if (r == NULL) {
7402                 return false;
7403         }
7404
7405         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7406                 talloc_free(r);
7407                 return false;
7408         }
7409
7410         pull = ndr_pull_init_blob(&blob, r, NULL);
7411         if (pull == NULL) {
7412                 talloc_free(r);
7413                 return false;
7414         }
7415
7416         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7417         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7418         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7419                 talloc_free(r);
7420                 return false;
7421         }
7422
7423         if (DEBUGLEVEL >= 10) {
7424                 NDR_PRINT_IN_DEBUG(spoolss_5f, r);
7425         }
7426
7427         r->out.result = _spoolss_5f(p, r);
7428
7429         if (p->rng_fault_state) {
7430                 talloc_free(r);
7431                 /* Return true here, srv_pipe_hnd.c will take care */
7432                 return true;
7433         }
7434
7435         if (DEBUGLEVEL >= 10) {
7436                 NDR_PRINT_OUT_DEBUG(spoolss_5f, r);
7437         }
7438
7439         push = ndr_push_init_ctx(r, NULL);
7440         if (push == NULL) {
7441                 talloc_free(r);
7442                 return false;
7443         }
7444
7445         ndr_err = call->ndr_push(push, NDR_OUT, r);
7446         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7447                 talloc_free(r);
7448                 return false;
7449         }
7450
7451         blob = ndr_push_blob(push);
7452         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7453                 talloc_free(r);
7454                 return false;
7455         }
7456
7457         talloc_free(r);
7458
7459         return true;
7460 }
7461
7462
7463 /* Tables */
7464 static struct api_struct api_spoolss_cmds[] = 
7465 {
7466         {"SPOOLSS_ENUMPRINTERS", NDR_SPOOLSS_ENUMPRINTERS, api_spoolss_EnumPrinters},
7467         {"SPOOLSS_OPENPRINTER", NDR_SPOOLSS_OPENPRINTER, api_spoolss_OpenPrinter},
7468         {"SPOOLSS_SETJOB", NDR_SPOOLSS_SETJOB, api_spoolss_SetJob},
7469         {"SPOOLSS_GETJOB", NDR_SPOOLSS_GETJOB, api_spoolss_GetJob},
7470         {"SPOOLSS_ENUMJOBS", NDR_SPOOLSS_ENUMJOBS, api_spoolss_EnumJobs},
7471         {"SPOOLSS_ADDPRINTER", NDR_SPOOLSS_ADDPRINTER, api_spoolss_AddPrinter},
7472         {"SPOOLSS_DELETEPRINTER", NDR_SPOOLSS_DELETEPRINTER, api_spoolss_DeletePrinter},
7473         {"SPOOLSS_SETPRINTER", NDR_SPOOLSS_SETPRINTER, api_spoolss_SetPrinter},
7474         {"SPOOLSS_GETPRINTER", NDR_SPOOLSS_GETPRINTER, api_spoolss_GetPrinter},
7475         {"SPOOLSS_ADDPRINTERDRIVER", NDR_SPOOLSS_ADDPRINTERDRIVER, api_spoolss_AddPrinterDriver},
7476         {"SPOOLSS_ENUMPRINTERDRIVERS", NDR_SPOOLSS_ENUMPRINTERDRIVERS, api_spoolss_EnumPrinterDrivers},
7477         {"SPOOLSS_GETPRINTERDRIVER", NDR_SPOOLSS_GETPRINTERDRIVER, api_spoolss_GetPrinterDriver},
7478         {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_GetPrinterDriverDirectory},
7479         {"SPOOLSS_DELETEPRINTERDRIVER", NDR_SPOOLSS_DELETEPRINTERDRIVER, api_spoolss_DeletePrinterDriver},
7480         {"SPOOLSS_ADDPRINTPROCESSOR", NDR_SPOOLSS_ADDPRINTPROCESSOR, api_spoolss_AddPrintProcessor},
7481         {"SPOOLSS_ENUMPRINTPROCESSORS", NDR_SPOOLSS_ENUMPRINTPROCESSORS, api_spoolss_EnumPrintProcessors},
7482         {"SPOOLSS_GETPRINTPROCESSORDIRECTORY", NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY, api_spoolss_GetPrintProcessorDirectory},
7483         {"SPOOLSS_STARTDOCPRINTER", NDR_SPOOLSS_STARTDOCPRINTER, api_spoolss_StartDocPrinter},
7484         {"SPOOLSS_STARTPAGEPRINTER", NDR_SPOOLSS_STARTPAGEPRINTER, api_spoolss_StartPagePrinter},
7485         {"SPOOLSS_WRITEPRINTER", NDR_SPOOLSS_WRITEPRINTER, api_spoolss_WritePrinter},
7486         {"SPOOLSS_ENDPAGEPRINTER", NDR_SPOOLSS_ENDPAGEPRINTER, api_spoolss_EndPagePrinter},
7487         {"SPOOLSS_ABORTPRINTER", NDR_SPOOLSS_ABORTPRINTER, api_spoolss_AbortPrinter},
7488         {"SPOOLSS_READPRINTER", NDR_SPOOLSS_READPRINTER, api_spoolss_ReadPrinter},
7489         {"SPOOLSS_ENDDOCPRINTER", NDR_SPOOLSS_ENDDOCPRINTER, api_spoolss_EndDocPrinter},
7490         {"SPOOLSS_ADDJOB", NDR_SPOOLSS_ADDJOB, api_spoolss_AddJob},
7491         {"SPOOLSS_SCHEDULEJOB", NDR_SPOOLSS_SCHEDULEJOB, api_spoolss_ScheduleJob},
7492         {"SPOOLSS_GETPRINTERDATA", NDR_SPOOLSS_GETPRINTERDATA, api_spoolss_GetPrinterData},
7493         {"SPOOLSS_SETPRINTERDATA", NDR_SPOOLSS_SETPRINTERDATA, api_spoolss_SetPrinterData},
7494         {"SPOOLSS_WAITFORPRINTERCHANGE", NDR_SPOOLSS_WAITFORPRINTERCHANGE, api_spoolss_WaitForPrinterChange},
7495         {"SPOOLSS_CLOSEPRINTER", NDR_SPOOLSS_CLOSEPRINTER, api_spoolss_ClosePrinter},
7496         {"SPOOLSS_ADDFORM", NDR_SPOOLSS_ADDFORM, api_spoolss_AddForm},
7497         {"SPOOLSS_DELETEFORM", NDR_SPOOLSS_DELETEFORM, api_spoolss_DeleteForm},
7498         {"SPOOLSS_GETFORM", NDR_SPOOLSS_GETFORM, api_spoolss_GetForm},
7499         {"SPOOLSS_SETFORM", NDR_SPOOLSS_SETFORM, api_spoolss_SetForm},
7500         {"SPOOLSS_ENUMFORMS", NDR_SPOOLSS_ENUMFORMS, api_spoolss_EnumForms},
7501         {"SPOOLSS_ENUMPORTS", NDR_SPOOLSS_ENUMPORTS, api_spoolss_EnumPorts},
7502         {"SPOOLSS_ENUMMONITORS", NDR_SPOOLSS_ENUMMONITORS, api_spoolss_EnumMonitors},
7503         {"SPOOLSS_ADDPORT", NDR_SPOOLSS_ADDPORT, api_spoolss_AddPort},
7504         {"SPOOLSS_CONFIGUREPORT", NDR_SPOOLSS_CONFIGUREPORT, api_spoolss_ConfigurePort},
7505         {"SPOOLSS_DELETEPORT", NDR_SPOOLSS_DELETEPORT, api_spoolss_DeletePort},
7506         {"SPOOLSS_CREATEPRINTERIC", NDR_SPOOLSS_CREATEPRINTERIC, api_spoolss_CreatePrinterIC},
7507         {"SPOOLSS_PLAYGDISCRIPTONPRINTERIC", NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC, api_spoolss_PlayGDIScriptOnPrinterIC},
7508         {"SPOOLSS_DELETEPRINTERIC", NDR_SPOOLSS_DELETEPRINTERIC, api_spoolss_DeletePrinterIC},
7509         {"SPOOLSS_ADDPRINTERCONNECTION", NDR_SPOOLSS_ADDPRINTERCONNECTION, api_spoolss_AddPrinterConnection},
7510         {"SPOOLSS_DELETEPRINTERCONNECTION", NDR_SPOOLSS_DELETEPRINTERCONNECTION, api_spoolss_DeletePrinterConnection},
7511         {"SPOOLSS_PRINTERMESSAGEBOX", NDR_SPOOLSS_PRINTERMESSAGEBOX, api_spoolss_PrinterMessageBox},
7512         {"SPOOLSS_ADDMONITOR", NDR_SPOOLSS_ADDMONITOR, api_spoolss_AddMonitor},
7513         {"SPOOLSS_DELETEMONITOR", NDR_SPOOLSS_DELETEMONITOR, api_spoolss_DeleteMonitor},
7514         {"SPOOLSS_DELETEPRINTPROCESSOR", NDR_SPOOLSS_DELETEPRINTPROCESSOR, api_spoolss_DeletePrintProcessor},
7515         {"SPOOLSS_ADDPRINTPROVIDOR", NDR_SPOOLSS_ADDPRINTPROVIDOR, api_spoolss_AddPrintProvidor},
7516         {"SPOOLSS_DELETEPRINTPROVIDOR", NDR_SPOOLSS_DELETEPRINTPROVIDOR, api_spoolss_DeletePrintProvidor},
7517         {"SPOOLSS_ENUMPRINTPROCDATATYPES", NDR_SPOOLSS_ENUMPRINTPROCDATATYPES, api_spoolss_EnumPrintProcDataTypes},
7518         {"SPOOLSS_RESETPRINTER", NDR_SPOOLSS_RESETPRINTER, api_spoolss_ResetPrinter},
7519         {"SPOOLSS_GETPRINTERDRIVER2", NDR_SPOOLSS_GETPRINTERDRIVER2, api_spoolss_GetPrinterDriver2},
7520         {"SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_FindFirstPrinterChangeNotification},
7521         {"SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION, api_spoolss_FindNextPrinterChangeNotification},
7522         {"SPOOLSS_FINDCLOSEPRINTERNOTIFY", NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY, api_spoolss_FindClosePrinterNotify},
7523         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD, api_spoolss_RouterFindFirstPrinterChangeNotificationOld},
7524         {"SPOOLSS_REPLYOPENPRINTER", NDR_SPOOLSS_REPLYOPENPRINTER, api_spoolss_ReplyOpenPrinter},
7525         {"SPOOLSS_ROUTERREPLYPRINTER", NDR_SPOOLSS_ROUTERREPLYPRINTER, api_spoolss_RouterReplyPrinter},
7526         {"SPOOLSS_REPLYCLOSEPRINTER", NDR_SPOOLSS_REPLYCLOSEPRINTER, api_spoolss_ReplyClosePrinter},
7527         {"SPOOLSS_ADDPORTEX", NDR_SPOOLSS_ADDPORTEX, api_spoolss_AddPortEx},
7528         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_RouterFindFirstPrinterChangeNotification},
7529         {"SPOOLSS_SPOOLERINIT", NDR_SPOOLSS_SPOOLERINIT, api_spoolss_SpoolerInit},
7530         {"SPOOLSS_RESETPRINTEREX", NDR_SPOOLSS_RESETPRINTEREX, api_spoolss_ResetPrinterEx},
7531         {"SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX", NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX, api_spoolss_RemoteFindFirstPrinterChangeNotifyEx},
7532         {"SPOOLSS_ROUTERREPLYPRINTEREX", NDR_SPOOLSS_ROUTERREPLYPRINTEREX, api_spoolss_RouterReplyPrinterEx},
7533         {"SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY", NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY, api_spoolss_RouterRefreshPrinterChangeNotify},
7534         {"SPOOLSS_44", NDR_SPOOLSS_44, api_spoolss_44},
7535         {"SPOOLSS_OPENPRINTEREX", NDR_SPOOLSS_OPENPRINTEREX, api_spoolss_OpenPrinterEx},
7536         {"SPOOLSS_ADDPRINTEREX", NDR_SPOOLSS_ADDPRINTEREX, api_spoolss_AddPrinterEx},
7537         {"SPOOLSS_47", NDR_SPOOLSS_47, api_spoolss_47},
7538         {"SPOOLSS_ENUMPRINTERDATA", NDR_SPOOLSS_ENUMPRINTERDATA, api_spoolss_EnumPrinterData},
7539         {"SPOOLSS_DELETEPRINTERDATA", NDR_SPOOLSS_DELETEPRINTERDATA, api_spoolss_DeletePrinterData},
7540         {"SPOOLSS_4A", NDR_SPOOLSS_4A, api_spoolss_4a},
7541         {"SPOOLSS_4B", NDR_SPOOLSS_4B, api_spoolss_4b},
7542         {"SPOOLSS_4C", NDR_SPOOLSS_4C, api_spoolss_4c},
7543         {"SPOOLSS_SETPRINTERDATAEX", NDR_SPOOLSS_SETPRINTERDATAEX, api_spoolss_SetPrinterDataEx},
7544         {"SPOOLSS_GETPRINTERDATAEX", NDR_SPOOLSS_GETPRINTERDATAEX, api_spoolss_GetPrinterDataEx},
7545         {"SPOOLSS_ENUMPRINTERDATAEX", NDR_SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_EnumPrinterDataEx},
7546         {"SPOOLSS_ENUMPRINTERKEY", NDR_SPOOLSS_ENUMPRINTERKEY, api_spoolss_EnumPrinterKey},
7547         {"SPOOLSS_DELETEPRINTERDATAEX", NDR_SPOOLSS_DELETEPRINTERDATAEX, api_spoolss_DeletePrinterDataEx},
7548         {"SPOOLSS_DELETEPRINTERKEY", NDR_SPOOLSS_DELETEPRINTERKEY, api_spoolss_DeletePrinterKey},
7549         {"SPOOLSS_53", NDR_SPOOLSS_53, api_spoolss_53},
7550         {"SPOOLSS_DELETEPRINTERDRIVEREX", NDR_SPOOLSS_DELETEPRINTERDRIVEREX, api_spoolss_DeletePrinterDriverEx},
7551         {"SPOOLSS_55", NDR_SPOOLSS_55, api_spoolss_55},
7552         {"SPOOLSS_56", NDR_SPOOLSS_56, api_spoolss_56},
7553         {"SPOOLSS_57", NDR_SPOOLSS_57, api_spoolss_57},
7554         {"SPOOLSS_XCVDATA", NDR_SPOOLSS_XCVDATA, api_spoolss_XcvData},
7555         {"SPOOLSS_ADDPRINTERDRIVEREX", NDR_SPOOLSS_ADDPRINTERDRIVEREX, api_spoolss_AddPrinterDriverEx},
7556         {"SPOOLSS_5A", NDR_SPOOLSS_5A, api_spoolss_5a},
7557         {"SPOOLSS_5B", NDR_SPOOLSS_5B, api_spoolss_5b},
7558         {"SPOOLSS_5C", NDR_SPOOLSS_5C, api_spoolss_5c},
7559         {"SPOOLSS_5D", NDR_SPOOLSS_5D, api_spoolss_5d},
7560         {"SPOOLSS_5E", NDR_SPOOLSS_5E, api_spoolss_5e},
7561         {"SPOOLSS_5F", NDR_SPOOLSS_5F, api_spoolss_5f},
7562 };
7563
7564 void spoolss_get_pipe_fns(struct api_struct **fns, int *n_fns)
7565 {
7566         *fns = api_spoolss_cmds;
7567         *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
7568 }
7569
7570 NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
7571 {
7572         if (cli->pipes_struct == NULL) {
7573                 return NT_STATUS_INVALID_PARAMETER;
7574         }
7575
7576         switch (opnum)
7577         {
7578                 case NDR_SPOOLSS_ENUMPRINTERS: {
7579                         struct spoolss_EnumPrinters *r = (struct spoolss_EnumPrinters *)_r;
7580                         ZERO_STRUCT(r->out);
7581                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7582                         if (r->out.count == NULL) {
7583                         return NT_STATUS_NO_MEMORY;
7584                         }
7585
7586                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo *);
7587                         if (r->out.info == NULL) {
7588                         return NT_STATUS_NO_MEMORY;
7589                         }
7590
7591                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7592                         if (r->out.needed == NULL) {
7593                         return NT_STATUS_NO_MEMORY;
7594                         }
7595
7596                         r->out.result = _spoolss_EnumPrinters(cli->pipes_struct, r);
7597                         return NT_STATUS_OK;
7598                 }
7599
7600                 case NDR_SPOOLSS_OPENPRINTER: {
7601                         struct spoolss_OpenPrinter *r = (struct spoolss_OpenPrinter *)_r;
7602                         ZERO_STRUCT(r->out);
7603                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
7604                         if (r->out.handle == NULL) {
7605                         return NT_STATUS_NO_MEMORY;
7606                         }
7607
7608                         r->out.result = _spoolss_OpenPrinter(cli->pipes_struct, r);
7609                         return NT_STATUS_OK;
7610                 }
7611
7612                 case NDR_SPOOLSS_SETJOB: {
7613                         struct spoolss_SetJob *r = (struct spoolss_SetJob *)_r;
7614                         r->out.result = _spoolss_SetJob(cli->pipes_struct, r);
7615                         return NT_STATUS_OK;
7616                 }
7617
7618                 case NDR_SPOOLSS_GETJOB: {
7619                         struct spoolss_GetJob *r = (struct spoolss_GetJob *)_r;
7620                         ZERO_STRUCT(r->out);
7621                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo);
7622                         if (r->out.info == NULL) {
7623                         return NT_STATUS_NO_MEMORY;
7624                         }
7625
7626                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7627                         if (r->out.needed == NULL) {
7628                         return NT_STATUS_NO_MEMORY;
7629                         }
7630
7631                         r->out.result = _spoolss_GetJob(cli->pipes_struct, r);
7632                         return NT_STATUS_OK;
7633                 }
7634
7635                 case NDR_SPOOLSS_ENUMJOBS: {
7636                         struct spoolss_EnumJobs *r = (struct spoolss_EnumJobs *)_r;
7637                         ZERO_STRUCT(r->out);
7638                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7639                         if (r->out.count == NULL) {
7640                         return NT_STATUS_NO_MEMORY;
7641                         }
7642
7643                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo *);
7644                         if (r->out.info == NULL) {
7645                         return NT_STATUS_NO_MEMORY;
7646                         }
7647
7648                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7649                         if (r->out.needed == NULL) {
7650                         return NT_STATUS_NO_MEMORY;
7651                         }
7652
7653                         r->out.result = _spoolss_EnumJobs(cli->pipes_struct, r);
7654                         return NT_STATUS_OK;
7655                 }
7656
7657                 case NDR_SPOOLSS_ADDPRINTER: {
7658                         struct spoolss_AddPrinter *r = (struct spoolss_AddPrinter *)_r;
7659                         ZERO_STRUCT(r->out);
7660                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
7661                         if (r->out.handle == NULL) {
7662                         return NT_STATUS_NO_MEMORY;
7663                         }
7664
7665                         r->out.result = _spoolss_AddPrinter(cli->pipes_struct, r);
7666                         return NT_STATUS_OK;
7667                 }
7668
7669                 case NDR_SPOOLSS_DELETEPRINTER: {
7670                         struct spoolss_DeletePrinter *r = (struct spoolss_DeletePrinter *)_r;
7671                         r->out.result = _spoolss_DeletePrinter(cli->pipes_struct, r);
7672                         return NT_STATUS_OK;
7673                 }
7674
7675                 case NDR_SPOOLSS_SETPRINTER: {
7676                         struct spoolss_SetPrinter *r = (struct spoolss_SetPrinter *)_r;
7677                         r->out.result = _spoolss_SetPrinter(cli->pipes_struct, r);
7678                         return NT_STATUS_OK;
7679                 }
7680
7681                 case NDR_SPOOLSS_GETPRINTER: {
7682                         struct spoolss_GetPrinter *r = (struct spoolss_GetPrinter *)_r;
7683                         ZERO_STRUCT(r->out);
7684                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
7685                         if (r->out.info == NULL) {
7686                         return NT_STATUS_NO_MEMORY;
7687                         }
7688
7689                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7690                         if (r->out.needed == NULL) {
7691                         return NT_STATUS_NO_MEMORY;
7692                         }
7693
7694                         r->out.result = _spoolss_GetPrinter(cli->pipes_struct, r);
7695                         return NT_STATUS_OK;
7696                 }
7697
7698                 case NDR_SPOOLSS_ADDPRINTERDRIVER: {
7699                         struct spoolss_AddPrinterDriver *r = (struct spoolss_AddPrinterDriver *)_r;
7700                         r->out.result = _spoolss_AddPrinterDriver(cli->pipes_struct, r);
7701                         return NT_STATUS_OK;
7702                 }
7703
7704                 case NDR_SPOOLSS_ENUMPRINTERDRIVERS: {
7705                         struct spoolss_EnumPrinterDrivers *r = (struct spoolss_EnumPrinterDrivers *)_r;
7706                         ZERO_STRUCT(r->out);
7707                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7708                         if (r->out.count == NULL) {
7709                         return NT_STATUS_NO_MEMORY;
7710                         }
7711
7712                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo *);
7713                         if (r->out.info == NULL) {
7714                         return NT_STATUS_NO_MEMORY;
7715                         }
7716
7717                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7718                         if (r->out.needed == NULL) {
7719                         return NT_STATUS_NO_MEMORY;
7720                         }
7721
7722                         r->out.result = _spoolss_EnumPrinterDrivers(cli->pipes_struct, r);
7723                         return NT_STATUS_OK;
7724                 }
7725
7726                 case NDR_SPOOLSS_GETPRINTERDRIVER: {
7727                         struct spoolss_GetPrinterDriver *r = (struct spoolss_GetPrinterDriver *)_r;
7728                         r->out.result = _spoolss_GetPrinterDriver(cli->pipes_struct, r);
7729                         return NT_STATUS_OK;
7730                 }
7731
7732                 case NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY: {
7733                         struct spoolss_GetPrinterDriverDirectory *r = (struct spoolss_GetPrinterDriverDirectory *)_r;
7734                         ZERO_STRUCT(r->out);
7735                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverDirectoryInfo);
7736                         if (r->out.info == NULL) {
7737                         return NT_STATUS_NO_MEMORY;
7738                         }
7739
7740                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7741                         if (r->out.needed == NULL) {
7742                         return NT_STATUS_NO_MEMORY;
7743                         }
7744
7745                         r->out.result = _spoolss_GetPrinterDriverDirectory(cli->pipes_struct, r);
7746                         return NT_STATUS_OK;
7747                 }
7748
7749                 case NDR_SPOOLSS_DELETEPRINTERDRIVER: {
7750                         struct spoolss_DeletePrinterDriver *r = (struct spoolss_DeletePrinterDriver *)_r;
7751                         r->out.result = _spoolss_DeletePrinterDriver(cli->pipes_struct, r);
7752                         return NT_STATUS_OK;
7753                 }
7754
7755                 case NDR_SPOOLSS_ADDPRINTPROCESSOR: {
7756                         struct spoolss_AddPrintProcessor *r = (struct spoolss_AddPrintProcessor *)_r;
7757                         r->out.result = _spoolss_AddPrintProcessor(cli->pipes_struct, r);
7758                         return NT_STATUS_OK;
7759                 }
7760
7761                 case NDR_SPOOLSS_ENUMPRINTPROCESSORS: {
7762                         struct spoolss_EnumPrintProcessors *r = (struct spoolss_EnumPrintProcessors *)_r;
7763                         ZERO_STRUCT(r->out);
7764                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7765                         if (r->out.count == NULL) {
7766                         return NT_STATUS_NO_MEMORY;
7767                         }
7768
7769                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcessorInfo *);
7770                         if (r->out.info == NULL) {
7771                         return NT_STATUS_NO_MEMORY;
7772                         }
7773
7774                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7775                         if (r->out.needed == NULL) {
7776                         return NT_STATUS_NO_MEMORY;
7777                         }
7778
7779                         r->out.result = _spoolss_EnumPrintProcessors(cli->pipes_struct, r);
7780                         return NT_STATUS_OK;
7781                 }
7782
7783                 case NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY: {
7784                         struct spoolss_GetPrintProcessorDirectory *r = (struct spoolss_GetPrintProcessorDirectory *)_r;
7785                         ZERO_STRUCT(r->out);
7786                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcessorDirectoryInfo);
7787                         if (r->out.info == NULL) {
7788                         return NT_STATUS_NO_MEMORY;
7789                         }
7790
7791                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7792                         if (r->out.needed == NULL) {
7793                         return NT_STATUS_NO_MEMORY;
7794                         }
7795
7796                         r->out.result = _spoolss_GetPrintProcessorDirectory(cli->pipes_struct, r);
7797                         return NT_STATUS_OK;
7798                 }
7799
7800                 case NDR_SPOOLSS_STARTDOCPRINTER: {
7801                         struct spoolss_StartDocPrinter *r = (struct spoolss_StartDocPrinter *)_r;
7802                         ZERO_STRUCT(r->out);
7803                         r->out.job_id = talloc_zero(mem_ctx, uint32_t);
7804                         if (r->out.job_id == NULL) {
7805                         return NT_STATUS_NO_MEMORY;
7806                         }
7807
7808                         r->out.result = _spoolss_StartDocPrinter(cli->pipes_struct, r);
7809                         return NT_STATUS_OK;
7810                 }
7811
7812                 case NDR_SPOOLSS_STARTPAGEPRINTER: {
7813                         struct spoolss_StartPagePrinter *r = (struct spoolss_StartPagePrinter *)_r;
7814                         r->out.result = _spoolss_StartPagePrinter(cli->pipes_struct, r);
7815                         return NT_STATUS_OK;
7816                 }
7817
7818                 case NDR_SPOOLSS_WRITEPRINTER: {
7819                         struct spoolss_WritePrinter *r = (struct spoolss_WritePrinter *)_r;
7820                         ZERO_STRUCT(r->out);
7821                         r->out.num_written = talloc_zero(mem_ctx, uint32_t);
7822                         if (r->out.num_written == NULL) {
7823                         return NT_STATUS_NO_MEMORY;
7824                         }
7825
7826                         r->out.result = _spoolss_WritePrinter(cli->pipes_struct, r);
7827                         return NT_STATUS_OK;
7828                 }
7829
7830                 case NDR_SPOOLSS_ENDPAGEPRINTER: {
7831                         struct spoolss_EndPagePrinter *r = (struct spoolss_EndPagePrinter *)_r;
7832                         r->out.result = _spoolss_EndPagePrinter(cli->pipes_struct, r);
7833                         return NT_STATUS_OK;
7834                 }
7835
7836                 case NDR_SPOOLSS_ABORTPRINTER: {
7837                         struct spoolss_AbortPrinter *r = (struct spoolss_AbortPrinter *)_r;
7838                         r->out.result = _spoolss_AbortPrinter(cli->pipes_struct, r);
7839                         return NT_STATUS_OK;
7840                 }
7841
7842                 case NDR_SPOOLSS_READPRINTER: {
7843                         struct spoolss_ReadPrinter *r = (struct spoolss_ReadPrinter *)_r;
7844                         ZERO_STRUCT(r->out);
7845                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_size);
7846                         if (r->out.data == NULL) {
7847                         return NT_STATUS_NO_MEMORY;
7848                         }
7849
7850                         r->out._data_size = talloc_zero(mem_ctx, uint32_t);
7851                         if (r->out._data_size == NULL) {
7852                         return NT_STATUS_NO_MEMORY;
7853                         }
7854
7855                         r->out.result = _spoolss_ReadPrinter(cli->pipes_struct, r);
7856                         return NT_STATUS_OK;
7857                 }
7858
7859                 case NDR_SPOOLSS_ENDDOCPRINTER: {
7860                         struct spoolss_EndDocPrinter *r = (struct spoolss_EndDocPrinter *)_r;
7861                         r->out.result = _spoolss_EndDocPrinter(cli->pipes_struct, r);
7862                         return NT_STATUS_OK;
7863                 }
7864
7865                 case NDR_SPOOLSS_ADDJOB: {
7866                         struct spoolss_AddJob *r = (struct spoolss_AddJob *)_r;
7867                         ZERO_STRUCT(r->out);
7868                         r->out.buffer = r->in.buffer;
7869                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7870                         if (r->out.needed == NULL) {
7871                         return NT_STATUS_NO_MEMORY;
7872                         }
7873
7874                         r->out.result = _spoolss_AddJob(cli->pipes_struct, r);
7875                         return NT_STATUS_OK;
7876                 }
7877
7878                 case NDR_SPOOLSS_SCHEDULEJOB: {
7879                         struct spoolss_ScheduleJob *r = (struct spoolss_ScheduleJob *)_r;
7880                         r->out.result = _spoolss_ScheduleJob(cli->pipes_struct, r);
7881                         return NT_STATUS_OK;
7882                 }
7883
7884                 case NDR_SPOOLSS_GETPRINTERDATA: {
7885                         struct spoolss_GetPrinterData *r = (struct spoolss_GetPrinterData *)_r;
7886                         ZERO_STRUCT(r->out);
7887                         r->out.type = talloc_zero(mem_ctx, enum winreg_Type);
7888                         if (r->out.type == NULL) {
7889                         return NT_STATUS_NO_MEMORY;
7890                         }
7891
7892                         r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData);
7893                         if (r->out.data == NULL) {
7894                         return NT_STATUS_NO_MEMORY;
7895                         }
7896
7897                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7898                         if (r->out.needed == NULL) {
7899                         return NT_STATUS_NO_MEMORY;
7900                         }
7901
7902                         r->out.result = _spoolss_GetPrinterData(cli->pipes_struct, r);
7903                         return NT_STATUS_OK;
7904                 }
7905
7906                 case NDR_SPOOLSS_SETPRINTERDATA: {
7907                         struct spoolss_SetPrinterData *r = (struct spoolss_SetPrinterData *)_r;
7908                         r->out.result = _spoolss_SetPrinterData(cli->pipes_struct, r);
7909                         return NT_STATUS_OK;
7910                 }
7911
7912                 case NDR_SPOOLSS_WAITFORPRINTERCHANGE: {
7913                         struct spoolss_WaitForPrinterChange *r = (struct spoolss_WaitForPrinterChange *)_r;
7914                         r->out.result = _spoolss_WaitForPrinterChange(cli->pipes_struct, r);
7915                         return NT_STATUS_OK;
7916                 }
7917
7918                 case NDR_SPOOLSS_CLOSEPRINTER: {
7919                         struct spoolss_ClosePrinter *r = (struct spoolss_ClosePrinter *)_r;
7920                         ZERO_STRUCT(r->out);
7921                         r->out.handle = r->in.handle;
7922                         r->out.result = _spoolss_ClosePrinter(cli->pipes_struct, r);
7923                         return NT_STATUS_OK;
7924                 }
7925
7926                 case NDR_SPOOLSS_ADDFORM: {
7927                         struct spoolss_AddForm *r = (struct spoolss_AddForm *)_r;
7928                         r->out.result = _spoolss_AddForm(cli->pipes_struct, r);
7929                         return NT_STATUS_OK;
7930                 }
7931
7932                 case NDR_SPOOLSS_DELETEFORM: {
7933                         struct spoolss_DeleteForm *r = (struct spoolss_DeleteForm *)_r;
7934                         r->out.result = _spoolss_DeleteForm(cli->pipes_struct, r);
7935                         return NT_STATUS_OK;
7936                 }
7937
7938                 case NDR_SPOOLSS_GETFORM: {
7939                         struct spoolss_GetForm *r = (struct spoolss_GetForm *)_r;
7940                         ZERO_STRUCT(r->out);
7941                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo);
7942                         if (r->out.info == NULL) {
7943                         return NT_STATUS_NO_MEMORY;
7944                         }
7945
7946                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7947                         if (r->out.needed == NULL) {
7948                         return NT_STATUS_NO_MEMORY;
7949                         }
7950
7951                         r->out.result = _spoolss_GetForm(cli->pipes_struct, r);
7952                         return NT_STATUS_OK;
7953                 }
7954
7955                 case NDR_SPOOLSS_SETFORM: {
7956                         struct spoolss_SetForm *r = (struct spoolss_SetForm *)_r;
7957                         r->out.result = _spoolss_SetForm(cli->pipes_struct, r);
7958                         return NT_STATUS_OK;
7959                 }
7960
7961                 case NDR_SPOOLSS_ENUMFORMS: {
7962                         struct spoolss_EnumForms *r = (struct spoolss_EnumForms *)_r;
7963                         ZERO_STRUCT(r->out);
7964                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7965                         if (r->out.count == NULL) {
7966                         return NT_STATUS_NO_MEMORY;
7967                         }
7968
7969                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo *);
7970                         if (r->out.info == NULL) {
7971                         return NT_STATUS_NO_MEMORY;
7972                         }
7973
7974                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7975                         if (r->out.needed == NULL) {
7976                         return NT_STATUS_NO_MEMORY;
7977                         }
7978
7979                         r->out.result = _spoolss_EnumForms(cli->pipes_struct, r);
7980                         return NT_STATUS_OK;
7981                 }
7982
7983                 case NDR_SPOOLSS_ENUMPORTS: {
7984                         struct spoolss_EnumPorts *r = (struct spoolss_EnumPorts *)_r;
7985                         ZERO_STRUCT(r->out);
7986                         r->out.count = talloc_zero(mem_ctx, uint32_t);
7987                         if (r->out.count == NULL) {
7988                         return NT_STATUS_NO_MEMORY;
7989                         }
7990
7991                         r->out.info = talloc_zero(mem_ctx, union spoolss_PortInfo *);
7992                         if (r->out.info == NULL) {
7993                         return NT_STATUS_NO_MEMORY;
7994                         }
7995
7996                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
7997                         if (r->out.needed == NULL) {
7998                         return NT_STATUS_NO_MEMORY;
7999                         }
8000
8001                         r->out.result = _spoolss_EnumPorts(cli->pipes_struct, r);
8002                         return NT_STATUS_OK;
8003                 }
8004
8005                 case NDR_SPOOLSS_ENUMMONITORS: {
8006                         struct spoolss_EnumMonitors *r = (struct spoolss_EnumMonitors *)_r;
8007                         ZERO_STRUCT(r->out);
8008                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8009                         if (r->out.count == NULL) {
8010                         return NT_STATUS_NO_MEMORY;
8011                         }
8012
8013                         r->out.info = talloc_zero(mem_ctx, union spoolss_MonitorInfo *);
8014                         if (r->out.info == NULL) {
8015                         return NT_STATUS_NO_MEMORY;
8016                         }
8017
8018                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8019                         if (r->out.needed == NULL) {
8020                         return NT_STATUS_NO_MEMORY;
8021                         }
8022
8023                         r->out.result = _spoolss_EnumMonitors(cli->pipes_struct, r);
8024                         return NT_STATUS_OK;
8025                 }
8026
8027                 case NDR_SPOOLSS_ADDPORT: {
8028                         struct spoolss_AddPort *r = (struct spoolss_AddPort *)_r;
8029                         r->out.result = _spoolss_AddPort(cli->pipes_struct, r);
8030                         return NT_STATUS_OK;
8031                 }
8032
8033                 case NDR_SPOOLSS_CONFIGUREPORT: {
8034                         struct spoolss_ConfigurePort *r = (struct spoolss_ConfigurePort *)_r;
8035                         r->out.result = _spoolss_ConfigurePort(cli->pipes_struct, r);
8036                         return NT_STATUS_OK;
8037                 }
8038
8039                 case NDR_SPOOLSS_DELETEPORT: {
8040                         struct spoolss_DeletePort *r = (struct spoolss_DeletePort *)_r;
8041                         r->out.result = _spoolss_DeletePort(cli->pipes_struct, r);
8042                         return NT_STATUS_OK;
8043                 }
8044
8045                 case NDR_SPOOLSS_CREATEPRINTERIC: {
8046                         struct spoolss_CreatePrinterIC *r = (struct spoolss_CreatePrinterIC *)_r;
8047                         r->out.result = _spoolss_CreatePrinterIC(cli->pipes_struct, r);
8048                         return NT_STATUS_OK;
8049                 }
8050
8051                 case NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC: {
8052                         struct spoolss_PlayGDIScriptOnPrinterIC *r = (struct spoolss_PlayGDIScriptOnPrinterIC *)_r;
8053                         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(cli->pipes_struct, r);
8054                         return NT_STATUS_OK;
8055                 }
8056
8057                 case NDR_SPOOLSS_DELETEPRINTERIC: {
8058                         struct spoolss_DeletePrinterIC *r = (struct spoolss_DeletePrinterIC *)_r;
8059                         r->out.result = _spoolss_DeletePrinterIC(cli->pipes_struct, r);
8060                         return NT_STATUS_OK;
8061                 }
8062
8063                 case NDR_SPOOLSS_ADDPRINTERCONNECTION: {
8064                         struct spoolss_AddPrinterConnection *r = (struct spoolss_AddPrinterConnection *)_r;
8065                         r->out.result = _spoolss_AddPrinterConnection(cli->pipes_struct, r);
8066                         return NT_STATUS_OK;
8067                 }
8068
8069                 case NDR_SPOOLSS_DELETEPRINTERCONNECTION: {
8070                         struct spoolss_DeletePrinterConnection *r = (struct spoolss_DeletePrinterConnection *)_r;
8071                         r->out.result = _spoolss_DeletePrinterConnection(cli->pipes_struct, r);
8072                         return NT_STATUS_OK;
8073                 }
8074
8075                 case NDR_SPOOLSS_PRINTERMESSAGEBOX: {
8076                         struct spoolss_PrinterMessageBox *r = (struct spoolss_PrinterMessageBox *)_r;
8077                         r->out.result = _spoolss_PrinterMessageBox(cli->pipes_struct, r);
8078                         return NT_STATUS_OK;
8079                 }
8080
8081                 case NDR_SPOOLSS_ADDMONITOR: {
8082                         struct spoolss_AddMonitor *r = (struct spoolss_AddMonitor *)_r;
8083                         r->out.result = _spoolss_AddMonitor(cli->pipes_struct, r);
8084                         return NT_STATUS_OK;
8085                 }
8086
8087                 case NDR_SPOOLSS_DELETEMONITOR: {
8088                         struct spoolss_DeleteMonitor *r = (struct spoolss_DeleteMonitor *)_r;
8089                         r->out.result = _spoolss_DeleteMonitor(cli->pipes_struct, r);
8090                         return NT_STATUS_OK;
8091                 }
8092
8093                 case NDR_SPOOLSS_DELETEPRINTPROCESSOR: {
8094                         struct spoolss_DeletePrintProcessor *r = (struct spoolss_DeletePrintProcessor *)_r;
8095                         r->out.result = _spoolss_DeletePrintProcessor(cli->pipes_struct, r);
8096                         return NT_STATUS_OK;
8097                 }
8098
8099                 case NDR_SPOOLSS_ADDPRINTPROVIDOR: {
8100                         struct spoolss_AddPrintProvidor *r = (struct spoolss_AddPrintProvidor *)_r;
8101                         r->out.result = _spoolss_AddPrintProvidor(cli->pipes_struct, r);
8102                         return NT_STATUS_OK;
8103                 }
8104
8105                 case NDR_SPOOLSS_DELETEPRINTPROVIDOR: {
8106                         struct spoolss_DeletePrintProvidor *r = (struct spoolss_DeletePrintProvidor *)_r;
8107                         r->out.result = _spoolss_DeletePrintProvidor(cli->pipes_struct, r);
8108                         return NT_STATUS_OK;
8109                 }
8110
8111                 case NDR_SPOOLSS_ENUMPRINTPROCDATATYPES: {
8112                         struct spoolss_EnumPrintProcDataTypes *r = (struct spoolss_EnumPrintProcDataTypes *)_r;
8113                         ZERO_STRUCT(r->out);
8114                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8115                         if (r->out.count == NULL) {
8116                         return NT_STATUS_NO_MEMORY;
8117                         }
8118
8119                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcDataTypesInfo *);
8120                         if (r->out.info == NULL) {
8121                         return NT_STATUS_NO_MEMORY;
8122                         }
8123
8124                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8125                         if (r->out.needed == NULL) {
8126                         return NT_STATUS_NO_MEMORY;
8127                         }
8128
8129                         r->out.result = _spoolss_EnumPrintProcDataTypes(cli->pipes_struct, r);
8130                         return NT_STATUS_OK;
8131                 }
8132
8133                 case NDR_SPOOLSS_RESETPRINTER: {
8134                         struct spoolss_ResetPrinter *r = (struct spoolss_ResetPrinter *)_r;
8135                         r->out.result = _spoolss_ResetPrinter(cli->pipes_struct, r);
8136                         return NT_STATUS_OK;
8137                 }
8138
8139                 case NDR_SPOOLSS_GETPRINTERDRIVER2: {
8140                         struct spoolss_GetPrinterDriver2 *r = (struct spoolss_GetPrinterDriver2 *)_r;
8141                         ZERO_STRUCT(r->out);
8142                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo);
8143                         if (r->out.info == NULL) {
8144                         return NT_STATUS_NO_MEMORY;
8145                         }
8146
8147                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8148                         if (r->out.needed == NULL) {
8149                         return NT_STATUS_NO_MEMORY;
8150                         }
8151
8152                         r->out.server_major_version = talloc_zero(mem_ctx, uint32_t);
8153                         if (r->out.server_major_version == NULL) {
8154                         return NT_STATUS_NO_MEMORY;
8155                         }
8156
8157                         r->out.server_minor_version = talloc_zero(mem_ctx, uint32_t);
8158                         if (r->out.server_minor_version == NULL) {
8159                         return NT_STATUS_NO_MEMORY;
8160                         }
8161
8162                         r->out.result = _spoolss_GetPrinterDriver2(cli->pipes_struct, r);
8163                         return NT_STATUS_OK;
8164                 }
8165
8166                 case NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION: {
8167                         struct spoolss_FindFirstPrinterChangeNotification *r = (struct spoolss_FindFirstPrinterChangeNotification *)_r;
8168                         r->out.result = _spoolss_FindFirstPrinterChangeNotification(cli->pipes_struct, r);
8169                         return NT_STATUS_OK;
8170                 }
8171
8172                 case NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION: {
8173                         struct spoolss_FindNextPrinterChangeNotification *r = (struct spoolss_FindNextPrinterChangeNotification *)_r;
8174                         r->out.result = _spoolss_FindNextPrinterChangeNotification(cli->pipes_struct, r);
8175                         return NT_STATUS_OK;
8176                 }
8177
8178                 case NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY: {
8179                         struct spoolss_FindClosePrinterNotify *r = (struct spoolss_FindClosePrinterNotify *)_r;
8180                         r->out.result = _spoolss_FindClosePrinterNotify(cli->pipes_struct, r);
8181                         return NT_STATUS_OK;
8182                 }
8183
8184                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD: {
8185                         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r = (struct spoolss_RouterFindFirstPrinterChangeNotificationOld *)_r;
8186                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(cli->pipes_struct, r);
8187                         return NT_STATUS_OK;
8188                 }
8189
8190                 case NDR_SPOOLSS_REPLYOPENPRINTER: {
8191                         struct spoolss_ReplyOpenPrinter *r = (struct spoolss_ReplyOpenPrinter *)_r;
8192                         ZERO_STRUCT(r->out);
8193                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8194                         if (r->out.handle == NULL) {
8195                         return NT_STATUS_NO_MEMORY;
8196                         }
8197
8198                         r->out.result = _spoolss_ReplyOpenPrinter(cli->pipes_struct, r);
8199                         return NT_STATUS_OK;
8200                 }
8201
8202                 case NDR_SPOOLSS_ROUTERREPLYPRINTER: {
8203                         struct spoolss_RouterReplyPrinter *r = (struct spoolss_RouterReplyPrinter *)_r;
8204                         r->out.result = _spoolss_RouterReplyPrinter(cli->pipes_struct, r);
8205                         return NT_STATUS_OK;
8206                 }
8207
8208                 case NDR_SPOOLSS_REPLYCLOSEPRINTER: {
8209                         struct spoolss_ReplyClosePrinter *r = (struct spoolss_ReplyClosePrinter *)_r;
8210                         ZERO_STRUCT(r->out);
8211                         r->out.handle = r->in.handle;
8212                         r->out.result = _spoolss_ReplyClosePrinter(cli->pipes_struct, r);
8213                         return NT_STATUS_OK;
8214                 }
8215
8216                 case NDR_SPOOLSS_ADDPORTEX: {
8217                         struct spoolss_AddPortEx *r = (struct spoolss_AddPortEx *)_r;
8218                         r->out.result = _spoolss_AddPortEx(cli->pipes_struct, r);
8219                         return NT_STATUS_OK;
8220                 }
8221
8222                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION: {
8223                         struct spoolss_RouterFindFirstPrinterChangeNotification *r = (struct spoolss_RouterFindFirstPrinterChangeNotification *)_r;
8224                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(cli->pipes_struct, r);
8225                         return NT_STATUS_OK;
8226                 }
8227
8228                 case NDR_SPOOLSS_SPOOLERINIT: {
8229                         struct spoolss_SpoolerInit *r = (struct spoolss_SpoolerInit *)_r;
8230                         r->out.result = _spoolss_SpoolerInit(cli->pipes_struct, r);
8231                         return NT_STATUS_OK;
8232                 }
8233
8234                 case NDR_SPOOLSS_RESETPRINTEREX: {
8235                         struct spoolss_ResetPrinterEx *r = (struct spoolss_ResetPrinterEx *)_r;
8236                         r->out.result = _spoolss_ResetPrinterEx(cli->pipes_struct, r);
8237                         return NT_STATUS_OK;
8238                 }
8239
8240                 case NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX: {
8241                         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r = (struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *)_r;
8242                         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(cli->pipes_struct, r);
8243                         return NT_STATUS_OK;
8244                 }
8245
8246                 case NDR_SPOOLSS_ROUTERREPLYPRINTEREX: {
8247                         struct spoolss_RouterReplyPrinterEx *r = (struct spoolss_RouterReplyPrinterEx *)_r;
8248                         ZERO_STRUCT(r->out);
8249                         r->out.reply_result = talloc_zero(mem_ctx, uint32_t);
8250                         if (r->out.reply_result == NULL) {
8251                         return NT_STATUS_NO_MEMORY;
8252                         }
8253
8254                         r->out.result = _spoolss_RouterReplyPrinterEx(cli->pipes_struct, r);
8255                         return NT_STATUS_OK;
8256                 }
8257
8258                 case NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY: {
8259                         struct spoolss_RouterRefreshPrinterChangeNotify *r = (struct spoolss_RouterRefreshPrinterChangeNotify *)_r;
8260                         ZERO_STRUCT(r->out);
8261                         r->out.info = talloc_zero(mem_ctx, struct spoolss_NotifyInfo *);
8262                         if (r->out.info == NULL) {
8263                         return NT_STATUS_NO_MEMORY;
8264                         }
8265
8266                         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(cli->pipes_struct, r);
8267                         return NT_STATUS_OK;
8268                 }
8269
8270                 case NDR_SPOOLSS_44: {
8271                         struct spoolss_44 *r = (struct spoolss_44 *)_r;
8272                         r->out.result = _spoolss_44(cli->pipes_struct, r);
8273                         return NT_STATUS_OK;
8274                 }
8275
8276                 case NDR_SPOOLSS_OPENPRINTEREX: {
8277                         struct spoolss_OpenPrinterEx *r = (struct spoolss_OpenPrinterEx *)_r;
8278                         ZERO_STRUCT(r->out);
8279                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8280                         if (r->out.handle == NULL) {
8281                         return NT_STATUS_NO_MEMORY;
8282                         }
8283
8284                         r->out.result = _spoolss_OpenPrinterEx(cli->pipes_struct, r);
8285                         return NT_STATUS_OK;
8286                 }
8287
8288                 case NDR_SPOOLSS_ADDPRINTEREX: {
8289                         struct spoolss_AddPrinterEx *r = (struct spoolss_AddPrinterEx *)_r;
8290                         ZERO_STRUCT(r->out);
8291                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8292                         if (r->out.handle == NULL) {
8293                         return NT_STATUS_NO_MEMORY;
8294                         }
8295
8296                         r->out.result = _spoolss_AddPrinterEx(cli->pipes_struct, r);
8297                         return NT_STATUS_OK;
8298                 }
8299
8300                 case NDR_SPOOLSS_47: {
8301                         struct spoolss_47 *r = (struct spoolss_47 *)_r;
8302                         r->out.result = _spoolss_47(cli->pipes_struct, r);
8303                         return NT_STATUS_OK;
8304                 }
8305
8306                 case NDR_SPOOLSS_ENUMPRINTERDATA: {
8307                         struct spoolss_EnumPrinterData *r = (struct spoolss_EnumPrinterData *)_r;
8308                         ZERO_STRUCT(r->out);
8309                         r->out.value_name = talloc_zero_array(mem_ctx, const char, r->in.value_offered / 2);
8310                         if (r->out.value_name == NULL) {
8311                         return NT_STATUS_NO_MEMORY;
8312                         }
8313
8314                         r->out.value_needed = talloc_zero(mem_ctx, uint32_t);
8315                         if (r->out.value_needed == NULL) {
8316                         return NT_STATUS_NO_MEMORY;
8317                         }
8318
8319                         r->out.type = talloc_zero(mem_ctx, enum winreg_Type);
8320                         if (r->out.type == NULL) {
8321                         return NT_STATUS_NO_MEMORY;
8322                         }
8323
8324                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_offered);
8325                         if (r->out.data == NULL) {
8326                         return NT_STATUS_NO_MEMORY;
8327                         }
8328
8329                         r->out.data_needed = talloc_zero(mem_ctx, uint32_t);
8330                         if (r->out.data_needed == NULL) {
8331                         return NT_STATUS_NO_MEMORY;
8332                         }
8333
8334                         r->out.result = _spoolss_EnumPrinterData(cli->pipes_struct, r);
8335                         return NT_STATUS_OK;
8336                 }
8337
8338                 case NDR_SPOOLSS_DELETEPRINTERDATA: {
8339                         struct spoolss_DeletePrinterData *r = (struct spoolss_DeletePrinterData *)_r;
8340                         r->out.result = _spoolss_DeletePrinterData(cli->pipes_struct, r);
8341                         return NT_STATUS_OK;
8342                 }
8343
8344                 case NDR_SPOOLSS_4A: {
8345                         struct spoolss_4a *r = (struct spoolss_4a *)_r;
8346                         r->out.result = _spoolss_4a(cli->pipes_struct, r);
8347                         return NT_STATUS_OK;
8348                 }
8349
8350                 case NDR_SPOOLSS_4B: {
8351                         struct spoolss_4b *r = (struct spoolss_4b *)_r;
8352                         r->out.result = _spoolss_4b(cli->pipes_struct, r);
8353                         return NT_STATUS_OK;
8354                 }
8355
8356                 case NDR_SPOOLSS_4C: {
8357                         struct spoolss_4c *r = (struct spoolss_4c *)_r;
8358                         r->out.result = _spoolss_4c(cli->pipes_struct, r);
8359                         return NT_STATUS_OK;
8360                 }
8361
8362                 case NDR_SPOOLSS_SETPRINTERDATAEX: {
8363                         struct spoolss_SetPrinterDataEx *r = (struct spoolss_SetPrinterDataEx *)_r;
8364                         r->out.result = _spoolss_SetPrinterDataEx(cli->pipes_struct, r);
8365                         return NT_STATUS_OK;
8366                 }
8367
8368                 case NDR_SPOOLSS_GETPRINTERDATAEX: {
8369                         struct spoolss_GetPrinterDataEx *r = (struct spoolss_GetPrinterDataEx *)_r;
8370                         ZERO_STRUCT(r->out);
8371                         r->out.type = talloc_zero(mem_ctx, enum winreg_Type);
8372                         if (r->out.type == NULL) {
8373                         return NT_STATUS_NO_MEMORY;
8374                         }
8375
8376                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
8377                         if (r->out.buffer == NULL) {
8378                         return NT_STATUS_NO_MEMORY;
8379                         }
8380
8381                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8382                         if (r->out.needed == NULL) {
8383                         return NT_STATUS_NO_MEMORY;
8384                         }
8385
8386                         r->out.result = _spoolss_GetPrinterDataEx(cli->pipes_struct, r);
8387                         return NT_STATUS_OK;
8388                 }
8389
8390                 case NDR_SPOOLSS_ENUMPRINTERDATAEX: {
8391                         struct spoolss_EnumPrinterDataEx *r = (struct spoolss_EnumPrinterDataEx *)_r;
8392                         ZERO_STRUCT(r->out);
8393                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8394                         if (r->out.count == NULL) {
8395                         return NT_STATUS_NO_MEMORY;
8396                         }
8397
8398                         r->out.info = talloc_zero(mem_ctx, struct spoolss_PrinterEnumValues *);
8399                         if (r->out.info == NULL) {
8400                         return NT_STATUS_NO_MEMORY;
8401                         }
8402
8403                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8404                         if (r->out.needed == NULL) {
8405                         return NT_STATUS_NO_MEMORY;
8406                         }
8407
8408                         r->out.result = _spoolss_EnumPrinterDataEx(cli->pipes_struct, r);
8409                         return NT_STATUS_OK;
8410                 }
8411
8412                 case NDR_SPOOLSS_ENUMPRINTERKEY: {
8413                         struct spoolss_EnumPrinterKey *r = (struct spoolss_EnumPrinterKey *)_r;
8414                         ZERO_STRUCT(r->out);
8415                         r->out.key_buffer = talloc_zero(mem_ctx, const char **);
8416                         if (r->out.key_buffer == NULL) {
8417                         return NT_STATUS_NO_MEMORY;
8418                         }
8419
8420                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8421                         if (r->out.needed == NULL) {
8422                         return NT_STATUS_NO_MEMORY;
8423                         }
8424
8425                         r->out.result = _spoolss_EnumPrinterKey(cli->pipes_struct, r);
8426                         return NT_STATUS_OK;
8427                 }
8428
8429                 case NDR_SPOOLSS_DELETEPRINTERDATAEX: {
8430                         struct spoolss_DeletePrinterDataEx *r = (struct spoolss_DeletePrinterDataEx *)_r;
8431                         r->out.result = _spoolss_DeletePrinterDataEx(cli->pipes_struct, r);
8432                         return NT_STATUS_OK;
8433                 }
8434
8435                 case NDR_SPOOLSS_DELETEPRINTERKEY: {
8436                         struct spoolss_DeletePrinterKey *r = (struct spoolss_DeletePrinterKey *)_r;
8437                         r->out.result = _spoolss_DeletePrinterKey(cli->pipes_struct, r);
8438                         return NT_STATUS_OK;
8439                 }
8440
8441                 case NDR_SPOOLSS_53: {
8442                         struct spoolss_53 *r = (struct spoolss_53 *)_r;
8443                         r->out.result = _spoolss_53(cli->pipes_struct, r);
8444                         return NT_STATUS_OK;
8445                 }
8446
8447                 case NDR_SPOOLSS_DELETEPRINTERDRIVEREX: {
8448                         struct spoolss_DeletePrinterDriverEx *r = (struct spoolss_DeletePrinterDriverEx *)_r;
8449                         r->out.result = _spoolss_DeletePrinterDriverEx(cli->pipes_struct, r);
8450                         return NT_STATUS_OK;
8451                 }
8452
8453                 case NDR_SPOOLSS_55: {
8454                         struct spoolss_55 *r = (struct spoolss_55 *)_r;
8455                         r->out.result = _spoolss_55(cli->pipes_struct, r);
8456                         return NT_STATUS_OK;
8457                 }
8458
8459                 case NDR_SPOOLSS_56: {
8460                         struct spoolss_56 *r = (struct spoolss_56 *)_r;
8461                         r->out.result = _spoolss_56(cli->pipes_struct, r);
8462                         return NT_STATUS_OK;
8463                 }
8464
8465                 case NDR_SPOOLSS_57: {
8466                         struct spoolss_57 *r = (struct spoolss_57 *)_r;
8467                         r->out.result = _spoolss_57(cli->pipes_struct, r);
8468                         return NT_STATUS_OK;
8469                 }
8470
8471                 case NDR_SPOOLSS_XCVDATA: {
8472                         struct spoolss_XcvData *r = (struct spoolss_XcvData *)_r;
8473                         ZERO_STRUCT(r->out);
8474                         r->out.status_code = r->in.status_code;
8475                         r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.out_data_size);
8476                         if (r->out.out_data == NULL) {
8477                         return NT_STATUS_NO_MEMORY;
8478                         }
8479
8480                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8481                         if (r->out.needed == NULL) {
8482                         return NT_STATUS_NO_MEMORY;
8483                         }
8484
8485                         r->out.result = _spoolss_XcvData(cli->pipes_struct, r);
8486                         return NT_STATUS_OK;
8487                 }
8488
8489                 case NDR_SPOOLSS_ADDPRINTERDRIVEREX: {
8490                         struct spoolss_AddPrinterDriverEx *r = (struct spoolss_AddPrinterDriverEx *)_r;
8491                         r->out.result = _spoolss_AddPrinterDriverEx(cli->pipes_struct, r);
8492                         return NT_STATUS_OK;
8493                 }
8494
8495                 case NDR_SPOOLSS_5A: {
8496                         struct spoolss_5a *r = (struct spoolss_5a *)_r;
8497                         r->out.result = _spoolss_5a(cli->pipes_struct, r);
8498                         return NT_STATUS_OK;
8499                 }
8500
8501                 case NDR_SPOOLSS_5B: {
8502                         struct spoolss_5b *r = (struct spoolss_5b *)_r;
8503                         r->out.result = _spoolss_5b(cli->pipes_struct, r);
8504                         return NT_STATUS_OK;
8505                 }
8506
8507                 case NDR_SPOOLSS_5C: {
8508                         struct spoolss_5c *r = (struct spoolss_5c *)_r;
8509                         r->out.result = _spoolss_5c(cli->pipes_struct, r);
8510                         return NT_STATUS_OK;
8511                 }
8512
8513                 case NDR_SPOOLSS_5D: {
8514                         struct spoolss_5d *r = (struct spoolss_5d *)_r;
8515                         r->out.result = _spoolss_5d(cli->pipes_struct, r);
8516                         return NT_STATUS_OK;
8517                 }
8518
8519                 case NDR_SPOOLSS_5E: {
8520                         struct spoolss_5e *r = (struct spoolss_5e *)_r;
8521                         r->out.result = _spoolss_5e(cli->pipes_struct, r);
8522                         return NT_STATUS_OK;
8523                 }
8524
8525                 case NDR_SPOOLSS_5F: {
8526                         struct spoolss_5f *r = (struct spoolss_5f *)_r;
8527                         r->out.result = _spoolss_5f(cli->pipes_struct, r);
8528                         return NT_STATUS_OK;
8529                 }
8530
8531                 default:
8532                         return NT_STATUS_NOT_IMPLEMENTED;
8533         }
8534 }
8535
8536 NTSTATUS rpc_spoolss_init(void)
8537 {
8538         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", &ndr_table_spoolss, api_spoolss_cmds, sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
8539 }